CentOS 7 with NatNetwork and Host-Only Network Routing Issue

Discussions about using Linux guests in VirtualBox.
Post Reply
Adam M.
Posts: 2
Joined: 21. Dec 2015, 00:05
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: CentOS

CentOS 7 with NatNetwork and Host-Only Network Routing Issue

Post by Adam M. »

Hi,

I currently have an issue with CentOS guests, with the following config:

enp0s3 - NatN etwork connection with DHCP (NatNetwork)
enp0s8 - Host-Only connection with static addressing on 172.16.0.x (vboxnet0).

At boot time the VM is unable to access the internet with the NatNetwork.

Code: Select all

ip route show
shows:

Code: Select all

default via 172.16.0.1 dev enp0s8  proto static  metric 100 
default via 192.168.55.1 dev enp0s3  proto static  metric 101 
172.16.0.1 dev enp0s8  proto static  scope link  metric 100 
192.168.55.0/24 dev enp0s3  proto kernel  scope link  src 192.168.55.5  metric 100
If I then do

Code: Select all

systemctl restart network
this changes to:

Code: Select all

default via 192.168.55.1 dev enp0s3  proto static  metric 100 
default via 172.16.0.1 dev enp0s8  proto static  metric 101 
172.16.0.1 dev enp0s8  proto static  scope link  metric 100 
192.168.55.0/24 dev enp0s3  proto kernel  scope link  src 192.168.55.5  metric 100
And the VM can access the internet.

Is there any way I can have this the "on boot" condition?

Thanks,

Adam M.
Adam M.
Posts: 2
Joined: 21. Dec 2015, 00:05
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: CentOS

Re: CentOS 7 with NatNetwork and Host-Only Network Routing I

Post by Adam M. »

Ok, so I finally fixed this.

In nmtui for enp0s8 I checked the "Never use this network for default route" and then in /etc/sysconfig/network-scripts I created a route-enp0s8 file with:

Code: Select all

172.16.0.1 dev enp0s8
And everything works :)
Post Reply