Static route disappears shortly (within 30 seconds) after added by 'ip route add'

Issues related to configuring your network
Post Reply
sunyj
Posts: 2
Joined: 2017/07/18 15:40:28

Static route disappears shortly (within 30 seconds) after added by 'ip route add'

Post by sunyj » 2017/07/18 16:06:08

My server recently added a new static route for the new leased line. Before I add the static route, network looks like this:

Code: Select all

$ ip a
......
2: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 44:a8:42:34:b0:23 brd ff:ff:ff:ff:ff:ff
    inet 192.168.102.42/24 brd 192.168.102.255 scope global em1
       valid_lft forever preferred_lft forever
    inet6 fe80::46a8:42ff:fe34:b023/64 scope link
       valid_lft forever preferred_lft forever
3: em2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 44:a8:42:34:b0:24 brd ff:ff:ff:ff:ff:ff
    inet 192.168.103.42/24 brd 192.168.103.255 scope global em2
       valid_lft forever preferred_lft forever
    inet6 fe80::46a8:42ff:fe34:b024/64 scope link
       valid_lft forever preferred_lft forever
 ......
 
$ ip route
default via 192.168.103.1 dev em2  proto static  metric 100
10.160.1.0/24 via 192.168.102.1 dev em1  proto static  metric 100
53.53.53.0/24 via 192.168.103.3 dev em2  proto static  metric 100
192.168.102.0/24 dev em1  proto kernel  scope link  src 192.168.102.42  metric 100
192.168.103.0/24 dev em2  proto kernel  scope link  src 192.168.103.42  metric 100
192.168.106.0/24 via 192.168.102.1 dev em1  proto static  metric 100
After I add a static route with ip route add 10.100.123.0/24 via 192.168.102.1, it became

Code: Select all

$ ip route
default via 192.168.103.1 dev em2  proto static  metric 100
10.100.123.0/24 via 192.168.102.1 dev em1
10.160.1.0/24 via 192.168.102.1 dev em1  proto static  metric 100
53.53.53.0/24 via 192.168.103.3 dev em2  proto static  metric 100
192.168.102.0/24 dev em1  proto kernel  scope link  src 192.168.102.42  metric 100
192.168.103.0/24 dev em2  proto kernel  scope link  src 192.168.103.42  metric 100
192.168.106.0/24 via 192.168.102.1 dev em1  proto static  metric 100
Everything's great, and now I can ping to 10.100.123.3, so far so good, right? But then strange thing happens, after about 10-20 seconds, the route just disappeared!

Code: Select all

$ ip route
default via 192.168.103.1 dev em2  proto static  metric 100
10.160.1.0/24 via 192.168.102.1 dev em1  proto static  metric 100
53.53.53.0/24 via 192.168.103.3 dev em2  proto static  metric 100
192.168.102.0/24 dev em1  proto kernel  scope link  src 192.168.102.42  metric 100
192.168.103.0/24 dev em2  proto kernel  scope link  src 192.168.103.42  metric 100
192.168.106.0/24 via 192.168.102.1 dev em1  proto static  metric 100
I even use watch -n1 ip route to watch it. Every time I add it back with ip route add 10.100.123.0/24 via 192.168.102.1, that entry can only exist for about 20 seconds before it disappeared. All other static routes work fine.

I tried writing it to /etc/sysconfig/network-scripts/route-em1, along with other static routes, no effect.

Please help me! It's so bizzare and I have absolutely no clue about it.

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Static route disappears shortly (within 30 seconds) after added by 'ip route add'

Post by TrevorH » 2017/07/18 17:31:00

Are you using NetworkManager or the network service?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

sunyj
Posts: 2
Joined: 2017/07/18 15:40:28

Re: Static route disappears shortly (within 30 seconds) after added by 'ip route add'

Post by sunyj » 2017/07/18 19:00:27

I'm using NetworkManager.

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Static route disappears shortly (within 30 seconds) after added by 'ip route add'

Post by TrevorH » 2017/07/18 19:30:36

I see no setting in my connection settings that woud affect such things and when I manually add a route, it stays. What else do you run?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

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

Re: Static route disappears shortly (within 30 seconds) after added by 'ip route add'

Post by jlehtone » 2017/07/18 21:15:49

How do you set the other static routes?

Why do you use 'ip' and not the NetworkManager's tools?
Running ip like that does not store configuration, not for NM nor for network.service.

Post Reply