Configure Ubuntu To Host
Graphical Bridged NetworkingBefore setting Ubuntu to host virtual machines, it’s a good idea to set up bridged networking. Using bridged networking instead of KVM’s built-in virtualized networking interface allows virtual machines to exist on the local network along with physical machines. The easiest way to do this is by using Network Manager.
To begin, right click on the Network Manager applet in the menu bar or open it from the programs menu. Either way, the goal is to get to the listing of network connections. Once there, click
Add. You will be presented with a menu in which you can select the connection type. Select
Virtualsection and click
You will then see a configuration window for the new bridge. You can configure it however you like, including the name, but ensure that
All users...are checked under the
IPv4tab, there are settings for configuring the network interface. If you want simplicity, make sure that
Method:is set to
DHCP. If you want a static IP address, feel free to configure it.
Back at the
Addto link the bridge to a network device. Again, you will get a window asking you to select the type of connection.
Ethernetis probably the one you’re looking for, unless you need some sort of special configuration.
Create, you will see another configuration window. Under
Deviceselect the network interface that you want to bridge. Like the bridge configuration, make sure that
All users...are checked under the
Generaltab. When that’s done, click save. Safe the bridge as well.
Back on the
Network Connectionswindow, delete the existing connection that was added to the bridge.
At this point, Network Manager should pick up the changes and apply them. If not, try restarting it with Systemd.
$ sudo systemctl restart networkingIf all else fails, restart the computer.
Manual Bridged NetworkingThe first step to getting a network bridge working manually on Ubuntu is to install the
$ sudo apt-get install bridge-utilsThe
bridge-utilspackage provides utilities for creating and managing network bridges. The main one needed here the
$ sudo brctl addbr br0 $ sudo ip addr show $ sudo brctl addif br0 eth0The commands above use set up the basics for the bridge. First,
brctladds the bridged interface
br0. The second command looks up the IP addresses of the interfaces currently in use. Pick the one your system is actually using. In this guide, it will be referred to as
eth0. The last line establishes the bridge between
Now that that is set up, it’s time to add the bridge details to the network interface configuration. To do so, open up the configuration as root, like in the command below.
$ sudo vim /etc/network/interfacesIn order to use the bridge, make sure that your configuration looks similar to the one below, substituting
eth0for the name of your interface.
# Establishing which interfaces to load at boot and establish the loopback auto lo br0 iface lo inet loopback # Set the existing interface to manual to keep it from interfering with the bridge via DHCP iface eth0 inet manual # Create the bridge and set it to DHCP. Link it to the existing interface. iface br0 inet dhcp bridge_ports eth0When the changed are completed, save the configuration and exit the text editor. Everything should be set for the bridge to work. Nothing else will change in terms of normal use. There will only be bridged interface available for the applications that use it. In order for the bridge to take effect, restart networking with Systemd.
$ sudo systemctl stop network-manager $ sudo systemctl disable network-manager $ sudo systemctl restart networking
Set Up KVM and Virt-ManagerA couple more packages are needed to get KVM and Virt-Manager running, so install those now.
$ sudo apt-get install qemu-kvm libvirt-bin virt-managerOnce the packages are done installing, it’s a good idea to add a user to the
libvirtdgroup, so that they can manage the VM. If not, it can be done as root, but that’s probably not the best idea.
$ sudo adduser username libvirt $ sudo adduser username libvirt-qemuAfter the user has been added to the
libvirtdgroup, they must log out and back in in order for the new group permissions to take effect.
Virt-ManagerAfter logging back in as that user, you can open up Virt-Manager and begin setting up virtual machines. It’s usually under the
Systemwith the full name
Virtual Machine Manager. On opening the program, you’ll see a window like the one below. To create a new virtual machine, click the icon with the monitor and the flash of light.