A static route is defined by statically configuring a next-hop router IP address for a specific destination network. You can add a static route by using "route add" command. However, a static route so added is not persistent across reboots. If you would like to add a static route permanently on Linux, do the following.
In this example, I assume that you wish to define a static route for network 10.10.0.0/16 via 10.10.5.5 on eth0.
To add a static route permanently on CentOS, Fedora or RHEL:
To add a static route permanently on Ubuntu or Debian:
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to set up Apt caching server on Ubuntu or Debian - February 7, 2016
- How to monitor OpenFlow messages with packet sniffer - February 2, 2016
- How to search multiple pdf documents for words on Linux - January 13, 2016