Question: I need to create a Linux Bridge on my Ubuntu host to share a NIC to other virtual hosts or containers created on the host. I am currently using the Network Manager on Ubuntu, so it is best to use the network manager to configure a bridge. What should I do? A bridge is a hardware device used to interconnect two or more data link layers (Layer 2 in the OSI Layer 7 model) so that network devices on different network segments can access each other. When you want to interconnect
Question: I need to create a Linux Bridge on my Ubuntu host to share a NIC with other virtual hosts or containers created on the host. I am currently using Network Manager on Ubuntu, so it is best to use Network Manager to configure a bridge. What should I do?
A bridge is a hardware device used to interconnect two or more data link layers (Layer 2 in the OSI Layer 7 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 similar bridge concept in the Linux host. A soft bridge is used here.
There are many ways to configure a Linux bridge. For example, in a server environment without 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. Let's test how to configure a bridge using the network manager.
Requirements
To avoid any problems, we recommend that you use the Network Manager version 0.9.9 or later. It is used in Ubuntu 15.04 or later versions.
$ apt-cache show network-manager | grep Version
Version:0.9.10.0-4ubuntu15.1
Version:0.9.10.0-4ubuntu15
Create a bridge
The simplest way to create a bridge using the network manager is to use the nm-connection-editor. This GUI tool allows you to easily configure a bridge.
First, start nm-connection-editor.
$ nm-connection-editor
The editor window displays a list of configured network connections. Click "add" in the upper-right corner to create a bridge.
Next, select "Bridge" as the connection type.
Now, configure the bridge, including its name and the bridge connection. If no other bridges have been created, the default bridge interface is named bridge0.
In retrospect, the purpose of creating a bridge is to share your Ethernet card interface through the bridge, so you need to add the ethernet card interface to the bridge. Adding a new "Bridge Connection" on the graphic interface can achieve the above purpose. Click "Add.
Select "Ethernet" as the connection type.
In the "MAC address of the device" area, select the interface from which you want to belong to the bridge. In this example, assume that the interface is eth0.
Click the "General" tab and select two check boxes: "automatically connect to the network when it is available" and "all users can connect to the network ".
Switch to the "IPv4 Settings" tab and configure DHCP or static IP addresses for the bridge. Note that you should use the same IPv4 setting for the subordinate Ethernet interface eth0. In this example, we assume that eth0 has been configured using DHCP. Therefore, select "automatic (DHCP)" here )". If eth0 is specified with a static IP address, you should also specify the same IP address to the bridge.
Finally, save the settings of the bridge.
Now, you will see a new bridge connection created in the "Network Connection" window. Because it is already affiliated with the bridge, the previously configured Wired connection eth0 is no longer needed, so Delete the original Wired connection.
In this case, the Bridge Connection is automatically activated. When the IP address specified for eth0 is taken over by the net bridge, you will lose the connection temporarily. When the IP address is assigned to the bridge, you will connect to your Ethernet interface through the bridge. You can confirm through "Network" settings.
Check available interfaces. Note that the bridge interface must have replaced any IP address of your Ethernet interface.
That's all. Now, the bridge can be used.
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-05/117504.htm