Adding and Deleting route

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.

About Sarath

A Techie from Kochi, India with 8+ years of experience in Linux and Windows server administration. I learn new things almost everyday and I enjoy the fun of learning and sharing my knowledge.