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
On 02/26/2014 07:28 AM, Jatin Davey 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 >On B first add route to A's subnet: route add -net 172.29.109.0 netmask 255.255.255.0 gw 172.29.110.1 Also, 172.29.109.1 and 172.29.110.1 must know how to find each other. Use ping and traceroute to test availability for every subnet between you. And see if they can ping each other. Once ping works, your route should have looked like this: route add -net 20.20.20.0 netmask 255.255.255.0 gw 172.29.109.1 (always the first gateway on your way to some IP/subnet!) BUT considering 172.29.109.1 is ALREADY your DEFAULT gateway, there is no need to added above route, but fix the other side, that HOST B can see/ping HOST A. Consider routing as sending package by mail. You do write destination address on the package, but you do not carry it yourself. You take it to closest Post office, clerk looks at the address, finds closest post office/depot in that direction and sends it on it's way THERE, so another clerk (router) there looks for closest post office/depo in the direction of the destination address. BUT, no post clerk/ router only needs to know NEXT office/depot to sent it to. Important to take care of is that same applies to returning packet, routers need to know where the to return the package, NEXT router at the time. -- Ljubomir Ljubojevic (Love is in the Air) PL Computers Serbia, Europe StarOS, Mikrotik and CentOS/RHEL/Linux consultant
> 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 > JatinYour router (172.29.110.1) will need a static route to 20.20.20.0/24.
Hi, You can not have a gateway that is on another ip subnet than your physical interfaces from that server, so a route should have a gateway that is on the same ip subnet as your interfaces. In your case you should add another subnet on both servers something like: HOST A: 172.29.120.2 HOST B: 172.29.120.3 And then add a route for 20.20.20.0 via 172.29.120.3. Or you can just add on either of the servers one more ip address from the class of the other server. All this will work if the servers are on the same broadcast domain ( http://en.wikipedia.org/wiki/Broadcast_domain) if they are on distinct ones then you need to configure the router between them to route the 20.20.20.0/24 network to host b. On Wed, Feb 26, 2014 at 8: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 > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >
Actually you can by adding a route via the interface ip r a 20.20.20.0/24 dev eth0 On 02/26/2014 09:09 AM, Cretu Adrian wrote:> Hi, > You can not have a gateway that is on another ip subnet than your physical > interfaces from that server, so a route should have a gateway that is on > the same ip subnet as your interfaces. > In your case you should add another subnet on both servers something like: > HOST A: 172.29.120.2 > HOST B: 172.29.120.3 > > And then add a route for 20.20.20.0 via 172.29.120.3. > > Or you can just add on either of the servers one more ip address from the > class of the other server. > All this will work if the servers are on the same broadcast domain ( > http://en.wikipedia.org/wiki/Broadcast_domain) if they are on distinct ones > then you need to configure the router between them to route the > 20.20.20.0/24 network to host b. > > > > > > > On Wed, Feb 26, 2014 at 8:28 AM, Jatin Davey <jashokda-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org> wrote: > >> Hi All >> >> I have two hosts. Host A and Host B >> >> Host A routing table >> ------------------------ >> [root@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@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@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 >> _______________________________________________ >> CentOS mailing list >> CentOS-IFYaIzF+flcdnm+yROfE0A@public.gmane.org >> http://lists.centos.org/mailman/listinfo/centos >> > _______________________________________________ > CentOS mailing list > CentOS-IFYaIzF+flcdnm+yROfE0A@public.gmane.org > http://lists.centos.org/mailman/listinfo/centos >-- Stephen Clark *NetWolves* Director of Technology Phone: 813-579-3200 Fax: 813-882-0209 Email: steve.clark-HKs6b5iW9l2akBO8gow8eQ@public.gmane.org http://www.netwolves.com