Add a third network card

Issues related to configuring your network
Post Reply
jcmanjar
Posts: 6
Joined: 2020/12/23 15:22:35

Add a third network card

Post by jcmanjar » 2020/12/24 15:30:10

Hello guys
I have a server with two network cards: one card connects to a local 192.168.2.0 network and the other to a sip trunk. I have to add a third card and as soon as I put it in the server loses connection to the local network and to the sip trunk. I have tried all the settings according to the red hat guidelines and nothing works. The server stops sending or receiving packets

This is the configuration of the two network interfaces

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

Code: Select all

TYPE=Ethernet
BOOTPROTO=static
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eth0
UUID=1da604a0-a7f8-4bef-8af1-c71493a5169b
DEVICE=eth0
ONBOOT=yes
NOZEROCONF=yes
IPADDR=192.168.2.180
NETMASK=255.255.255.0
BROADCAST=192.168.2.255
NETWORK=192.168.2.0
PROXY_METHOD=none
BROWSER_ONLY=no
DEFROUTE=yes
GATEWAY=192.168.2.1
DNS1=8.8.8.8
DNS2=8.8.4.4
/etc/sysconfig/network-scripts/ifcfg-eth0:1
DEVICE=eth0:1
IPADDR=192.168.1.154

/etc/sysconfig/network-scripts/ifcfg-eth1

Code: Select all

TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eth1
UUID=392ff86d-f105-4876-b48a-2d2f7dc13e90
DEVICE=eth1
ONBOOT=yes
IPADDR=xxx.22.67.194
NETMASK=255.255.255.248
BROADCAST=xxx.22.67.199
NETWORK=xxx.22.67.192
GATEWAY=xxx.22.67.193
NOZEROCONF=yes
PROXY_METHOD=none
BROWSER_ONLY=no
PREFIX=29
DNS1=8.8.8.8
DNS2=8.8.4.4
/etc/sysconfig/network

Code: Select all

# Created by anaconda
NETWORKING=yes
GATEWAY=192.168.1.1
HOSTNAME=issabel.local
Output of route -n

Code: Select all

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG    100    0        0 eth1
0.0.0.0         192.168.2.1     0.0.0.0         UG    101    0        0 eth0
172.17.179.166  172.22.67.193   255.255.255.255 UGH   0      0        0 eth1
172.22.67.192   0.0.0.0         255.255.255.248 U     100    0        0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U     101    0        0 eth0
192.168.2.0     0.0.0.0         255.255.255.0   U     101    0        0 eth0
192.168.2.1     0.0.0.0         255.255.255.255 UH    100    0        0 eth1
/etc/sysconfig/network-scripts/ifcfg-eth2

Code: Select all

TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=no
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
ONBOOT=yes
NAME=eth2
DEVICE=eth2
IPADDR=xxx.24.242.142
NETMASK=255.255.255.252
GATEWAY=xxx.22.67.193
DNS1=8.8.8.8
DNS2=8.8.4.4
NM_CONTROLLED=no
UUID=d8c9c9b7-fb40-4596-b496-725182cb7219
PROXY_METHOD=none
BROWSER_ONLY=no
PREFIX=30
What drives me crazy is that just inserting the card, without doing any configuration, leaves no connection to the server. I configured the card on another server and it worked. Try a different card and the same thing happens

I appreciate your help in advance

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

Re: Add a third network card

Post by TrevorH » 2020/12/24 16:36:36

Only put GATEWAY= in ONE ifcfg file - the one you want to be the default route. If you have it in more than one file then you have a race condition and whichever is processed last will win and be the interface used for all traffic.
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

User avatar
jlehtone
Posts: 3262
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Add a third network card

Post by jlehtone » 2020/12/24 16:48:39

If you do have NetworkManager installed (which is the default) and in its default state, then it will automatically create connections for all links that the machine has. Those connections use DHCP.

Simply plugging a card in does not cause havok. Plugging a cable to the port and DHCP at the other end of that cable handing out unwanted config does.

Then again, you show config of all three connections and none of them is what NM would create by default.

jcmanjar
Posts: 6
Joined: 2020/12/23 15:22:35

Re: Add a third network card

Post by jcmanjar » 2020/12/28 13:43:04

Hello, Trevor
Thank for your help and sorry for late response. I will make the changes that you suggest

jcmanjar
Posts: 6
Joined: 2020/12/23 15:22:35

Re: Add a third network card

Post by jcmanjar » 2020/12/28 13:51:14

Hello, jlehtone
Thanks for your help, unfortunately, I did not configure the server and has no experience with NM. I always configure NIC manually. I have no experience with the Network Manager, I always configure the network interfaces manually. I'm tearing my hair out configuring three interfaces because I hadn't had to deal with routes. Although I read the Red Hat documentation, I still do not understand very well what are the rules that determine which interface has precedence when managing Internet output with multiple NIC.

P.D. sorry for late response

User avatar
jlehtone
Posts: 3262
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Add a third network card

Post by jlehtone » 2020/12/28 18:50:47

My definition of "manual" is that I do it. Either with 'nmcli' or by adjusting the configuration of DHCP server to hand out settings that I want.


I did never learn how to read output of "route -n". IMHO, "ip ro" gives nicer output. That said:
jcmanjar wrote:

Code: Select all

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG    100    0        0 eth1
0.0.0.0         192.168.2.1     0.0.0.0         UG    101    0        0 eth0
172.17.179.166  172.22.67.193   255.255.255.255 UGH   0      0        0 eth1
172.22.67.192   0.0.0.0         255.255.255.248 U     100    0        0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U     101    0        0 eth0
192.168.2.0     0.0.0.0         255.255.255.0   U     101    0        0 eth0
192.168.2.1     0.0.0.0         255.255.255.255 UH    100    0        0 eth1
The routing table uses most specific match. It seems that:
* If destination is 192.168.2.1, then it is sent from NIC eth1
* If destination is anyone else in 192.168.2.0/24, then it is sent from NIC eth0.
Overall, such pair does not make sense. Why would one address in subnet range be linked to different NIC?
* If destination is in 192.168.1.0/24, then it is sent from NIC eth0.
A bit odd that two subnets (192.168.1.0/24 and 192.168.2.0/24) are on same NIC.
* If destination is in 172.22.67.192/29 (addresses .193 -- .198), then it is sent from NIC eth1.
* If destination is 172.17.179.166, then packet is sent to router 172.22.67.193, that is behind NIC eth1.
* Everything else is sent to router 192.168.2.1 that is connected to eth1 and eth0?


What do you have running?

Code: Select all

systemctl status NetworkManager
systemctl status network

jcmanjar
Posts: 6
Joined: 2020/12/23 15:22:35

Re: Add a third network card

Post by jcmanjar » 2020/12/29 16:09:38

* If destination is 192.168.2.1, then it is sent from NIC eth1
* If destination is anyone else in 192.168.2.0/24, then it is sent from NIC eth0.
Overall, such pair does not make sense. Why would one address in subnet range be linked to different NIC?
I also wonder the same thing. But this server has Issabel with centos 7 and the company that configured it, added the 192.168.2.0 network so as not to interfere with the local network 192.168.1.0 traffic.

I added a secondary ip 192.168.1.154 to be able to connect to the server, because through the ip 192.168.2.0 the connection was very slow

jcmanjar
Posts: 6
Joined: 2020/12/23 15:22:35

Re: Add a third network card

Post by jcmanjar » 2020/12/29 16:31:27

I have already solved the problem. One of the problems was that the two network interfaces (eth0 and eth1) were assuming the same MAC. I changed one of the cards and also reconfigured all the network interfaces from scratch leaving eth2 for the local interface.

eth0:

Code: Select all

HWADDR=D8:47:32:8E:A9:20
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=xxx.24.242.142
NETMASK=255.255.255.252
BROADCAST=xxx.24.242.143
NETWORK=xxx.24.242.140
GATEWAY=xxx.24.242.141
PREFIX=30
DEFROUTE=no
IPV4_FAILURE_FATAL=no
IPV6INIT=no
NAME=eth0
UUID=3ae91edc-8b23-3548-b4da-62071928d2d7
ONBOOT=yes
AUTOCONNECT_PRIORITY=-999
eth1:

Code: Select all

HWADDR=D8:47:32:C7:AF:D6
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=xxx.22.67.194
NETMASK=255.255.255.248
BROADCAST=xxx.22.67.199
NETWORK=xxx.22.67.192
GATEWAY=xxx.22.67.193
PREFIX=29
DEFROUTE=no
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth1
UUID=10049760-5a43-39c8-a5f5-52609e0b8321
ONBOOT=yes
AUTOCONNECT_PRIORITY=-999
eth2:

Code: Select all

HWADDR=70:85:C2:54:F2:98
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.2.180
GATEWAY=192.168.2.1
NETMASK=255.255.255.0
BROADCAST=192.168.2.255
NETWORK=192.168.2.0
PREFIX=24
DNS1=8.8.8.8
DNS2=8.8.4.4
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
ONBOOT=yes
NAME=eth2
UUID=3a73717e-65ab-93e8-b518-24f5af32dc0d
eth2:1

Code: Select all

DEVICE=eth2:1
IPADDR=192.168.1.154
GATEWAY=192.168.1.1
NETMASK=255.255.255.0
BROADCAST=192.168.1.255
NETWORK=192.168.1.0
The key to solving my problem was to set "DEFROUTE" to "no" as mentioned in https://serverfault.com/questions/56724 ... ting-issue:
For any network device which is not my default gateway, I usually set the default route flag to no:

DEFROUTE="no"
Anyway, I plan to remove the 192.168.2.0 network and leave eth2 only with the 192.168.1.0 network. For now the server is working correctly. Calls can be made and received from the SIP trunk.

Doing this configuration was challenging, because I never had to configure three network interfaces before and I didn't think it was that difficult. Thank you very much friends for your collaboration, and I hope to help others in the future.
Last edited by jcmanjar on 2021/01/04 13:39:34, edited 1 time in total.

jcmanjar
Posts: 6
Joined: 2020/12/23 15:22:35

Re: Add a third network card

Post by jcmanjar » 2020/12/29 16:39:37

P.D.

I want to clarify a few things about the network interfaces you asked:

eth0 and eth1 connect to a network switch that gives access to the SIP trunk
eth2 connects to a router that is used for the company's internal network and from where users connect to the Issabel with a softphone

Post Reply

Return to “CentOS 7 - Networking Support”