Debian Ubuntu Mint Howto Create Bridge (br0)

Having a network bridge allows you to bridge traffic under multiple devices so they can talk natively without using any special routing, iptables/firewall or other trickery.

To create your bridge you need the bridge-utils package for brctl and if you want to do things like bridge VMs that run on a tap   device you will need the uml-utilities which provides "tunctl".

Install the utilities to make our bridge

sudo apt-get install bridge-utils uml-utilities

Backup your interfaces file to your home dir

sudo cp /etc/network/interfaces ~/interfaces-`date +%Y-%m-%d-%s`

Edit your interfaces file like this:

In this case I have a public facing NIC enp0s9 which I do NOT want to bridge.

But I wanted to bridge my internal NIC enp0s8.  The first thing you do is set a line for the bridged NIC to just be manual (remove any IP config info whether static or DHCP from the NIC you want to bridge).

Disable the NIC you want to bridge

iface enp0s8 inet manual

Setup your bridge

Also be note that the br0 is a zero not an "O"

For simplicity I am going to call it br0 but it could be called almost anything. 

The key part is below in bold where I declare the br0:


iface br0 inet static
  bridge_ports enp0s8

Now of course I could use dhcp instead of static and that is where it would end (assuming you wanted to use DHCP). 

On the second line below indented you add "bridge_ports enp0s8" which defines enp0s8 as belonging to the br0 bridge.

*Note what you see below are NOT commands in the terminal but the contents of /etc/network/interfaces

Here is what it all looks like:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo enp0s9 br0
iface lo inet loopback
iface enp0s9 inet dhcp

iface enp0s8 inet manual
iface br0 inet static
  bridge_ports enp0s8
   address 192.168.1.1
   netmask 255.255.255.0
   gateway 192.168.1.1

Another basic example of what it could look like with just dhcp and a single NIC

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo enp0s3 br0
iface lo inet loopback


iface br0 inet static
  bridge_ports enp0s3
   address 192.168.1.1
   netmask 255.255.255.0
   gateway 192.168.1.1

Example of adding an alias to the bridge

 # interfaces(5) file used by ifup(8) and ifdown(8)
auto lo enp0s3 br0
iface lo inet loopback


iface br0 inet static
  bridge_ports enp0s3
   address 192.168.1.1
   netmask 255.255.255.0
   gateway 192.168.1.1
#below we add an alias called br0:0 but we could have called it br0:1, br0:10 etc...
auto br0:0
iface br0:0 inet static
   address 192.168.1.200
   netmask 255.255.255.0
   gateway 192.168.1.1

 

After you are done do not forget to restart your network to apply the changes or your bridge won't work.

sudo service networking restart

 

 


Tags:

debian, ubuntu, mint, howto, br, allows, multiple, devices, natively, routing, iptables, firewall, trickery, utils, brctl, vms, uml, utilities, provides, quot, tunctl, install, sudo, apt, interfaces, dir, cp, etc, edit, nic, enp, bridged, manual, ip, config, info, static, dhcp, disable, iface, inet, simplicity, bold, declare, bridge_ports, indented, defines, belonging, ifup, ifdown, auto, loopback, netmask, gateway,

Latest Articles

  • Huion and Wacom Tablets How To Install in Linux Mint / Ubuntu and make the stylus work properly
  • ffmpeg how to cut certain parts of video out
  • ffmpeg how to concat and join two video clips
  • mencoder instead of ffmpeg to join or concatenate video files with different audio streams
  • Linux How To Stop Missing Drive from Halting Boot Process in fstab
  • How To Replace Audio Track of Video using ffmpeg
  • qemu-img convert formats vdi vmdk raw qcow2
  • Linux and Windows Dual Boot Crazy Time Issues
  • dynagen / dynamips 100% high CPU usage solution - how to set the idlepc value
  • How To Setup a Cisco CME (Cisco Manager Express) Virtual Router under Linux using dynamips and dynagen
  • Linux Mint Ubuntu Debian CentOS Dual Boot Install Issues
  • Linux Mint Ubuntu Debian Centos RHEL no sound solution
  • Linux Mint/Debian/Ubuntu/Centos Installer black grub screen and blank screen after trying to boot installer or main OS
  • Linux Mint Dual Boot Install Avoid Wiping our your Main C: drive /dev/sda MBR and EFI
  • QEMU-KVM soundhw deprecated how to enable sound in QEMU 4.x series
  • Virtualbox Error Cannot register the hard disk because a hard disk with UUID already exists solution
  • kernel: [549267.368859] mate-terminal[7871]: segfault at 2000000101 ip 00007f5d0a9548f0 sp 00007fff7012c610 error 4 in libgobject-2.0.so.0.4800.2[7f5d0a920000+52000]
  • apcupsd how to setup and monitor APC UPS units
  • How To Password Reset, Recover, Bypass, Remove and Unlock on Windows 10,8,7,Vista,XP,NT,2000,2003,2008,2012,2016,2019 Administrative Login Programs
  • Nvidia Ubuntu Linux Screentearing Video with solution driver