Bridge Network – Connect Host with VM

To get more details about Bridge interface read https://wiki.archlinux.org/index.php/Systemd-networkd#Bridge_interface. The advantage of this setup is that the host and guest VM can connect to each other, not like in macvtab environments

Create Bridge device

Define virtual bridge device (br1 could be named differently):

sudo nano /etc/systemd/network/br1.netdev
[NetDev]
Name=br1
Kind=bridge

Restart systemd-networkd to create the bridge:

systemctl restart systemd-networkd

On host you should see now the new bridge:

$ ip a
3: br1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default 
    link/ether ae:bd:35:ea:0c:c9 brd ff:ff:ff:ff:ff:ff

Bind ethernet to bridge

Modify the /etc/systemd/network/MyEth.network to replace line with DHCP=ip4 with the bridge name, as the bridge requires an interface to bind to with no IP.  Example:

sudo nano /etc/systemd/network/wired.network
[Match]
Name=en*

[Network]
Bridge=br1

Bridge network

Create a network profile for the Bridge

sudo nano /etc/systemd/network/br1.network
[Match]
Name=br1

[Network]
DHCP=ipv4

Restart the computer.

Use new Bridge for VM

In Virt-Manager in the network card settings of the virtual machine change to “enter name of the bridge device” and type in the name of the virtual bridge device of the host, in this example it is br1. Just restart and the virtual machine guest should get a IPv4 address from the router, IPv6 is configured automatically if available in the local network.

The advantage of this setup is that the host and guest can connect to each other, which is not possible with macvtap bridges. It is a little more work but you are getting a real network environment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.