[SOLVED] 2 NICs 1 default gw. Need configuration assistance

Issues related to configuring your network
Post Reply
themagicm
Posts: 18
Joined: 2017/07/05 22:49:39

[SOLVED] 2 NICs 1 default gw. Need configuration assistance

Post by themagicm » 2017/07/05 22:57:03

I've been wrestling with this for the past 2 days and no matter how much I google I cant figure it out.

I virtualized 2 servers. Both servers share the same default gw, route. When I enable both NICs, only one is accessible.

NIC 1 IP = 1.32.211.58
NIC 2 IP = 1.32.211.59
default gw = 1.32.211.57

Code: Select all

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         1.32.211.57    0.0.0.0         UG    100    0        0 enp0s8
0.0.0.0         1.32.211.57    0.0.0.0         UG    101    0        0 enp0s9
1.32.211.56    0.0.0.0         255.255.255.248 U     100    0        0 enp0s8
1.32.211.56    0.0.0.0         255.255.255.248 U     101    0        0 enp0s9
192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s3
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
I cannot ping enp0s8 but enp0s9 I can. If I disable enp0s9 then enp0s8 is accessible.
I'm totally stumped.
Last edited by themagicm on 2017/07/07 01:56:13, edited 1 time in total.

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: 2 NICs 1 default gw. Need configuration assistance

Post by aks » 2017/07/06 16:26:45

You have two default routes. I think replies are "augmented" based on that too.
0.0.0.0 1.32.211.57 0.0.0.0 UG 100 0 0 enp0s8
0.0.0.0 1.32.211.57 0.0.0.0 UG 101 0 0 enp0s9
If you really want to have two NICs on the same LAN - either for load balancing (at the physical/L2 layer) or for active-passive failover and so on, setup a team. See RHEL docs for teaming (aka bonding) - that way the network subsystem will "see" the interface(s) as a single interface and not only use the most "desirable" (based on the metric).

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: 2 NICs 1 default gw. Need configuration assistance

Post by TrevorH » 2017/07/06 16:28:16

Better off using an ip alias to put the 2nd ip on the same interface as the first. You cannot generally have two interfaces on the same server within the same subnet, especially if you have GATEWAY= in both ifcfg files.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

themagicm
Posts: 18
Joined: 2017/07/05 22:49:39

Re: 2 NICs 1 default gw. Need configuration assistance

Post by themagicm » 2017/07/06 17:38:06

@TrevorH:

That took care of it!

I used nmtui went to my nic, clicked "add" and added the IP alias.

Thanks!!

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

Re: [SOLVED] 2 NICs 1 default gw. Need configuration assistance

Post by jlehtone » 2017/07/07 13:06:44

Good that the problem appears solved.

However, what do you mean by:
themagicm wrote:I virtualized 2 servers.
That statement does not seem to relate to the issue that you had with one server.

themagicm
Posts: 18
Joined: 2017/07/05 22:49:39

Re: [SOLVED] 2 NICs 1 default gw. Need configuration assistance

Post by themagicm » 2017/07/07 13:11:12

jlehtone wrote:Good that the problem appears solved.

However, what do you mean by:
themagicm wrote:I virtualized 2 servers.
That statement does not seem to relate to the issue that you had with one server.


Well...it does..

I had 2 physical servers, 2 nics, 2 IP's. I put both servers in one VM. I assigned 3 "virtual nics" to it. 1 nic is for the internal network, other two nics are forward facing IP's. When hitting one of the external IP's, it just didnt work. If I shut down one of those virtual nics that had the external ip assigned, it worked fine. So it was a routing issue at the OS level on the VM guest side..

IP aliasing was the fix. Enabled me to delete a virtual nic and assign both external IP's to 1 virtual nic. Took care of the problem.

Hopefully that cleared it up and didnt muddy the waters even more. :-)

N8tiv
Posts: 38
Joined: 2014/10/23 00:16:57
Location: Anchorage, AK 99508

Re: [SOLVED] 2 NICs 1 default gw. Need configuration assistance

Post by N8tiv » 2017/09/09 19:15:18

Is "IP Aliasing", the same thing as a "Network Profile"?

I remember reading somewhere in the man pages, for nmcli… That you can create multiple profiles, but… Only one can connect at a time?

Now that I type it out, doessn't quite sound the same as IP aliasing… :-)

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: [SOLVED] 2 NICs 1 default gw. Need configuration assistance

Post by TrevorH » 2017/09/09 19:25:00

Something like nmcli c modify enp0s3 ipv4.method static ipv4.addresses 192.168.1.77/24,192.168.1.78/24 ?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

N8tiv
Posts: 38
Joined: 2014/10/23 00:16:57
Location: Anchorage, AK 99508

Re: [SOLVED] 2 NICs 1 default gw. Need configuration assistance

Post by N8tiv » 2017/09/10 04:16:13

Yeah, that looks pretty similar to some of the examples that the man pages showed…

My question was, are IP aliases the same as network profiles… After "stinking" about it a little bit, I realized… They aren't, the same.

What exactly are the differences?

Post Reply