5

I have a number of VBox Ubuntu VMs that use a Bridged adapter for internet traffic and Host-only adapters for internal traffic. (Just a hobby.)

Using netplan, the only way I've been able to get both interfaces configured is to boot with one file for one interface then load the other file to configure the other interface.

Here's the file /etc/netplan/01-systemd-networkd.yaml which is the only yaml file in the /etc/netplan directory.

network:
  version: 2
  ethernets:
    enp0s3 :
      addresses: [192.168.0.128/24]
      gateway4: 192.168.0.1
      nameservers:         
        addresses: [8.8.8.8,8.8.4.4]

I've tried a parallel entry for enp0s8 that includes all the fields and that produced a strange result whereby the enp0s3 had two IP6 addresses and the enp0s8 had none and neither could communicate even with their gateway.

So how do we do this?

Thanks

  • Please edit your question and add what file you are referring to. – decuser Mar 29 '19 at 15:57
  • @decuser Done. I've added it also to the answer. – Stephen Boston Mar 30 '19 at 3:24
6

This works. I would rather the nameservers and gateway at a higher level so that they're not associated with one of the interfaces, but perhaps I'm missing something.

/etc/netplan/01-systemd-networkd.yaml

--

network:
  version: 2
  ethernets:
    enp0s3:
      addresses: [192.168.0.128/24]
      gateway4: 192.168.0.1
      nameservers:
        search: [yourdomain]
        addresses: [8.8.8.8,8.8.4.4]
    enp0s8: 
      addresses: [192.168.56.128/24]
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.