Score:0

Routing between 2 networks on Linux

az flag

My system topology:

On an ubuntu machine with 2 ethernet ports (eth0, eth1) i have connected another ubuntu machine as client and an OCRCamera (also client).

the requirement is that the main ubuntu machine will be DHCP server and router, so that the ubuntu-client and the camera will both get IP address from the main ubuntu machine. The ubuntu-client and the camera need to be able to ping/ssh one another.

with nmcli commands and configuration file in "/etc/dnsmasq.d/X", i have configured both eth0 and eth1 on the main ubuntu machine in a shared mode:

"/etc/dnsmasq.d/XXX" config file:

no-resolv
port=53
bogus-priv
strict-order
expand-hosts

domain=wombat.pixellot.com

# Set Listen address
listen-address=192.168.101.1
dhcp-range=set:group1,192.168.101.10,192.168.101.100,24h
dhcp-option=tag:group1,option:router,192.168.101.1
dhcp-option=tag:group1,option:dns-server,192.168.101.1
dhcp-option=tag:group1,option:netmask,255.255.255.0

listen-address=192.168.102.1
dhcp-range=set:group2,192.168.102.10,192.168.102.100,24h
dhcp-option=tag:group2,option:router,192.168.102.1
dhcp-option=tag:group2,option:dns-server,192.168.102.1
dhcp-option=tag:group2,option:netmask,255.255.255.0

nmcli commands:

sudo nmcli connection add type ethernet ifname eth0 ipv4.method shared con-name EthCon0
sudo nmcli connection add type ethernet ifname eth1 ipv4.method shared con-name EthCon1

sudo nmcli connection modify EthCon0 ipv4.addresses 169.254.101.1/24
sudo nmcli connection modify EthCon1 ipv4.addresses 169.254.101.2/24

sudo nmcli connection up EthCon0
sudo nmcli connection up EthCon1

This is how ifconfig on the main ubuntu machine looks like:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.101.1  netmask 255.255.255.0  broadcast 192.168.101.255
        inet6 fe80::c706:5a57:f51d:a8b0  prefixlen 64  scopeid 0x20<link>
        ether 48:b0:2d:3b:6d:0b  txqueuelen 1000  (Ethernet)
        RX packets 76802  bytes 6700303 (6.7 MB)
        RX errors 0  dropped 8  overruns 0  frame 0
        TX packets 73153  bytes 7426646 (7.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 37  

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.102.1  netmask 255.255.255.0  broadcast 192.168.102.255
        inet6 fe80::cf74:51de:1317:fe42  prefixlen 64  scopeid 0x20<link>
        ether ae:aa:82:3c:08:6c  txqueuelen 1000  (Ethernet)
        RX packets 41  bytes 4289 (4.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 187  bytes 29743 (29.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

The ubuntu client, and the camera connected to eth0 and eth1 respectively, got an ip addressed, and pinging is available:

pixellot@wombat:~$ sudo ping 192.168.101.98
PING 192.168.101.98 (192.168.101.98) 56(84) bytes of data.
64 bytes from 192.168.101.98: icmp_seq=1 ttl=64 time=0.581 ms
64 bytes from 192.168.101.98: icmp_seq=2 ttl=64 time=0.569 ms

pixellot@wombat:~$ sudo ping 192.168.102.32
PING 192.168.102.32 (192.168.102.32) 56(84) bytes of data.
64 bytes from 192.168.102.32: icmp_seq=1 ttl=64 time=0.451 ms
64 bytes from 192.168.102.32: icmp_seq=2 ttl=64 time=0.508 ms

but, when i'm trying to ping from the ubuntu-client to the camera, it wont work:

yvesh@yvesh-XPS-15-9510:~$ ping 192.168.102.32
PING 192.168.102.32 (192.168.102.32) 56(84) bytes of data.
From 192.168.101.98 icmp_seq=1 Destination Host Unreachable
From 192.168.101.98 icmp_seq=2 Destination Host Unreachable

How can i make both clients communicate with each-other? Is there any routing solution to this issue? (Not ssh-tunneling) i have tried many things but i am stuck real bad on it and cant develop further :-( Please help! <3

Martin avatar
kz flag
two things: `ip_forward` is enabled? Do you have a firewall ( `ufw` f.e.) in place on your "ubuntu router" ?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.