Note: If you are using the Ubuntu Desktop version, the graphical controls are incompatible with the Ifupdown configuration. If you use Ifupdown to configure, you need to disable the use of graphical controls.
This article through I combined with the network content hands-on practice, configuration through the Ifupdown
A bridge is a hardware device used to interconnect two or more data link layers (the second layer of the OSI layer seven model) so that network devices on different network segments can access each other. When you want to interconnect multiple virtual machines or Ethernet interfaces in a host, you need to have a bridge-like concept in your Linux host. A soft bridge is used here.
There are a number of ways to configure a Linux bridge. For example, in a server environment without an external display/keyboard, you can use BRCT to manually configure a bridge. In the desktop environment, bridge settings are also supported in the network manager. Then let's test how to configure a bridge with network manager.
A. Command-line mode configuration:
Create a virtual network card
$tunctl-t tap0-u {user} #user has the Create NIC permission
Create a network bridge and connect the physical network card and the virtual network card to the Network Bridge
# Create a bridge brctl addif br0 eth0 # connection brctl addif br0 tap0 # connection
Setting up bridge details
# Bridge ip$route Add default GW XXX.XXX.XXX.XXX # Routing gateway
Two. Install the tool configuration:
1. Bridge-utils
$apt-get Install bridge-utils$vi/etc/network/interfaces
To add a network bridge in the interfaces configuration file
Auto loiface lo inet loopbackauto eth0iface eth0 inet manualauto br0iface br0 inet staticaddress 192.168.200.130networ K 192.168.200.0netmask 255.255.255.0broadcast 192.168.200.255Gateway 192.168.200.1dns-nameservers 8.8.8.8bridge_ports eth0bridge_stp offbridge_fd 0bridge_maxwait 0bridge_maxage
If it is a dynamic DHCP configuration
Auto loiface lo inet loopbackauto eth0iface eth0 inet manualauto br0iface br0 inet dhcpbridge_ports eth0bridge_stp Offbrid GE_FD 0
2. Using the graphical tool: Nm-connection-editor
A, first, start Nm-connection-editor.
Copy the code as follows: $ nm-connection-editor
The editor's window will show you a list of currently configured network connections. Click the Add button in the upper-right corner to create a bridge.
B. Next, select Bridge as the connection type.
C, now, start configuring the Network Bridge, including its name and the bridged connection. If no other bridges have been created, the default bridge interface is named BRIDGE0.
To recap, the purpose of creating a network bridge is to share your Ethernet card interface via a bridge, so you need to add an Ethernet card interface to the bridge. Adding a new "bridged connection" to the graphical interface can accomplish this. Click the "Add" button.
D, select "Ethernet" as the connection type.
E, in the MAC address area of the device, select the interface that you want to belong to the bridge. In this example, assume that the interface is eth0.
F, click the "General" tab, and select the two check boxes, which are "automatically connect to this network when they are available" and "All users can connect to this network."
G, switch to the "IPv4 Settings" tab to configure DHCP or static IP addresses for the bridge. Note that you should use the same IPv4 settings for the slave Ethernet card interface eth0. In this example, we assume that Eth0 is configured with DHCP. Therefore, select Automatic (DHCP) here. If Eth0 is assigned a static IP address, you should also specify the same IP address for the bridge.
H, finally, save the Network Bridge settings.
Now you will see that a new bridge connection is created in the "Network Connections" window. Since it is already subordinate to the bridge, the previously configured wired connection eth0 is no longer needed, so remove the original wired connection.
I, this time, the bridge connection will be automatically activated. From the IP address assigned to eth0 is taken over by the bridge, you will temporarily lose the connection. When the IP address is assigned to the Network Bridge, you will be connected back to your Ethernet card interface via the Network Bridge. You can confirm it with the "Network" setting.
J, at the same time, check the available interfaces. As a reminder, the bridge interface must have replaced any IP address that your Ethernet card interface has.
That's all, now, the bridge is ready to use.
Ubuntu How to configure the Network Bridge Ubuntu System Configuration Bridge Detailed tutorial