For Solaris routing, you have to see our IP routing in Oracle Solaris. Do you know that Linux OS can use as a router? We will see how to implement routing on Linux box here. When I worked for Cisco Systems, they used Linux servers as routers in their test environments to communicate between actual routers in Lab environment to save on costs as they do not require complex routing stuff. Even there is a project called Linux routing and a separate Linux flavor for the routing purpose; that’s the flexibility of Linux. Let us start some basic routing commands. In Linux/*nix every work can be done in two ways.

1) That is a temporary way ( after reboots these changes will not be there) and

2) The other is a permanent way (after reboots too, the changes will be there).

We will see how to add routes temporary as well as permanent way

How to add routes temperately in Linux

Example1: Add a path to network

Syntax:

#route add -net network/mask gw default-gateway

Example

#route add -net 10.10.10.0/24 gw 192.168.0.1

Example2: Adding default gateway Syntax:

#route add default gw default-gateway

Example

#route add default gw 192.168.0.1

Example3: 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

Ecample4: Deleting route to a network

#route del -network network/subnet default-gateway

Example

#route del -net 10.10.10.0/24 gw 192.168.0.1

Example5: Deleting default gateway

#route del default gw default-gateway

Example:

#route del default gw 192.168.0.1

Example6: Deleting particular 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

Example7: Seeing routing table

#netstat -rn 
#route

These are not permanent routes and will be deleted automatically. In order to make them permanent we have to save these stuff in to files

Adding IP routing permently in Linux/Unix

 The old gate way will still remain and may need to remove from the system to function properly. Routes are made permanent in Redhat Linux by adding routes to/etc/sysconfig/static-routes.

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.