I am trying to add a virtual interface to a bare metal Ubuntu Server 20.10 installation.
I've read that in pre version 20 this wasn't possible in netplan, and that people were reverting to ifup/ifdown. But this is supposed to be possible with what I have.
I am trying to give my server a second interface so I can bind a pihole docker container to said interface.
I see in the netplan docs various interface types, and the closest one is a vlan type, but it doesn't seem that type works with untagged vlans.
In any case, I appreciate any help you can give me.
I'm going to assume that by "virtual interface" you mean that you want to have a main interface (Example: "eth0"), which may or may not have an address on one subnet, and you want to create an interface labeled differently (Example: "eth0:0") with an address on a different subnet.
Prior to netplan version 0.100, this was not supported. However, version 0.100 added the lifetime and label properties to the addresses values.
You can check your installed netplan version with the following command:
dpkg -l | grep netplan
Here is an example .yaml that will attempt to use dhcp to assign an IP address to the eth0 interface, and will assign the static IP address 192.168.55.151/24 to the virtual interface labeled eth0:0:
This will produce the following results (of course eth0 would have an IP if it were connected to a DHCP server):
"Virtual interface" can refer to a variety of different technologies. Normally, containers are attached to a bridge. You can create bridges in netplan, using syntax such as:
Update to edited question.
Netplan can assign multiple addresses to a single interface and does not support interface aliases (e.g. eth0:0).
Taken from this link https://netplan.io/examples/#using-multiple-addresses-on-a-single-interface
Docker try's to bind to all interfaces by default. An ip address on a given interface can by specified.
docker run -d -p 10.0.0.1:8080:80 nginx
Maybe this will do the job: https://netplan.io/examples/#attaching-vlans-to-network-interfaces