Bridge your dummy interface in centos7

Bridge your dummy interface in centos7 post thumbnail image

Bridge your dummy interface in centos7

I had to start using a dummy interface in my server to make it portable, like a demo in-a-box. Every time that I’ve tried to disconnect it and use other network. I had to make a lot of changes to my configuration: very messy.

Basically, I will tell you how to bridge your dummy interface in centos7. I recommend to disable “NetworkManager” service before anything.

First step is create a dummy interface inside /etc/modprobe.d folder:

[root@box01 ~]# cat /etc/modprobe.d/dummy.conf 
install dummy /sbin/modprobe --ignore-install dummy; /sbin/ip link set name ethdummy1 dev dummy0
[root@box01 ~]# cat /etc/modules-load.d/dummy.conf
# Load dummy.ko at boot
dummy
[root@box01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ethdummy1
NAME=ethdummy1
DEVICE=ethdummy1
MACADDR=00:22:22:ff:ff:ff
IPADDR=10.10.10.1
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
NM_CONTROLLED=no

After reboot, check if you dummy is there like I did here:

[root@box01 ~]# ifconfig ethdummy1
ethdummy1: flags=195<UP,BROADCAST,RUNNING,NOARP>  mtu 1500
        inet 10.10.10.1  netmask 255.255.255.0  broadcast 10.10.10.255
        ether 00:22:22:ff:ff:ff  txqueuelen 0  (Ethernet)

If you want more details on how you we did until here, you should check out this forum thread: Permanent dummy interface

Now it’s time to turn your dummy into a bridge. Remember the most important value are ONBOOT, BRIDGE, DEVICE
Also, I will create a bridge called 0 connected to this dummy interface.

I’ll bridge ethdummy to bridge0:

[root@box01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ethdummy1
NAME=ethdummy1
DEVICE=ethdummy1
#MACADDR=00:22:22:ff:ff:ff
#IPADDR=10.10.10.1
#NETMASK=255.255.255.0
ONBOOT=yes
#TYPE=Ethernet
NM_CONTROLLED=no
BRIDGE=bridge0
[root@box01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bridge0 
DEVICE="bridge0"
ONBOOT="yes"
TYPE=Bridge
BOOTPROTO=static
IPADDR=10.10.10.1
NETMASK=255.255.255.0

Restart network services. My case I used “service network restart”
And let’s check this out.

[root@box01 ~]# brctl show
bridge name	bridge id		STP enabled	interfaces
bridge0		8000.002222ffffff	no		ethdummy1

Some Important Notes:

Don’t forget to use iptables to translate IPs and get Internet access from your VMs connected to this new bridge (servers need to use bridge0 IP as the default gateway: 10.10.10.1)

# You need to translate your IPs thru eth0
# eth0 is the interface connected to the Network
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

That’s all
See ya!

Tags: , ,

Leave a Reply

Related Post