Page 1 of 1

add route

Posted: 2019/10/15 20:07:10
by derdertere
I've added a route into the and what I want to learn is why the routes are written in rc.local. which purpose or design is used for this. route s always written into rc.local.
route running when I restart server but if i run ( service network restart ) then route is not running added routes do not work then i run the systemctl start rc-local.service and route is running. this method is correct ? when the network is reset, I have to do this.
this method is correct for writing a permanent route. and what I want to learn is why the routes are written in rc.local. which purpose or design is used for this. routes always written into rc.local.

there is a structure like this on the system right now

Re: add route

Posted: 2019/10/15 20:28:57
by jlehtone
No. You are mistaken.

If you have to add static routes locally, then use NetworkManager to modify the relevant connection's configuration.

Re: add route

Posted: 2019/10/15 20:44:21
by derdertere
can you show an example about use NetworkManager . do you have any idea why it is written in rc-local
thanks

Re: add route

Posted: 2019/10/15 21:09:04
by TrevorH
And if you are not using NetworkManager then you still don't use rc.local to add routes. That's what /etc/sysconfig/network-scripts/route-$interface and /etc/sysconfig/network-scripts/rule-$interface are for.

Re: add route

Posted: 2019/10/16 06:23:55
by jlehtone
derdertere wrote:
2019/10/15 20:44:21
do you have any idea why it is written in rc-local
Yes, somebody is either <unprintable> or <unprintable>.

Code: Select all

man nmcli
man nmcli-examples
man nm-settings
Or more verbosely: https://access.redhat.com/documentation ... uide/index

An example (where router 10.20.30.254 is link-local to connection bridce-br0):

Code: Select all

nmcli con mod bridge-br0 +ipv4.routes "192.168.0.0/24  10.20.30.254"