Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up and configure a bridge on Debian Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Xiaobian to share with you how to set up and configure the bridge on Debian Linux, I believe most people still do not know how, so share this article for everyone's reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!

Q: I am a new Debian Linux user and I want to set up bridges for virtualization environments (KVM) running on Debian Linux. So how do I set up a bridged network in/etc/network/interfaces on a Debian Linux 9.x server?

How you want to assign IP addresses to your virtual machines and make them accessible from your local area network, you need to set up a network bridge. By default, virtual machines use dedicated bridges created by KVM. But you need to manually set up interfaces to avoid conflicts with network administrators.

How to install brctl

Enter the following apt-get command:

$ sudo apt install bridge-utils How to set up bridges on Debian Linux

You need to edit the/etc/network/interface file. However, I recommend placing a completely new configuration in the/etc/network/interface.d/directory. The procedure for configuring bridges in Debian Linux is as follows:

Step 1 -Find your physical interface

Using the ip command:

$ ip -f inet a s

Example output is as follows:

2: eno1: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 inet 192.168.2.23/24 brd 192.168.2.255 scope global eno1 valid_lft forever preferred_lft forever

ENO1 is my physical network card.

Step 2 -Update the/etc/network/interface file

Make sure only lo (loopback is active in/etc/network/interface). Remove any configuration associated with eno1. This is the configuration file I printed using cat command:

$ cat /etc/network/interface# 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 loiface lo inet loopback Step 3 -Configure the bridge in/etc/network/interfaces.d/br0 (br0)

Create a text file using a text editor, such as the vi command:

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

Add configuration to it:

## static ip config file for br0 ##auto br0iface 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 eth2 # bridge_ports eth0 eth2 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 to use DHCP to get an IP address:

## 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 network services

Before restarting network services, make sure the firewall is turned off. Firewalls may reference older interfaces, such as eno1. Once the service restarts, you must update the firewall rules for the br0 interface. Restart the firewall by typing:

$ sudo systemctl restart network-manager

Confirm that the service has restarted:

$ systemctl status network-manager

Find the new br0 interface and routing table with the ip command:

$ ip a s $ ip r $ ping -c 2 cyberciti.biz

Example output:

You can use the brctl command to view information about the bridge:

$ brctl show

Display current bridge:

$ bridge link

That's all for "How to set up and configure bridges on Debian Linux". Thanks for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report