I have problem with my centos box. After upgrading few packages, after some time network get broken.

What happens is that eth0 is not functional anymore. Only error in log file I have found was this one:

Invalid IP4 netmask 'NETMASK0' ""

After some research I figured out it was problem with route-eth0 config file because network starts, but routes are not added. If I add them manually, then all goes fine.

Without it, routing table is very strange one:

 [root@CentOS-70-64-minimal network-scripts]# route -e
 Kernel IP routing table
 Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
 default         gateway         UG        0 0          0 eth1
 default         gateway         UG        0 0          0 eth0
 gateway UH        0 0          0 eth0
 CentOS-70-64-mi UH        0 0          0 eth0
 link-local     U         0 0          0 eth0   gateway UGH       0 0          0 eth0   U         0 0          0 eth1

It is CentOS Linux release 7.2.1511 (Core).




# routing for eth0

Btw, eth1 is working fine. Also on other server all interfaces are working with same configuration.

Problem may be because it was centos 6 and then updated to centos 7. Maybe some setting left and make problem.

Because site is live, I made temporary solution adding this line to crontab to run every minute:

/etc/sysconfig/network-scripts/ifup-routes eth0
  • pls add centos version to question
    – sjsam
    Commented Sep 1, 2016 at 21:33
  • 1
    please include the configuration file for eth0 (/etc/sysconfig/network-scripts/ifcfg-eth0)
    – Rabin
    Commented Sep 1, 2016 at 22:48
  • You can only have a single default route/gateway. It looks like you're trying to set them on both eth1 and eth0. Commented Sep 2, 2016 at 12:16

3 Answers 3


If you had configured scope point to point link (because NETMASK= then you wanted to route all traffic via eth0:


I don't understand for what did you configure default route via eth1?

I think you have to change configuration of eth0 interface :


And delete the routing configuration file for eth0 interface. I see that two interfaces are connected to two independent providers. That's why i recommend you to use iproute2. How to configure it you can see at Configuring Multiple Default Routes in Linux


I would suggest you to use nmtui interface to setup IP, route, DNS etc., This will update corresponding configuration files automatically.

nmtui is packaged along with NetworkManager-tui-1.4.0-12.el7.x86_64 rpm.


/etc/sysconfig/network-scripts/route-eth0 is not the correct place to configure the default gateway, that file should be used only for additional static routes. You should have a GATEWAY= line in /etc/sysconfig/network-scripts/ifcfg-eth0 or ifcfg-eth1, not both. Without having some advanced routing having more than one default route is not going to work as your route output shows.

  • It does not help. If I run service network restart eth0 is again without proper gateway. Commented Sep 2, 2016 at 11:09
  • That's probably because you have a default gateway configured on eth1 already. As I said, you can't have two default gateways, not without advanced configuration anyway, which is beyond the scope of this question.
    – bodgit
    Commented Sep 2, 2016 at 13:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .