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=ipv4And 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/24Gateway=192.168.56.1The 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 addr1: 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 forever2: 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 forever3: 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 routedefault 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 
Cannot access internet from VirtualBox guest (Arch Linux)
arch linux;virtualbox;internet;ping;systemd networkd
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 tutorialone 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 setupnot 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