I would like to make a IP route persistent, but it disappears after a reboot or service restart.

here my net conf :

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 52:54:00:ce:1c:48 brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
       valid_lft forever preferred_lft forever
    inet brd scope global eth0:23
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fece:1c48/64 scope link
       valid_lft forever preferred_lft forever

cat ifcfg-eth0


cat ifcfg-eth0:23


route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 eth0     U     0      0        0 eth0     U     0      0        0 eth0

When i want ping, I can't do it ! On the other hand, when i run this command :

ip r d ; ip r a via

i can ping my other server ( and my route is corrected.

route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 eth0     U     0      0        0 eth0     UG    0      0        0 eth0


PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=0.124 ms
64 bytes from icmp_seq=2 ttl=64 time=0.109 ms

Yet I took the care to add the route file in /etc/sysconfig/network-scripts/route-eth0

Like this :

default via dev eth0 via dev eth0

I don't understand why my route is wrong.


Check your eth0:23 configuration.

Its address overlaps with so it looks to the system as directly connected. That's why the system won't let you add a route through the default gateway!

You can see by route -n that the gateway is, which means directly connected, so the line via dev eth0

cannot be execute (it probably gives an error in some log file, too).

Obviously, when you explicitly delete the route, then the system lets you add a route via the default gateway as it no more have another route (the directly connected one) in its tables.

To fix this, you have to delete the eth0:23 interface, as it's not a connected network and you shouldn't have an IP address on that machine.

| improve this answer | |
  • Effectively, but i need IP address do you have other suggestions ? – BlaST77 Sep 6 '18 at 8:06
  • @BlaST77 How can that IP be reached if it's not directly connected? Can you update your question sharing a bit more information on your network setup? – Mr Shunz Sep 6 '18 at 8:41
  • it's a virtual machine. VM : ; Hypervisor : ; The network is connected on a bridge. IP in Hypervisor is the real card – BlaST77 Sep 6 '18 at 12:27
  • @BlaST77 well, it won't matter if it's virtual or not. If you need to go through to reach the network, your machine SHOULD NOT have an address in that network. – Mr Shunz Sep 6 '18 at 12:30
  • if I need this VM have the address because this VM is a server and the listening IP is the clients of this server are in the network. You understand ? – BlaST77 Sep 6 '18 at 12:33

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.