Linux Routing Basics


For Solaris routing click here

As most of the people doesnot know that linux/*nix systems can be used as routers. Even there is a project called Linux routing and seperate Linux OS routing purpose alone thats the flexibility of Linux. In linux/*nix every work can be done in two ways.

That is one temporary way(after reboots these changes will not be there) and second one is permanent way(after reboots too the changes will be there).

Creating routes in Linux : Basic Linux routing
Add a route to a network
#route add -net network/mask gw default-gateway Example #route add -net gw

Adding default gateway
#route add default gw default-gateway Example #route add default gw

Adding a route to specific host
#route add -host host-name gw default-gateway Example #rotue add -host gw

Deleting route to a network
#route del -network network/subnet default-gatewayExample #route del -net gw

Deleting default gateway
#route del default gw default-gatway

Example :
#route del default gw

Deleting specific host from routing table
#route del -host ip-add gw default-gateway Example #route del -host gw

Seeing routing table
#netstat -rn #route

Note : The old gate way will still remain and may need to be taken out for the system to function properly. Routes are made permanent in Red Hat Linux by adding routes to /etc/sysconfig/static-routes.

  • Like the post? Please Subscribe to free RSS feed to get updates
  • Archive

    Translate this page


    The Linux Juggernaut | Copyright 2006-2009 Surendra Kumar Anne | Surendra's Home Page | Give us feedback how we are doing, Click here