Ubuntu 18.04: How to create a persistent dummy network interface

I am trying to create a dummy network interface on a Ubuntu 18.04 server. Here is how I would do it on my previous Ubuntu 16.04 servers:

In /etc/network/interfaces.d/dummy.cfg, write:auto dummy0 iface dummy0 inet static address 192.168.98.1 netmask 255.255.255.0And then add source /etc/network/interfaces.d/dummy.cfg in /etc/network/interfaces/

From what I understand, Ubuntu 18.04 does not use /etc/network/interfaces anymore, we should use netplan instead. Apparently netplan does not support the creation of virtual interface (!) .

I can create the dummy interface with the iproute2 toolkit instead:$ ip link add dummy0 type dummy $ ip addr add 192.168.98.1/24 dev dummy0 $ ip link set dummy0 upBut this interface will disappear after reboot, as one would expect.

How can I create such a dummy network interface that will persist after reboot?

3

1 Answer

I had the same problem on 18.04 server and directly used the systemd-networkd way of configuring interfaces:

I created 2 files in /etc/systemd/network/:

  1. 10-dummy0.netdev

    [NetDev]
    Name=dummy0
    Kind=dummy
  2. 20-dummy0.network

    [Match]
    Name=dummy0
    [Network]
    Address=192.168....
    Address=fe80::.....

On boot the dummy interface is created automatically with IPv4 and IPv6 addresses an is shown in ip addr . Also systemctl restart systemd-networkd should create the interface.

I filed a bug on netplan, please support:

The docs:

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like