[CentOS] Need help getting two NICs to work on CentOS 7

Sean Son linuxmailinglistsemail at gmail.com
Mon Nov 14 20:47:10 UTC 2016


On Tue, Nov 8, 2016 at 8:02 AM, Boris Epstein <borepstein at gmail.com> wrote:

> Hello there,
>
> What is the hypervisor that hosts the VM? What does ifconfig show on it?
>
> Boris.
>
> On Mon, Nov 7, 2016 at 4:36 PM, Gordon Messmer <gordon.messmer at gmail.com>
> wrote:
>
> > On 11/06/2016 11:00 PM, Sean Son wrote:
> >
> >> How do I
> >> configure the networking so that both IPs are pingable and the VM is
> >> reachable via both IPs?
> >>
> >
> >
> > You need one rule file per interface, which directs traffic out the
> > appropriate interface based on the source address of the packet:
> >
> > https://blogs.oracle.com/networking/entry/advance_
> routing_for_multi_homed
> >
> > _______________________________________________
> > CentOS mailing list
> > CentOS at centos.org
> > https://lists.centos.org/mailman/listinfo/centos
> >
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos
>


Hello all

Thank you for the replies.  I ran into  some issues with the policy based
routing which I will explain in a few.  First off to answer each one of
your questions:

Digimer: No I didnt take a look at IPTables

Peter Brady: Thank you for the example, I tried that but it failed and I
will explain in a minute.

Frank Cox : That works but how do I make it persistent across reboots?

Boris Epstein:  I am using Hyper-V and its getting annoying lol


Ok so here is how I have set everything up:

my /etc/iproute2/rt_tables:


#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep
300 NIC1
310 NIC2

my /etc/sysconfig/network-scripts/route-eth0 file:

168.87.147.0/24 dev eth0 table 300
default via 168.87.147.1 dev eth0 table 300

/etc/sysconfig/network-scripts/route-eth1 file:

10.20.50.0/24 dev eth1 table 310
default via 10.20.50.1 dev eth1 table 310

My /etc/sysconfig/network-scripts/rule-eth0:

from 168.87.147.33/32 table 300
to 168.87.147.33 table 300

My /etc/sysconfig/network-scripts/rule-eth1:

from 10.20.50.90/32 table 310
to 10.20.50.90 table 310


now after implementing this and restarting NetworkManager,  when I run 'ip
rule list', I get the following:

0:      from all lookup local
32764:  from all to 10.20.50.90 lookup NIC2
32765:  from 10.20.50.90 lookup NIC2
32766:  from all lookup main
32767:  from all lookup default


and when i run 'ip route' , i get the following:

default via 168.87.147.1 dev eth0  proto static  metric 1024
10.20.50.0/24 dev eth1  proto kernel  scope link  src 10.20.50.90
168.87.147.0/24 dev eth0  proto kernel  scope link  src 168.87.147.33



yet when I try to ping from another server to 10.20.50.90 it will not ping
at all. Also, whenever I reboot the VM, eth1 switches over to DHCP and I
lose my IP configuration. After I reset the IP Configuration back to Manual
and reenter the IP, Centos creates a new interface file called
ifcfg-Wired_Connection-1 and places the IP configuration for the interface
into that file. Both virtual NICs are set to Static Mac Addresses, so I
dont know why it keeps creating another interface file.  Any ideas on what
I am doing wrong here? All help is greatly appreciated!


Thanks!



More information about the CentOS mailing list