[CentOS] Static routing on CentOS

Wed Feb 26 14:24:04 UTC 2014
Steve Clark <sclark at netwolves.com>

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 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
>>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.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 at netwolves.com
http://www.netwolves.com