Page 1 of 1

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

Posted: 2017/07/05 22:57:03
by themagicm
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.

Re: 2 NICs 1 default gw. Need configuration assistance

Posted: 2017/07/06 16:26:45
by aks
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).

Re: 2 NICs 1 default gw. Need configuration assistance

Posted: 2017/07/06 16:28:16
by TrevorH
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.

Re: 2 NICs 1 default gw. Need configuration assistance

Posted: 2017/07/06 17:38:06
by themagicm
@TrevorH:

That took care of it!

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

Thanks!!

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

Posted: 2017/07/07 13:06:44
by jlehtone
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.

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

Posted: 2017/07/07 13:11:12
by themagicm
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. :-)

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

Posted: 2017/09/09 19:15:18
by N8tiv
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… :-)

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

Posted: 2017/09/09 19:25:00
by TrevorH
Something like nmcli c modify enp0s3 ipv4.method static ipv4.addresses 192.168.1.77/24,192.168.1.78/24 ?

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

Posted: 2017/09/10 04:16:13
by N8tiv
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?