Linux : How to add a network static route

By | June 14, 2011

Here is the traditional way to set static route on Linux OS.

The best way to make it permanent, is to add the gateway directly to the interface by editing the interface script :

add :

To remove a static route :

On RHEL/CentOS Linux, there is a way to set this per interface through a single config file.

Edit the following file (create if non-existent) :

Append the following lines and modify with your values :

*Include the default route on the first line and then add as many subnet as you have.

Be Sociable, Share!