3

I am using VirtualBox 5.0.20. The host machine is a MacBook running OS X 10.11.5 (El Capitan). The guest OS is 64-bit Arch Linux. When I installed Arch from the ISO, the guest's internet connectivity was fine. However, once I booted into the installed system, I could no longer reach the internet (for example, pinging 8.8.8.8 just hangs indefinitely).

The virtual machine has two network adapters: one bridged and one host-only. I have tried changing the bridged to a NAT adapter, as well as connecting the bridge at one time to the host's wireless interface and at another time to the host's wired interface. The guest cannot access the internet under any of these setups.

The guest OS has enabled systemd-networkd.service and systemd-resolved.service. It does not have any other network service enabled that I am aware of. If possible, I would like to stick to these services, rather than switch to a different service, but I will switch if there is some inherent flaw in these services that is the root of my problem.

Within the guest OS, the contents of the bridged adapter's network file:

[root@arch64 ~]# cat /etc/systemd/network/bridged.network 
[Match]
Name=enp0s3

[Network]
DHCP=ipv4

And the contents of the host-only adapter's network file:

[root@arch64 ~]# cat /etc/systemd/network/host-only.network 
[Match]
Name=enp0s8

[Network]
Address=192.168.56.2/24
Gateway=192.168.56.1

The bridged adapter successfully acquires a DHCP lease and I can additionally ping hosts on my LAN, but I cannot ping anything beyond my LAN's router. The host's internet connection is fine.

  • It's interesting that you can ping other computers on your LAN from the guest OS. Are you using netctl or netctl-auto? If not look into getting those installed and go from there. – SupaJord Jun 15 '16 at 23:00
1

The answer comes from a tip I received on this same question asked in the Unix & Linux StackExchange.

Per my setup, I had two systemd network unit files: one for the bridged adapter and one for the host-only adapter. I wanted the bridged adapter to have a dynamic address because the virtual machine is on a laptop that moves between networks, and I wanted the host-only adapter to have a static address so that I could access it, such as by ssh, without having to manually determine the address.

However, in creating the network unit files, I blindly copied what I found in a wiki tutorial—one section describing how to quickly set up a dynamic address, the other how to quickly set up a static address. Obviously, the tutorial assumed I would use one or the other simple setup—not both side-by-side, which is a more complex scenario.

Suffice to say that the host-only adapter's network file had the Gateway option specified, while the bridged adapter's file did not. So it appears that the host-only adapter's gateway became the preferred route for traffic coming from the virtual machine. Removing this option from the network file resolved the issue.

Host-only adapter network file after fix (removed the Gateway option):

[root@arch64 ~]# cat /etc/systemd/network/host-only.network 
[Match]
Name=enp0s8

[Network]
Address=192.168.56.2/24

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.