How to reload routing table on Centos without lost network service
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.
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.
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.