Routing table changes on boot up

Issues related to configuring your network
northpoint
Posts: 58
Joined: 2016/05/23 11:57:12

Routing table changes on boot up

Postby northpoint » 2018/02/14 00:02:53

Hello,

I administer a centos7 server from remote as the drive is about 1.5 hours a way. The server has two network cards. One for Internet access and the other that services the local lan. I am using iptables for masqing the network ids of the workstations. Everything runs fine until a reboot. It seems that the system will default to the local lan as the default route. Here is some info:

Code: Select all

em1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.1  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::226:b9ff:fe48:6dde  prefixlen 64  scopeid 0x20<link>
        ether 00:26:b9:48:6d:de  txqueuelen 1000  (Ethernet)
        RX packets 6332198  bytes 1549672239 (1.4 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8582199  bytes 8333396499 (7.7 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

em2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 69.14.xxx.xxx  netmask 255.255.255.0  broadcast 69.14.211.255
        inet6 fe80::226:b9ff:fe48:6de0  prefixlen 64  scopeid 0x20<link>
        ether 00:26:b9:48:6d:e0  txqueuelen 1000  (Ethernet)
        RX packets 4843235  bytes 5703625181 (5.3 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3001778  bytes 493540310 (470.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 10251  bytes 1095072 (1.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10251  bytes 1095072 (1.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


Routing - This is the good routing table when everything works.

Code: Select all

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         d14-69-1-211.tr 0.0.0.0         UG    100    0        0 em2
default         sd2.sd.local    0.0.0.0         UG    101    0        0 em1
69.14.211.0     0.0.0.0         255.255.255.0   U     100    0        0 em2
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 em1
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0


If the server has to reboot then the way I fix this is that its a onsite visit and I remove the network cable from the local lan side (/dev/em1) and bootup. Then after the Internet network card comes up I can plugin the local lan.

I took a look at /etc/sysconfig/network and it does not list anything. I can see that NetworkManager is handling all the connections. What I would like is that on reboot /dev/em2 connects to modem and sets the default route for Internet traffic. Then of course the local lan sets up as it normally does.

I am not sure how to get the system to perform as I need unless I configure NetworkManager to not bring the local lan up on bootup just the Internet network card. This of course is not idea either.

Any help would be greatly appreciated. It would save me those 1.5 hour trips :)

Thanx,
Ryzen x1800 * Asus x370 Pro * CentOS 7.4 64bit / Icewarp /

User avatar
TrevorH
Forum Moderator
Posts: 22584
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Routing table changes on boot up

Postby TrevorH » 2018/02/14 10:23:13

Check the /etc/sysconfig/network-scripts/ifcfg-* files and make sure that only the interface file that should have the default route has a GATEWAY= line in it.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

northpoint
Posts: 58
Joined: 2016/05/23 11:57:12

Re: Routing table changes on boot up

Postby northpoint » 2018/02/14 22:41:49

TrevorH wrote:Check the /etc/sysconfig/network-scripts/ifcfg-* files and make sure that only the interface file that should have the default route has a GATEWAY= line in it.


Thank you, I appreciate the reply. I will be off to check that.

I will update this when I figure it all out.

Northpoint
Ryzen x1800 * Asus x370 Pro * CentOS 7.4 64bit / Icewarp /