Saturday 7 September 2013

Adding and Deleting route

Posted by Sarath On Saturday, September 07, 2013 No comments
Add Route
========
Code: [Select]
# route add default gw GATEWAY_IP eth0

Delete Route
==========
Code: [Select]
# route del default gw GATEWAY_IP

Check Routing Table
===============
Code: [Select]
# route -n
Or
Code: [Select]
# netstat -r -n

Sample Output :

Kernel IP routing table
Destination     Gateway         Genmask          Flags  MSS Window  irtt  Iface
0.0.0.0           192.168.2.1     0.0.0.0             UG         0  0             0  eth0
169.254.0.0    0.0.0.0            255.255.0.0      U           0  0             0  eth0
192.168.2.0    0.0.0.0            255.255.255.0  U            0  0             0  eth0

Destination -- Destination host/network.
Gateway -- Gateway address.
Genmask -- Netmask for the destination net.

Flags :
U - route is up
H - target is a host
G  -use gateway

Hope it helps you while configuring networks.

0 comments: