How to fix a static route not persisting on startup in Linux?

To solve the issue of static routes added in Linux becoming invalid at boot, you can take the following steps:

  1. Edit the network configuration file: Open the network configuration file, typically located in /etc/sysconfig/network-scripts/route-, where interface is the name of the network card. Add the configuration information for static routes to ensure correct settings.
  2. Make sure the network card automatically starts up when the computer boots: The configuration file for the network interface should be checked, usually located in /etc/sysconfig/network-scripts/ifcfg-, where is the name of the network card interface. Ensure that ONBOOT=yes indicates that the network card will automatically start up when the system boots.
  3. Restart the network service by running either “service network restart” or “systemctl restart network” to apply the new configuration file.
  4. Check the routing table: Execute the command “ip route show” or “route -n” to view the current routing table and confirm that the static routes have been successfully added.

If the above steps do not resolve the issue, you can try updating system patches or restarting the system to see if it can solve the problem of static routing failures at startup.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds