My questions and explanations about the bridge

Source: Internet
Author: User

My questions and explanations about the bridge
The following are some questions about your work. The explanation is purely personal understanding. I do not know whether it is completely correct. If you have any questions, please point out, thank you !!! Is the bridge a L2 switching device? Why can an IP address be configured for a bridge? Why do I need to configure an IP address for the bridge?

Is the bridge a L2 switching device?
A bridge can be a hardware physical device or software (such as a bridge virtualized by the Linux kernel). The bridge works on the second layer of the OSI model, and the data link layer (also contains the first layer of the physical layer, here we will not tangle with this ).
Why can an IP address be configured for a bridge? Why do I need to configure an IP address for the bridge?
The bridge works on the second layer. The data link layer does not contain network functions. Therefore, you cannot configure an IP address for the bridge. However, the bridge device needs to be managed. You can configure an ip address for the device to facilitate management. This ip address is called the network management ip address of the bridge. In other words, the bridge itself does not have an ip address. It has nothing to do with the network layer. Therefore, the ip address configured for the bridge is not a function of the bridge itself. The same is true for configuring an ip address on a linux Virtual Network Bridge. You can configure an ip address for the Virtual Network Bridge, but this is not a function of the bridge itself ~~~ Hahaha.

-------------------------------------- The sporadic understanding about bridging is virtualized in the kernel. It can bridge the real physical NIC (such as eth0 and eth1) on the host, you can also bridge the virtual network card (tap0, tap1, vnet0, vnet1. These bridging NICs work at the link layer and cannot be assigned IP addresses. In fact, the bridging NICs are equivalent to ports on the bridge. All packets received by the port are submitted to the virtual "bridge" for forwarding. In fact, the net bridge does not need to configure an ip address, so that it can completely forward packets. However, if you want to remotely manage your net bridge host, you can configure an ip address on the Net Bridge, however, this function has nothing to do with forwarding, but it only allows the host to access the internet (but also the LAN ).
When creating a virtual machine for linux, to facilitate the communication between the host and its virtual machine, the host is often used as a bridge and an IP address is often assigned to the bridge.
In linux, you can also create a tap using the following method: Add a virtual Nic tap
Tunctl-btap0 -------> execute the above mission to generate a tap with the suffix starting from 0, 1, and 2. Activate the created tapip link set tap0 up sequentially. Here, the tap can be bridge to the bridge, is a port of the bridge. Display bridge information brctl show add bridge brctl addbr virbr0 activate Bridge ip link set virbr0 up add tap0 virtual network card to the specified bridge. When creating a kvm Vm, brctl addif br0 tap0 can specify the port on which the VM is connected. For example, qemu-kvm-m 4096-smp 4-hda/home/linux_hzhsan.qcow2-net nic, model = e1000, macaddr = 53: 02: 43: BC: F8: c1-net tap, ifname = tap0, script = no, downscript = no & It's like a physical host (corresponding to the virtual host) use a network cable to directly connect to a network port of the switch (this network port corresponds to the tap0 above). This tap0 is in the created virtual machine, there will be a corresponding virtual physical network card (you can see eth0 in the virtual client)
Configure an IP address for the bridge to facilitate communication between the host where the bridge is located and the NIC (including the virtual Nic) that the bridge is bridging. Generally, the ip address is assigned to the same CIDR block. IP addresses cannot be configured for NICs (including physical and virtual NICS) that are bridging bridges. However, the corresponding virtual machine can configure an ip address. If the ip address of the bridge is the same network segment, the physical host where the bridge is located can communicate with the virtual host corresponding to the NIC connected to the bridge (which can be pinged ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.