Install the brctl

Type the following apt command/apt-get command:

$ sudo apt install bridge-utils


How to setup network bridge on Debian Linux

You need to edit /etc/network/interface file. However, I recommend to drop a brand new config in /etc/network/interface.d/ directory. The procedure to configure network bridge on Debian Linux is as follows:


Step 1 – Find out your physical interface

Use the ip command:

$ ip -f inet a s


Step 2 – Update /etc/network/interface file

Make sure only lo (loopback is active in /etc/network/interface). Remove any config related to eno1. Here is my config file printed using cat command:


$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback


Step 3 – Configuring bridging (br0) in /etc/network/interfaces.d/br0

Create a text file using a text editor such as vi commands:

$ sudo vi /etc/network/interfaces.d/br0

Append the following config:

## static ip config file for br0 ##
auto br0
iface br0 inet static
	address 192.168.2.23
	broadcast 192.168.2.255
	netmask 255.255.255.0
	gateway 192.168.2.254
	# If the resolvconf package is installed, you should not edit 
        # the resolv.conf configuration file manually. Set name server here
        #dns-nameservers 192.168.2.254
        # If you have muliple interfaces such as eth0 and eth1
        # bridge_ports eth0 eth1  
	bridge_ports eno1
	bridge_stp off       # disable Spanning Tree Protocol
        bridge_waitport 0    # no delay before a port becomes available
        bridge_fd 0          # no forwarding delay


If you want the bridge to get an IP address using DHCP:

## DHCP ip config file for br0 ##
auto br0
 
# Bridge setup
 iface br0 inet dhcp
    bridge_ports eno1

Save and close the file in vi/ vim.


Step 4 –  Restart networking service in Linux

Before you restart the networking service make sure firewall is disabled. The firewall may refer to an older interface such as eno1. Once service restarted, you must update firewall rule for interface br0. Type the following restart the networking service:


$ sudo systemctl restart network-manager

Verify that service has been restarted:


$ systemctl status network-manager

Look for new br0 interface and routing table with the help of ip command:


$ ip a s
$ ip r
$ ping -c 2 url

You can also use the brctl command to view info about your bridges:


$ brctl show

Show current bridges:


$ bridge link

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)