Linux KVM Bridge network on Ubuntu

On Ubuntu 18.04 server, first i get Ubuntu to use /etc/network/interface, by default Ubuntu 18.04 and newer use netplan.

First install ifdown

apt install ifupdown -y

Install bridge utils and resolvconf.

apt install bridge-utils resolvconf

Now you can configure your network interface by editing file

vi  /etc/network/interface

Here is my network configuration on an OVH server.

root@ns3048991:~# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto eno3
iface eno3 inet static
    address 149.202.199.137
    netmask 255.255.255.255
    broadcast 149.202.199.137
    gateway 149.202.199.254
    dns-nameservers 8.8.8.8 8.8.4.4
root@ns3048991:~# 

To convert this interface to bridge network, do the following

1) Replace all occurance of “eno3” with “br0”

2) Add following lines

    bridge_ports eno3
    bridge_stp off
    bridge_maxwait 5

In above, replace “eno3” with name of your physical interface.

Here is my final network configuration.

root@ns3048991:~# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto br0
iface br0 inet static
    address 149.202.199.137
    netmask 255.255.255.255
    broadcast 149.202.199.137
    gateway 149.202.199.254
    bridge_ports eno3
    bridge_stp off
    bridge_maxwait 5
    dns-nameservers 8.8.8.8 8.8.4.4
root@ns3048991:~# 

See Linux KVM, Networking @ linux-kvm.org

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *