[CentOS] Static routing on CentOS

Wed Feb 26 14:00:24 UTC 2014
sjt5atra <sjt5atra at gmail.com>

> On Feb 26, 2014, at 1:28 AM, Jatin Davey <jashokda at cisco.com> wrote:
> 
> Hi All
> 
> I have two hosts. Host A and Host B
> 
> Host A routing table
> ------------------------
> [root at localhost ~]# route -n
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use 
> Iface
> 172.29.110.0    172.29.109.1    255.255.255.0   UG    0 0        0 eth0
> 172.29.109.0    0.0.0.0         255.255.255.0   U     0 0        0 eth0
> 169.254.0.0     0.0.0.0         255.255.0.0     U     0 0        0 eth0
> 0.0.0.0         172.29.109.1    0.0.0.0         UG    0 0        0 eth0
> 
> HOST A IP address : 172.29.109.254
> 
> 
> 
> Host B routing table
> -------------------------
> [jatin at localhost ~]$ route -n
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use 
> Iface
> 172.29.110.0    0.0.0.0         255.255.255.0   U     1 0        0 eth0
> 20.20.20.0      0.0.0.0         255.255.255.0   U     0 0        0 eth0
> 169.254.0.0     0.0.0.0         255.255.0.0     U     1002 0        0 eth0
> 0.0.0.0         172.29.110.1    0.0.0.0         UG    0 0        0 eth0
> 
> HOST B Ip address : 172.29.110.93
> 
> 
> Host B basically houses some simulated devices which are configured in 
> the ip address range of 20.20.20.1 to 20.20.20.254. The netmask being 
> used here is 255.255.255.0
> 
> I want to configure a static route on HOST A so that they can reach the 
> simulated devices running on HOST B which are in the ip address range 
> 20.20.20.1-20.20.20.254 , I am trying the following command but it does 
> not configure the static route for me.
> 
> [root at localhost ~]# route add -net 20.20.20.0 netmask 255.255.255.0 gw 
> 172.29.110.93
> SIOCADDRT: Network is unreachable
> 
> 
> Any help is greatly appreciated.
> 
> Thanks
> Jatin

Your router (172.29.110.1) will need a static route to 20.20.20.0/24.