Ubuntu 18.04: How to create a persistent dummy network interface
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/
:
-
10-dummy0.netdev
[NetDev] Name=dummy0 Kind=dummy
-
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: https://bugs.launchpad.net/netplan/+bug/1774203
The docs:
https://www.freedesktop.org/software/systemd/man/systemd.netdev.html# https://www.freedesktop.org/software/systemd/man/systemd.link.html# https://www.freedesktop.org/software/systemd/man/systemd.network.html#
Related videos on Youtube
Pierre Mourlanne
Updated on September 18, 2022Comments
-
Pierre Mourlanne over 1 year
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.0
And then addsource /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 usenetplan
instead. Apparentlynetplan
does not support the creation of virtual interface (!) https://bugs.launchpad.net/ubuntu/+source/nplan/+bug/1743200.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 up
But this interface will disappear after reboot, as one would expect.How can I create such a dummy network interface that will persist after reboot?
-
Arun almost 6 yearsPlease check this unix.stackexchange.com/questions/335284/…
-
Pierre Mourlanne almost 6 years@Arun I checked this question. I already did this configuration, the interfaces are not up on server boot.
-
poige over 5 years
-
-
jpsecher over 4 yearsOn 16.04, I needed to
systemctl enable systemd-networkd
before therestart
. -
SomeOne_1 over 2 yearsThe same appears to be the case for later releases of ubuntu. (20.04 as of today)