Who to Connect Physical Machine with Virtual Machine

 Bridge: the bridge is layer 2 devices or software connecting different segments(media independent) from one logical segment(single broadcast domain). although the network segments belong to different mediums (wire and wireless).


Example: we have logical network 192.168.1.0/24
                Take two hosts with physical networks eth0 and eth1 which belong to the same subnet(Broadcast domain).
OR             eth0 IP:  192.168.1.2 (physical NIC Host-a) and eth1 IP:  192.168.1.3 (host A-NIC)
                  eth0 IP:  192.168.1.2 (physical NIC) and enp0s3 IP:  192.168.1.3 (vNIC)
OR             eth0 IP:  192.168.1.2 (physical NIC) and wlan0 IP:  192.168.1.3 (wifi NIC)
OR             veth1 IP:  192.168.1.2 (physical NIC) and veth_1 IP:  192.168.1.3 (wifi NIC
            





Linux Bridge:

It is a layer 2 software bridge used to forward layer 2 frames (Ethernet) between the virtual machine or namespaces 

Receiving the end of The  Machine or virtual Machine (virtual card) at NIC(Physical card) remove Ethernet Header (yellow header ) and send ahead the IP Packet(Orange Header + data) for further processing. i.e when a network card (physical PCI card at receiving  ) unwraps the frame and found the IP packet but the Virtual Machine is unable to receive the IP Packet because the virtual network card also needs a layer 2 Technology frame like Physical NIC. IP Packets need to wrap or be packed into layer two packets which is acceptable for the virtual network card. so the virtual Machine Accept the packet (Called Layer two Frame) and removes the upper enveloped found IP envelope (IP packet) and hands over the application or process at TCP or UDP Port.

Note: Physical Machin (NIC) or Virtual Machine(vNIC) same processing of data send or receive.




image from:ithands-on.com

    TUN/TAP Interfaces (Layer 3 Virtual Interface)

Layer 3 virtual interfaces are used to receive or send IP packets.

 Tun or Tunnel interfaces (Layer 3)are those virtual ports that are meant for Routing packets like VPN or GRE-type network-aware applications that use this port for routing purposes. It means

We need to route IP traffic between the host and the network device.

 TAP Interfaces (layer 2): it is the same interface as the tun port but it means bridge layer 2 of the virtual machine and physical machine.

 Linux virtual machine has a vNIC so the virtual network card is able to process layer 2 frame but the physical machine NIC removes the layer 2 header from receiving frame so the TAP interface receives layer 3 packet from Physical NIC converted into Layer 2 Frame for vNIC. i.e., it is bridging two technologies virtual and physical.

ithands-on.com



Wikipedia




Comments