Thursday, January 17, 2013

route add on Redhat/CentOS

 [root@my32GB images]# wget
--2013-01-18 22:10:28--

[root@my32GB images]# ping

[root@my32GB images]# route add -net netmask gw dev wlan0

[root@my32GB images]# ping -c 2
PING ( 56(84) bytes of data.
From icmp_seq=1 Redirect Host(New nexthop:
64 bytes from icmp_seq=1 ttl=64 time=1.78 ms
From icmp_seq=2 Redirect Host(New nexthop:
64 bytes from icmp_seq=2 ttl=64 time=1.79 ms

--- ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1003ms
rtt min/avg/max/mdev = 1.783/1.791/1.799/0.008 ms
[root@my32GB images]#


Route add and make it persistent

Route add,

# route add -net netmask gw eth0
# route add -net netmask eth0

To make it persistent,
Add entry to /etc/sysconfig/network-scripts/route-eth0 file.

echo " via dev eth0" >> /etc/sysconfig/network-scripts/route-eth0
" dev eth0" >> /etc/sysconfig/network-scripts/route-eth0

Verify the changes using netstat -rn or ip route command.
# netstat -rn
# ip route

No comments:

Post a Comment