Static routes are for traffic that must not, or should not, go through the default gateway. Routing is often handled by devices on the network dedicated to routing (although any device can be configured to perform routing).
/etc/sysconfig/network-scripts/route-eth0
Add Static Routes in Linux
If static routes are required, they can be added to the routing table by the process shown below:
- First, check the routes which are already been added using the command route.
- Go to the location /etc/sysconfig/network-scripts/ and create the route file (if not exist) corresponding to ifcfg-* file. If your IP Address of the system is configured on the eth0 then create the route file route-eth0.
- Edit the route-eth0 file in the vi editor and add the new routes in the format given below:
- Restart the network service by using the command service network restart and after that check the routes through the route command.