Linux Routing Basics

1 comments

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 10.10.10.0/24 gw 192.168.0.1

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

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

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

Deleting default gateway
#route del default gw default-gatway

Example :
#route del default gw 192.168.0.1

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

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