Default gateway/route seems to not be set by route-eth0
Posted: 2020/11/03 01:28:07
Hello All,
I currently have CentOS 7.8 minimal-installation and currently am having a peculiar network issue. And I'm quite lost on how to fix this.
ip address seems to be set just fine, but default route seems to not be set.
(perhaps I need to set a slight delay for eth0 to be fully up before setting routes?? - just a guess)
This is how my CentOS7 network config looks like:
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/route-eth0:
When I do a network restart, ip seems to be set fine
But it seems the network is unreachable.
Looking at routes, default route seems to be missing
Looking at the message logs it show this error
I tried manually starting ifup-routes
What's peculiar is Adding a default gw manually via cli seems to fix this:
I currently have CentOS 7.8 minimal-installation and currently am having a peculiar network issue. And I'm quite lost on how to fix this.
ip address seems to be set just fine, but default route seems to not be set.
(perhaps I need to set a slight delay for eth0 to be fully up before setting routes?? - just a guess)
This is how my CentOS7 network config looks like:
/etc/sysconfig/network-scripts/ifcfg-eth0
Code: Select all
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
NM_CONTROLLED=no
IPADDR=45.4.157.74
PREFIX=29
GATEWAY=85.99.10.135
DNS1=1.1.1.1
DNS2=8.8.4.4
ZONE=public
Code: Select all
85.99.10.135 dev eth0
default via 85.99.10.135 dev eth0
When I do a network restart, ip seems to be set fine
Code: Select all
[user@server100 ~]# /etc/init.d/network restart
Restarting network (via systemctl): [ OK ]
[user@server100 ~]# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 45.4.157.74 netmask 255.255.255.248 broadcast 45.4.157.79
ether 0a:ad:25:f4:a8:d2 txqueuelen 1000 (Ethernet)
RX packets 152029 bytes 97195167 (92.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 159027 bytes 208549780 (198.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[user@server100 ~]#
But it seems the network is unreachable.
Code: Select all
[user@server100 ~]# ping -c 1 8.8.8.8
connect: Network is unreachable
[user@server100 ~]#
Code: Select all
[user@server100 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
45.4.157.72 0.0.0.0 255.255.255.248 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
Code: Select all
[user@server100 ~]# cat /var/log/messages | grep eth0
Bringing up interface eth0: Cannot find device "eth0#015"
Nov 3 08:42:16 server100 network: Shutting down interface eth0: [ OK ]
Nov 3 08:42:20 server100 network: Bringing up interface eth0: Cannot find device "eth0#015"
Nov 3 08:42:20 server100 network: Cannot find device "eth0#015"
Code: Select all
[user@server100 ~]# /etc/sysconfig/network-scripts/ifup-routes eth0
"annot find device "eth0
"annot find device "eth0
What's peculiar is Adding a default gw manually via cli seems to fix this:
Code: Select all
[user@server100 ~]# ip route add 85.99.10.135 dev eth0
[user@server100 ~]# ip route add default via 85.99.10.135 dev eth0
Code: Select all
[user@server100 ~]# ping -c 2 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=5.27 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=5.40 ms
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 5.273/5.337/5.402/0.097 ms
[user@server100 ~]#