1

I have a CentOS VM in VirtualBox. It's configured to use 2 NICs. The first NIC is NAT and gets the DHCP from VirtualBox. It's enp0s3 and here is the configuration file:

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="enp0s3"
UUID="58624aa8-5032-4fa6-8f81-81f5b25dc540"
DEVICE="enp0s3"
ONBOOT="yes"

The second NIC I've specified to use a static address and it runs NAT Network in VirtualBox with an address range of 10.242.34.0/24. I toggle this interface being up or down with ifup enp0s8 or ifdown enp0s8 -- it isn't needed to be up all the time. Here's the configuration file:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s8
UUID=fefdb96a-13f5-46c2-82d1-5a623770deac
DEVICE=enp0s8
ONBOOT=no
IPADDR=10.242.34.100
NETMASK=255.255.255.0
NM_CONTROLLED=no
IPV6_PRIVACY=no

Anyway, the problem I'm having is when I ifup enp0s8, I can see all the hosts on the 10.242.34 network but I cannot connect to the internet. I have to ifdown enp0s8 to connect to the internet -- presumably though enp0s3's NAT connection to the host computer.

If both enp0s3 and enp0s8 are both up, why cannot I get the to the internet? It's like enp0s8 blocks any other connection.

  • What do you see in " ip route " output in both situations? Isn't there a default route set with enp0s8 (DEFROUTE=yes) that conflicts with enp0s3 ? – tonioc Jun 12 '18 at 16:01
  • default via 10.0.2.2 dev enp0s3 proto dhcp metric 100 10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15 metric 100 10.242.34.0/24 dev enp0s8 proto kernel scope link src 10.242.34.100 169.254.0.0/16 dev enp0s8 scope link metric 1003 192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 – MGoBlue93 Jun 12 '18 at 17:39
  • This is really weird... I shouldn't have been able to post that comment with s8 up. But I did. Looks like there isn't a problem afterall. Grrr. – MGoBlue93 Jun 12 '18 at 17:42
0

this issue usually means that you have incorrectly set metric among network interfaces. If both interfaces has defined gateway then you need to set lower value of metric for interface that you wish to prefer as default gateway when both of interfaces are up. I haven't tested this in Centos but searching for "Centos 7 metric" should help.

  • Disagree. Metric has nothing to do with this as I'm not routing anywhere. I'm going to blame this either on systemd bullsh!t or a default misconfiguration -- for example, I initially used nmtui to configure adapter 2 with a static IP address. With the ifcfg file it created thereafter, the default was BOOTPROTO=dhcp even though there was an IPADDR= line. I had to manually change it from dchp to static. Thanks for the reply though. – MGoBlue93 Jun 20 '18 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.