I have a dedicated server running Ubuntu 18.04, which is using systemd.network to manage its networking.

The server has only one physical NIC.

The hosing provider has allocated two IP addresses and two MAC addresses to me, as part of the service.

This is the configuration is /etc/systemd/network


Address=<IPv6 Address>/64


The above configuration contains only one of my two allocated IPv4 addresses.

I need to add a virtual interface with the MAC address and IPv4 address of my second allocation. I am, however, unsure as how to achieve this.

Both interfaces need to use the same physical NIC.

I know how to achieve this with NetworkManager, but not systemd. I am not certain as to what is possible with systemd.network either... Do I need to create two virtual interfaces, both with their own IPv4 and MAC addresses, and have them both share the physical NIC for connectivity? Or should the existing configuration be left as is (as above) on the physical NIC and an additional virtual interface be created with the second set of details?

For simplicity sake, assume the following;

Address One (currently configured on physical NIC):
IP Address: x.x.x.x
Gateway: x.x.x.y

Address Two (currently unconfigured):
IP Address: a.a.a.a
Gateway: x.x.x.y

Once the virtual interface is up (a.a.a.a), I will pass it directly though to a PFSense VM. Which will then act as an edge NAT router for all other VMs.


This is 50% answer and 50% question back, but it needs too much space to fit in a comment.

With netplan that can render to networkd/networkManager as you need it this would look like (with my sample addresses of course):

    version: 2
            dhcp4: false

That gives me normal 2 addr on one device/mac as you need it right?

2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:a8:b4:96 brd ff:ff:ff:ff:ff:ff
    inet brd scope global ens3
       valid_lft forever preferred_lft forever
    inet brd scope global ens3
       valid_lft forever preferred_lft forever

Note: You can make it matching more reliable by adding a match rule like (in case device type or slot assignment might ever change):

        macaddress: 52:54:00:a8:b4:96

And I have to admit, with the complexity of networkd - if I need to know how it is done in networkd I still write netplan rules and let it render them, so I can read what it created. From that if you want to use only networkd, you'd create it like this:



The above will allow you to have both IPs that you wanted (if that is what you need), but not yet use both MACs.

I do not expect your NIC to really have two MACs right (I'd not see hwo that works). But I can think of your NIC having one MAC and you are "allowed" to use another MAC one on it, like when you would have used macvlan in the past?

ip link add link eth0 address AA:AA:AA:AA:AA:AA ens3.1 type macvlan

If you really have MACs on your device I think everybody would be happy to see a networkctl status -a output to see that for further consideration. Otherwise I'll assume you have one primary MAC (XX:...) and are allowed/supposed to add another one (AA:...).

If you are really on the latter case and adding another IP as shown above is not enough, then I think you are blocked by this bug if so please chime in there and give the bug a bump with a comment and explaining why the above is not enough - Otherwise I'd expect while staying in state wishlist it might take a while to get fixed.

  • Thanks for the response. You're correct in stating that the physical interface itself does not have multiple MAC addresses. I have one MAC which is allocated to the hardware NIC and another which I assume is configured in the ARP table of a switch, so frames can be sent to the correct (my) interface. But that is transparent to me. Supposedly, the reason this is done is to make assigning a virtual NIC on a hypervisor to a guest VM possible. Since the server only has one NIC I can't pass it though to a virtual machine and have the host accessible via the network. – RHSkinner Jun 28 '18 at 14:04
  • If I can't get this work, then I suppose I will have to assign both of the IP addresses to the same interface. Then use routing on the host to send packets coming in on my second public IP to an internal VM-Host interface connected to a PFSense router, then route that traffic inside my virtual network. – RHSkinner Jun 28 '18 at 14:08
  • Additionally, I don't know how to use NetPlan instead of networkd. The installed Ubuntu 18.04 image was customized by my service provider (Hetzner). NetPlan was not installed, although I have since installed it. – RHSkinner Jun 28 '18 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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