7

I've add 1 route in configuration network file, how to reload routing table on Centos without lost network service

3 Answers 3

11

Static routes are defined into /etc/sysconfig/network-scripts/route-<interface name> files.
(see Centos documentation)

To apply one of these files :

/etc/sysconfig/network-scripts/ifup-routes <interface name>

That will not reload the rules, that will just reread the configuration and execute route add commands (so no route deletion).

I do not recommand to use the /etc/sysconfig/network-scripts/ifdown-routes to delete routes, unless you are sure you can still connect after deleting that routes. Better use the route del command.

4

It's impossible to reload routing table without lost network service (I think you mean you don't have to use service network restart command to make the changes). If you have any change to network configuration file, you need to restart networking service to apply new configuration.

In your case, you can add the config (i.e new route, new gateway...) manually, so you will have new config running.

But this config will be lost if you reboot server. To make it persitent, you must add this config to network configuration file.

1
  • Don't do this if your running containers. This breaks some in fundamental way forcing you to have to redeploy said containers. I don't like this but it's the only way I have found that reloads the routes and doesn't break containers. ifdown eth0; ifup eth0 Feb 4 at 13:20
2

You can simply use the route or ip route commands to change the routing table dynamically.

To test if the changes you made to the configuration files are correct and won't cause failure at the next (un)planned reboot, a service network restart should be scheduled at a convenient time too.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.