UPDATE – Managing Multiple Interfaces with Fedora 21, libvirt, Qemu, NetworkManager

This post is an update to a previous post on using multiple interfaces(Ethernet cards) on the LAN, – utilizing RedHat’s popular virtualization tools – QEMU, KVM, libvirt, and virt-manager.  In this article I will demonstrate with Fedora 21, but this roughly applies to CentOS 7 as well.

I’ve resisted upgrading to recent versions of Fedora/CentOS for a long time.  The main reason is that I hate NetworkManager.  It does to much automatically; I much preferred the old ‘network’ daemon that could easily be manually set.  For instance if I create a Bridge(call it bridge1) interface assigned to my second Ethernet card(eth1) NetworkManager will automatically create a profile for each with automatic startup and DHCP enabled!  I don’t need or want a DHCP lease on either side of a bridged interface!  Among other issues are the creation of duplicate profiles when libvirt restarts.  So NetworkManger reports ‘bridge1’ & ‘bridge1’ in the NM start menu applet.

Ideally libvirt and NetworkManager would work hand in hand because Redhat sponsors both projects…

In this article we will describe the steps to allow you to connect two seperate NIC’s to a switch; assigning one of the NIC’s specifically to guest VM’s.

Goals of this post:

  • Set NetworkManager to ignore bridge and Ethernet device
  • enable systemd version of rc.local boot script to create bridge at boot
  • assign host to specific bridged Ethernet device

Step 1: Decide which Ethernet card will be used for host

We will be creating a bridge to allow our VM’s access to the local network.  Run the ‘ifconfig’ command to locate and choose the dedicated Ethernet card we will assign to ‘bridge1’.

enp6s2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet netmask broadcast
inet6 fe80::218:e7ff:fe17:ddc7 prefixlen 64 scopeid 0x20<link>
ether 00:18:e7:17:dd:c7 txqueuelen 1000 (Ethernet)
RX packets 480707 bytes 559569902 (533.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 353309 bytes 80680508 (76.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

enp6s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::202:b3ff:fe3d:50cc prefixlen 64 scopeid 0x20<link>
ether 00:02:b3:3d:50:ff txqueuelen 1000 (Ethernet)
RX packets 9107 bytes 1404981 (1.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7057 bytes 367428 (358.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet netmask
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 8 bytes 800 (800.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8 bytes 800 (800.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


I’m using Ethernet device enp6s3 for my bridge(call it bridge1).

Step 2:  Disable NetworkManager on specific Ethernet device

Navigate to the ‘/etc/NetworkManager’ directory.  Open up NetworkManager.conf with your favorite text editor.  The keyfile plugin allows us to exclude the devices a number of ways.  I put the MAC address of enp6s3(00:02:b3:3d:50:ff) and also exluded the bridge I intend to create(bridge1) and also the virtual bridge(virbr0, created automatically by libvirt at boot for VM’s private network).

example /etc/NetworkManager/NetworkManager.conf:

GNU nano 2.3.4 File: NetworkManager.conf




Step 3:  Systemd and rc.local

If you’re super annoyed by Sytemd, NetworkManger and Gnome 3 so am I, but we got to get over it.  Fedora 21 has a rc.local implantation installed by default, you just got to create the file, ‘/etc/rc.d/rc.local’.  Add the following commands, being sure to put your Ethernet interface in place of mine below.

GNU nano 2.3.4 File: rc.local

/sbin/brctl addbr bridge1
/sbin/brctl addif bridge1 enp6s3
/sbin/brctl stp bridge1 on
/sbin/ifconfig enp6s3 up
/sbin/ifconfig bridge1 up



Reboot.  On the next login use the ‘brctl’ command to make sure the bridge was set up properly.  STP should be enabled and is necessary if two NIC’s are connected to the same switch.

This is how it should look:

[root@localhost rc.d]# brctl show
bridge name bridge id STP enabled interfaces
bridge1 8000.0002b33d50cc yes enp6s3
virbr8 8000.525400f3c7d2 yes virbr8-nic

Step 4:  Assign Virtual Machine to interface

Open Virtual Machine Manager, select the VM to be assigned and ‘right click’ to select “open”.  From the “View” option select “Details”.  Next Select “NIC” from side pane and set it to ‘bridge1’


 When you boot your VM it should now be able to get DHCP and communicate like a regular device on the local network!  If anyone has instructions on Ubuntu/Debian please post!

If you like this article tell Google!!

Written by mattb in: Linux | Tags: , , , , , , , ,

1 Comment »

  • mattb

    Directions work the same for CentOS 7

    Comment | May 24, 2016

RSS feed for comments on this post. TrackBack URL

Leave a comment