OverviewA virtual device is an abstraction built on one or more real devices. The correspondence between a virtual device and a real device is many-to-many, but not all combinations can be defined or supported by the kernel.
Some of the more common virtual devices are listed below:
Bonding //bindings, virtual devices bind physical devices so that they are like a single device 802.1Q //ieee standard for establishing a virtual representative of vlanbridging//bridge aliasing interfaces / /alias interface, which allows a Ethernet real interface to have multiple virtual interfaces True Equalizer (TEQL)//General equalizer, is a queue rule for traffic control tunnel interfaces //tunneling interface
Interaction initialization of the virtual appliance with the Kernel network protocol stack:As with the real device, the NET_DEVICE structure is assigned when the virtual device is initialized(
note :Alias deviceis not required to allocate Net_device). Typically, the net_device of a virtual device contains pointers to functions that contain the function pointers used by the relevant real device. Configuration:The virtual appliance typically has a special user-space Configuration tool to configure and cannot use the Ifconfig
external interface:The virtual appliance creates a file or directory under the/proc file system (the alias device is still a special case, it does not/proc to create a file or directory), and the content and complexity of the creation depends on the design of the virtual appliance.
Transmission: when the virtual device is not a one-to-one correspondence between the real devices, the function used for the transfer needs to select the corresponding real device and other tasks. Because QoS is applied according to the needs of each device, traffic configuration is required.
Receive:virtual appliances are software objects that do not need to participate in the interaction with system resources, and the traffic they receive is indirectly obtained. Different virtual devices have different ways of handling incoming traffic, such as 802.1q may only pass the packet with the correct ID, and the bridge will allow all packages to pass.
External notifications:As with real devices, virtual devices also focus on special event notifications that occur with other components of the system. Virtual devices are based on the logic of real devices, and real devices cannot deliver notifications to virtual devices, so notifications for virtual devices need to be done separately.
virtual Appliance cannot perceive hardware-triggered notifications
Additional features of virtual appliancesThe advantages of virtual appliances are usedRegister_netdevice and Unregister_netdevice to register/de-remove, rather than their parcel function, and to get more time to hold the lock.
real-world devices are removed (destroyed) only when downloaded, but virtual devices can be ordered
most real-world devices useDev->init, Dev->uninit and dev->destructor. To register and de-remove equipment. However, most virtual devices use relatively simple logic. They useDev->init andDev->uninit has done extra work to makeDev->destructor does not require a display call.for real devices, the initialization of the Net_device is split into the driver's probe process and the general Setup routines section. But the virtual device doesn't have a probe routine.
about the kernel notification bracelet: Because virtual devices are built on real-world devices, changes in real-world devices can affect virtual devices.
Deep understanding of Linux Network Technology Insider--Summary of virtual device initialization