Networking 101 : Veth network interfaces, Linux virtual bridges and Namespaces
Creating namespaces:
We can create namespaces using the below command:
Connecting two namespaces:
In order for the namespace_1 and namespace_2 to communicate, we create a connection (comparable to a physical network cable) and we connect one end to namespace_1 and the other end to namespace_2.
Creation of the "veth" virtual cables:
We, then connect end_1 to namespace_1:
We give each "virtual cable" end an IP address:
To delete a cable we use the below command (deleting one end of the connection, deletes also the other end):
When we want to connect more than two namespaces, we would need a bridge. Linux offers us a virtual bridge.
We create a virtual bridge "bridge_1" using:
We check if the bridge was created using the below command. On the host "bridge_1" appears as an interface:
We attach the link namespace_1_end_1 to namespace_1:
We, then attach bridge_end_1 to the Linux bridge bridge_1:
We, then attach bridge_end_2 to the Linux bridge bridge_1:
Comments