A virtual switch, or vSwitch, is a software based Layer-2 switch that operates like a physical ethernet switch.
A vSwitch allows virtual machines to communicate with each other within a virtual network and with external physical networks through the physical network interface cards (pNICs).
Multiple vSwitches can be created under a virtualised server but network traffic can not flow directly from one vSwitch to another vSwitch within the same host, and vSwitches can not share the physical NIC.
The most popular vSwitches include:
- Cisco Nexus 1000VE Series Virtual Switch
- Cisco Application Virtual Switch
- Open vSwitch
- IBM DVS 5000v
- vSphere Switch
One of the downsides of a standard vSwitch is every vSwitch is part of a cluster virtualised servers needs to be configured in every virtual host.
This problem can be solved by using distributed virtual switching, it aggregates vSwitches together to form a cluster of virtualised servers and treats them as a single distributed virtual switch.
There are some benefits of using distributed switching:
- Centralised management of vSwitch configuration for multiple hosts in a cluster
- Migration of networking statistics and policies with virtual machines during a migration
- Configuration consistency across all hosts that are part of the distributed switch
Containers rely on vSwitches just like virtual machines for communication within a node or the outside work.
Docker creates a virtual bridge called Docker0 and is assigned the subnet block 172.17.0.1/16
Every container created by Docker is assigned a virtual Ethernet interface with Docker0. It appears in each container as eth0.
The eth0 interface is assigned an IP address from the bridges subnet block of 172.17.0.0/16
All containers within the node can communicate with each other over this Docker0 bridge.
If Docker is installed on another node with default configuration, that node will too have the default addressing and will need to be changed.
As nodes scale even higher, it may be worth involving the use of a container orchestrator such as Kubernetes.