1

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' "0.0.0.0"

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         0.0.0.0         UG        0 0          0 eth1
 default         gateway         0.0.0.0         UG        0 0          0 eth0
 gateway         0.0.0.0         255.255.255.255 UH        0 0          0 eth0
 CentOS-70-64-mi 0.0.0.0         255.255.255.255 UH        0 0          0 eth0
 link-local      0.0.0.0         255.255.0.0     U         0 0          0 eth0
 188.40.24.199   gateway         255.255.255.255 UGH       0 0          0 eth0
 192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1

It is CentOS Linux release 7.2.1511 (Core).

/etc/sysconfig/network-scripts/ifcfg-eth0:

DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
HWADDR=44:8A:5B:D8:74:B3
IPADDR=136.243.34.136
NETMASK=255.255.255.255
SCOPE="peer 136.243.34.129"
IPV6INIT=yes
IPV6ADDR=2a01:4f8:212:283::2/64
IPV6_DEFAULTGW=fe80::1
IPV6_DEFAULTDEV=eth0

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

# routing for eth0
ADDRESS0=0.0.0.0
NETMASK0=0.0.0.0
GATEWAY0=136.243.34.129

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
3
  • 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

1

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

IPADDR=136.243.34.136 NETMASK=255.255.255.255 SCOPE="peer 136.243.34.129"

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

I think you have to change configuration of eth0 interface :

IPADDR=136.243.34.136
NETMASK=255.255.255.127

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

1

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.

0

/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.

2
  • 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 .