How to Configure Bridged Networking for KVM on Ubuntu 16.04 / 14.04 / Debian 9
Abstract: iface br1 inet static. Configure bridged networking for KVM on Ubuntu 16.04 – Bridged Networking Verify ip address by using the following command. ifc
Bridged networking or network is a dedicated network card to a virtual machine which provides a communication path to outside network, and this must be set up before creating a virtual machine using Virtual Manager.
READ: How to install KVM on Ubuntu 16.04 / Ubuntu 14.04
This guide will help you to configure bridged networking on Ubuntu 16.04 / Ubuntu 14.04.
You can either use a command line or graphical mode.
Install bridge-utils package using the apt command.
sudo apt-get install -y bridge-utils resolvconfCommand line
Edit interface file to create bridge 「br1「, this should be executed on KVM host.
sudo nano /etc/network/interfaces
My machine has two network cards eth0 and eth1, so I have created a bridge using both network card.
# interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback #Bridge Name # auto br1 # Bridge Information # iface br1 inet static bridge_ports eth1 eth0 bridge_stp off bridge_fd 9 # Bride IP # address 192.168.12.7 netmask 255.255.255.0 network 192.168.12.0 broadcast 192.168.12.255 gateway 192.168.12.2 dns-nameservers 192.168.12.2 dns-nameservers 8.8.8.8
Bring up the bridge.
sudo ifup br1
OR
Restart the network service.
sudo service networking restartGraphical Mode
Click on the dash and search for Virtual Machine Manager.
Configure bridged networking for KVM on Ubuntu 16.04 – Virt Manageror
virt-manager
Edit >> Connection details >> Click on Plus sign.
Configure bridged networking for KVM on Ubuntu 16.04 – Bridged Networking Connection DetailsChoose bridge as an interface type and then click on forward.
Configure bridged networking for KVM on Ubuntu 16.04 – Bridged Networking Interface typeSet a Name, start mode as on boot and choose to activate now.
Configure bridged networking for KVM on Ubuntu 16.04 – Bridged Networking Configure InterfaceYou can configure ip address by clicking on Configure right to IP settings. Once IP is configured, click OK.
Configure bridged networking for KVM on Ubuntu 16.04 – Bridged Networking Configure IP for bridgeClik on the finish to create a bridge called 「br1」.
Configure bridged networking for KVM on Ubuntu 16.04 – Bridged NetworkingVerify ip address by using the following command.
ifconfig br1
Output:
br1 Link encap:Ethernet HWaddr 00:0c:29:26:55:17 inet addr:192.168.12.7 Bcast:192.168.12.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe26:5517/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:250 errors:0 dropped:0 overruns:0 frame:0 TX packets:229 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:21236 (21.2 KB) TX bytes:31676 (31.6 KB)Configure bridged networking for KVM on Ubuntu 16.04 – Bridged Networking Verifying details
That’s All.