What is a bridged?
A Bridged networking is nothing but a simple technique to connect to the outside network through the physical interface. It is useful for LXC/KVM/Xen/Containers virtualization and other virtual interfaces. The virtual interfaces appear as regular hosts to the rest of the network. In this tutorial I will explain how to configure a Linux bridge with bridge-utils (brctl) command line utility on Ubuntu server.
Our sample bridged networking
01 STEP – INSTALL BRIDGE-UTILS
Type the following apt-get command to install the bridge-utils:
$: sudo apt install bridge-utils
02 STEP – CREATING A PERMANENT NETWORK BRIDGE
$: sudo cp /etc/network/interfaces /etc/network/interfaces.bck $: sudo nano /etc/network/interfaces
If the bridge br0 is to be assigned an IP address by DHCP:
auto ens33 iface ens33 inet manual auto br0 iface br0 inet dhcp bridge_ports ens33
If the bridge br0 is to be assigned a static IP address:
auto ens33 iface ens33 inet manual auto br0 iface br0 inet static address 18.104.22.168 netmask 255.255.255.0 network 22.214.171.124 broadcast 126.96.36.199 gateway 188.8.131.52 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 184.108.40.206 220.127.116.11 dns-search localdomain.local # bridge options bridge_ports ens33
Save and close the file, while on our VMware Fusion the network is
03 – RESTART THE NETWORK SERVICE
to restart the networking service
$: sudo reboot
Use the ping/ip commands to verify that both LAN and WAN interfaces are reachable:
# See br0 $: ip a show # See routing info $: ip r # ping public site $: ping -c 2 cyberciti.biz # ping lan server $: ping -c 2 10.0.80.12
Now if we want, we can configure a LXC containers to use br0 to reach directly Internet or LAN.
Disclaimer: All the tutorials included on this site are performed in a lab environment to simulate a real world production scenario. As everything is done to provide the most accurate steps to date, we take no responsibility if you implement any of these steps in a production environment.
“We learn from our mistakes”