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.
More info:
[root@arch64 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:1a:7d:74 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.5/24 brd 192.168.0.255 scope global dynamic enp0s3
valid_lft 3598sec preferred_lft 3598sec
inet6 fe80::a00:27ff:fe1a:7d74/64 scope link
valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:3c:0a:7d brd ff:ff:ff:ff:ff:ff
inet 192.168.56.2/24 brd 192.168.56.255 scope global enp0s8
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe3c:a7d/64 scope link
valid_lft forever preferred_lft forever
[root@arch64 ~]# ip route
default via 192.168.56.1 dev enp0s8 proto static
default via 192.168.0.1 dev enp0s3 proto dhcp src 192.168.0.5 metric 1024
192.168.0.0/24 dev enp0s3 proto kernel scope link src 192.168.0.5
192.168.0.1 dev enp0s3 proto dhcp scope link src 192.168.0.5 metric 1024
192.168.56.0/24 dev enp0s8 proto kernel scope link src 192.168.56.2