0

I have a peculiar problem as described below.

Two sites with a linux (Raspbian Jessie Lite) based routers each having network as stated below

Site1

Raspberry Pi Router 1

eth0 192.168.1.101/24

eth1 192.168.230.1/24

Computer1 connected to above router with address 192.168.230.103 Gateway is 192.168.230.1

Site2

Raspberry Pi Router 2

eth0 192.168.1.102/24

eth1 192.168.231.1/24

Computer2 connected to above router with address 192.168.231.103 Gateway is 192.168.231.1

Router 1 configuration

/etc/iproute2/rt_tables on Router 1

.

.

.

1 eth0

2 eth1

/etc/network/interfaces file on Router 1

source-directory /etc/network/interfaces.d

auto lo

iface lo inet loopback

allow-hotplug eth0

auto eth0

iface eth0 inet static

hwaddress ether b8:27:eb:89:27:4f

address 192.168.1.101

netmask 255.255.255.0

network 192.168.1.0

broadcast 192.168.1.255

up ip route add 192.168.1.0/24 dev eth0 table eth0

up ip route add default via 192.168.1.101 dev eth0 table eth0

up ip rule add from 192.168.1.101/32 table eth0

up ip rule add to 192.168.1.101/32 table eth0

allow-hotplug eth1

auto eth1

iface eth1 inet static

hwaddress 00:e0:4c:53:44:58

address 192.168.230.1

netmask 255.255.255.0

network 192.168.230.0

broadcast 192.168.230.255

up ip route add 192.168.230.0/24 dev eth1 table eth1

up ip rule add from 192.168.230.1/32 table eth1

up ip rule add to 192.168.230.1/32 table eth1

I also applied IP Forwarding through following commands as a root user echo 1 > /proc/sys/net/ipv4/ip_forward Also, in the /etc/sysctl.conf file , I set net.ipv4.conf.all.forwading=1

Configuration for Router 2 is exactly same with appropriate addresses set. In effect, the setup is

Computer1<------>Raspberry router1<------->Raspberry Router2<------> Computer2 Configuration is a simple lab setup without internet and NAT Problem From Computer 1, I can ping router 1 interfaces 192.168.230.1 (No problem) and 192.168.1.101 and I can ping Router 2 interface 192.168.1.102. But I cant ping the LAN side interface of Router 2 that is 192.168.231.1 and obviously, I cant ping computer 2 at 192.168.230.103. Same problem occurs from Computer 2. Both Computers run Ubuntu 16.04 LTS.

I alternatively also tried adding routes on each router (Route of Router 1 specified below)

route ip add -net 192.168.1.0 netmask 255.255.255.0 eth0

route ip add -net 192.168.230.0 netmask 255.255.255.0 eth1

route ip add -net 192.168.231.0 netmask 255.255.255.0 eth0

However, the result is the same. Can anyone give me working configuration for the same.

Thanks and regards in advance

1

Your routes are missing a Gateway. The Routers do not know how to reach the LAN network of the other router. Specifying only the device as you did is not sufficient as there are 253 possible gateways to reach the other LAN.

Try setting a route on Router 1 like this:

route add -net 192.168.231.0 netmask 255.255.255.0 gw 192.168.1.102 dev eth0

On Router 2:

route add -net 192.168.230.0 netmask 255.255.255.0 gw 192.168.1.101 dev eth0
  • Thx Joni. Problem solved – rahul Jul 23 '17 at 16:30

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.