How Do I Permanently Add a Static Route in Linux Rhel 7?
Contents

How do I permanently add a static route in Linux 7?

Adding permanent static routes

On RHEL or CentOS, you need to modify the interface file in ‘/etc/sysconfig/network-scripts’. For example, here, we have to add routes on network interface ens192. Hence, the file we need to modify will be ‘/etc/sysconfig/network-scripts/route-ens192’.

How do I add a static route in Linux?

To do this, you need to add a static route.

  1. Add a temporary static route. If you wish to add one temporarily, simply run the ip route add command with the right network information: ip route add 172.16.5.0/24 via 10.0.0.101 dev eth0. …
  2. Add a permanent static route. …
  3. If you lose your internet connection.
James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest