Dummy interface on RHELΒΆ
With NetworkManager
Create /etc/NetworkManager/dispatcher.d/99-virbr10
and make it executable.
This script configures the dummy interface when the virtual bridge is brought
up. Use the MAC address that you chose earlier for the virtual bridge.
#!/bin/sh
# See the "DISPATCHER SCRIPTS" section of `man NetworkManager`.
# Remember to make this file executable!
[ "$1" != "virbr10" ] && exit 0
case "$2" in
"up")
# Create the dummy interface.
/sbin/ip link add virbr10-dummy address 52:54:00:7e:27:af type dummy
# Attach the dummy interface to the bridge.
/usr/sbin/brctl addif virbr10 virbr10-dummy
;;
esac
Without NetworkManager
Create /etc/sysconfig/virbr10-dummy
. Use the MAC address that you chose
earlier for the virtual bridge.
# echo "MACADDR=52:54:00:7e:27:af" > /etc/sysconfig/virbr10-dummy
Create /etc/systemd/system/dummy@.service
with these contents:
# '%i' becomes 'virbr10' when running `systemctl start [email protected]`
# Remember to run `systemctl daemon-reload` after creating or editing this file.
[Unit]
Description=Dummy network interface for %i
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/sysconfig/%i-dummy
ExecStartPre=-/sbin/ip link add %i-dummy address ${MACADDR} type dummy
ExecStart=/usr/sbin/brctl addif %i %i-dummy
[Install]
WantedBy=multi-user.target
Enable and start the service.
# systemctl daemon-reload
# systemctl enable [email protected]
# systemctl start [email protected]
Without NetworkManager and without systemd
Warning
This requires loading the dummy kernel module, which creates an interface
called dummy0
. When following instructions later in this guide, remember
that the interface is called dummy0
, not virbr10-dummy
, and amend
the commands accordingly.
Create /etc/sysconfig/network-scripts/ifcfg-dummy0
. Use the MAC address that
you chose earlier for the virtual bridge.
DEVICE=dummy0
MACADDR=52:54:00:7e:27:af
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
BRIDGE=virbr10
IPV6INIT=no
Load the dummy module.
# modprobe dummy numdummies=1
# echo "dummy" > /etc/modules-load.d/dummy.conf
# echo "options dummy numdummies=1" > /etc/modprobe.d/dummy.conf
If using Red Hat Enterprise Linux 6, create an executable file called
/etc/sysconfig/modules/dummy.modules
with the following contents:
#!/bin/sh
/sbin/modprobe dummy numdummies=1