Server Requires Restart After Every Modification in Network

General support questions
Post Reply
MHamas
Posts: 5
Joined: 2019/03/21 11:44:37

Server Requires Restart After Every Modification in Network

Post by MHamas » 2021/01/21 16:17:58

Dear All,

I am currently facing an issue that whenever I try to add a static route in my Centos 7, all the services stop working unless I restart my server. Service Network Restart is working properly and all eth interfaces restart properly but services go in halt unless server is restarted.

If any further details are required, kindly let me know. I will really appreciate if any solution to this problem can be provided as soon as possible.

User avatar
TrevorH
Forum Moderator
Posts: 30344
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Server Requires Restart After Every Modification in Network

Post by TrevorH » 2021/01/21 17:00:10

What is the exact command you run to add this static route?
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

MHamas
Posts: 5
Joined: 2019/03/21 11:44:37

Re: Server Requires Restart After Every Modification in Network

Post by MHamas » 2021/01/25 12:04:30

I am using the following command to add the route

ip route add <ip-address>/<mask> via <gateway> dev eth0

after adding the route I access eth interface by using the following command

vi /etc/sysconfig/network-scripts/route-eth0

In that, I add the following line

<ip-address>/<mask> via <gateway> dev eth0


This whole process works fine and even when I restart services, eth0 interface shows to get up but my services go in halt somehow. I have to reboot the server just to get the services running again.

User avatar
TrevorH
Forum Moderator
Posts: 30344
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Server Requires Restart After Every Modification in Network

Post by TrevorH » 2021/01/25 19:10:33

When I said the "exact" command, I meant exactly that. It's not possible to see what you did based on a generic "I ran something a bit like this".
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

MHamas
Posts: 5
Joined: 2019/03/21 11:44:37

Re: Server Requires Restart After Every Modification in Network

Post by MHamas » 2021/01/26 11:45:43

These were the exact commands except that I didn't mention the IP Addresses. But there you go, look at the commands below in sequence

--> ip route add 192.168.61.200/16 via 192.168.61.254 dev eth0
--> vi /etc/sysconfig/network-scripts/route-eth0
--> 192.168.61.200/16 via 192.168.61.254 dev eth0
--> service network restart


After service network restart, services stop working whereas eth0 interface restarts properly. So to get my services running again, I have to run "init 6" everytime I add a new route.

User avatar
jlehtone
Posts: 3349
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Server Requires Restart After Every Modification in Network

Post by jlehtone » 2021/01/26 13:01:40

Code: Select all

ip route add 192.168.61.200/16 via 192.168.61.254 dev eth0
I do hope that that is obfuscated, for if that route is real, then it makes no sense.

Code: Select all

$ ipcalc -n -b 192.168.61.200/16
BROADCAST=192.168.255.255
NETWORK=192.168.0.0
The address range 192.168.61.200/16 starts from 192.168.0.0 and ends to 192.168.255.255. You should use 192.168.0.0/16.

The .61.254 is within that range. Either your machine is link-local the the range (in which case you do not need the route)
or you have a separate more specific route how to reach 192.168.61.254 (but if you do, why?)

What do you have in ip ro?
MHamas wrote:
2021/01/21 16:17:58
Service Network Restart is working properly and all eth interfaces restart properly but services go in halt unless server is restarted.
Service restart hardly works "properly", if services halt. Then again, if you have existing connections to "services" and you change routes, then the replies might go via the new routes, which the client does not expect. Hence connections fail.

Post Reply

Return to “CentOS 7 - General Support”