Virtual network interface for virtual machines

NethServer Version: 7.3.1611 (Final)
Module: Interface

I’d like to use a virtual network interface (bwo dummy kernel module). I do not want to bridge my physical NIC (config changes lead to bridge re-start). Nor do I want to NAT the vms.

I have no problem to create the virtual interface (load the dummy module).

But it does not become usable in the nethserver web ui.

I expected it to be handled just the same way as every physical nic as to my understanding logically it is just the same.

Is there something that I missed, can I get this working?

The script /usr/libexec/nethserver/nic-info is responsible, this skips my dummy interface.
I modified it in a way that it let pass interfaces of type dummy (see below). And at least initially this does not seem to break anything: no obvious warnings/errors/mis-behaviour, I could successfully configure it to belong to a new bridge - but tests are pending, I will continue next day(s).

UPDATE: due to strange effect I had to change the script not to drop other virtual NICs. As with doing so, my dummy can no longer be configured but deleted only. Letting pass the 2nd NIC, too, everything looks fine again. Realy really strange.
So below the most recent patch to the script is shown.

Fyi updated nic-info diff:

<     if ! [ -e /sys/class/net/${card}/device ]; then
<         continue
<     fi
> # NO IDEA, WHY, but with passing the dummy interfaces only, they cannot be
> # configured but deleted only. Letting pass the 2nd virtual nic things
> # can be configured again ... strange, very strange.
> #    if ! [ -e /sys/class/net/${card}/device ]; then
> #        if [ -z "$(ip link show ${card} type dummy)" ] ; then
> #            continue
> #        fi
> #    fi
<     driver=`basename $(ls -l /sys/class/net/$card/device/driver | awk '{print$NF}' )`
<     type=`basename $(ls -l /sys/class/net/$card/device/subsystem | awk '{print$NF}' )`
>     if [ -r /sys/class/net/$card/device/driver ] ; then
>         driver=`basename $(ls -l /sys/class/net/$card/device/driver | awk '{print$NF}' )`
>     fi
>     if [ -r /sys/class/net/$card/device/subsystem ] ; then
>         type=`basename $(ls -l /sys/class/net/$card/device/subsystem | awk '{print$NF}' )`
>     fi
1 Like

The dummy interface get’s assigned a new MAC with every re-boot. Just in case this could cause problems, I decided to try to keep a static one.

Unfortunately ns overwrites the dummy0 config file in /etc/sysconfig/network-scripts/ethcfg-dummy.cfg with every network config change. So standard way to configure such isnot possible.

Instead I created a systemd unit to run before network start and that set’s the MAC address by script (and it brings the interface up - not sure it is a good idea to do so before network start, but it seems to work … ?)


Description=assign static MAC to dummy network interface





/sbin/ip link set dev dummy0 address 02:ea:a1:42:ad:b2
/sbin/ip link set dev dummy0 up

Enable the new unit bwo of systemctl enable /usr/local/lib/systemd/dummy0-init.service. Run it manually with systemctl start dummy0-init or re-boot the system.

Tried your solution on NS7 but no luck. However, I do see the dummy interface in diagnostics:

3: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN qlen 1000
link/ether ba:e9:29:8f:00:0d brd ff:ff:ff:ff:ff:ff
inet brd scope global dummy0
valid_lft forever preferred_lft forever
inet6 fe80::b8e9:29ff:fe8f:d/64 scope link
valid_lft forever preferred_lft forever
But gets ignored by the webgui because of HWaddres of ff:ff:ff:ff:ff:ff

any pointers to get by this… the directories you describe seem to not exist on NS7 server.

I’m running exactly this on a NS7 installation. Which directories do not exist on your installation?

To make the dummy interface(s) visible you need to patch the /usr/libexec/nethserver/nic-info (this is what the 2nd post is about).
The 3rd post post describes the steps to gain a stable MAC. The service file is no standard one, so I decided not to place it in a standard location but to a custom directory. Of course this needs to be created first. And the scipt for setting the static MAC nees to be set executable.

Meanwhile I needed a 2nd dummy interface. One needs to create a conf file in /etc/modprobe.d/, e.g. /etc/modprobe.d/dummy.conf:

options dummy numdummies=2

I managed to configure the dummy with help of @asl
I will make a complete howto for the wiki…


I you need help for this howto let me know…


Have you managed to get this written up yet? I don’t see it there, but I could be missing it.

good you reminded me. Slipped my attention… I will start with it asap…