I'm running an ubuntu server 18.04 under VirtualBox with 2 network adapters: NAT Network (enp0s3) and a Host-only Adapter (enp0s8). I use the NAT to access the internet and the Host-only Adapter to SSH in from the host. I want the address at both interfaces to be static. At first, I thought that this was the problem but it seems that it is not.
network: ethernets: enp0s3: addresses: [10.0.0.200/24,] dhcp4: no dhcp6: no gateway4: 10.0.0.1 nameservers: addresses: [184.108.40.206, 220.127.116.11] enp0s8: addresses: [192.168.1.2/24,] dhcp4: no dhcp6: no gateway4: 192.168.1.1 version: 2
It seems that the two gateway definitions conflict with each other but I don't know how to make it work without it. I tried using routes and the result was the same. Maybe I used them wrong since they seemed equivalent to just having the gateway definition there. At first, it might seem like it worked and I'm able to ssh into the machine and ping google.com, but if I turn off the vm, exit vbox and then start everything again I find that I'm be able to just ssh into the vm or just ping google but never both, depending on what tweak I made to the netplan plan. How can I make that configuration work?
$ VBoxManage natnetwork list NAT Networks: Name: natnet1 Network: 10.0.0.0/24 Gateway: 10.0.0.1 IPv6: No Enabled: Yes