This repository contains the source code for the Docker Network Plugin used by Kathará.
The plugin has two different versions, which are divided in the two main folders:
vde
: creates pure L2 LANs using VDE (Virtual Distributed Ethernet) software switches and tap interfaces (which is built using the kathara/katharanp_vde
tag).bridge
(legacy): creates pure L2 LANs using Linux bridges and veth pairs (which is built using the kathara/katharanp
tag).The plugin is compiled and released for both amd64
and arm64
architectures. The tag of the plugin identifies the architecture.
To build both the plugin versions, type on terminal (in the root of the project):
$ make all_<arch>
Where <arch>
can be: amd64
or arm64
.
NOTE: since the vde
version relies on C code, you can only build the Docker plugin for your target architecture!
You can also build only a specific version of the plugin by entering its directory, for example:
$ cd vde && make all_<arch>
The build process leverages on Docker, so you don't need any dependencies installed in your machine.
It is possible to leverage on this plugin as a standalone Docker Network Plugin, in order to create pure L2 networks. Please check the README
of each version (inside the corresponding folder) for specific information.
katharanp
supports two different ways to assign a MAC Address to a network interface:
kathara.mac_addr
driver option while connecting a container to a network:
docker network connect --driver-opt kathara.mac_addr=aa:bb:cc:dd:ee:ff l2net container
kathara.machine
and kathara.iface
driver options (they are required together):
docker network connect --driver-opt kathara.machine=container --driver-opt kathara.iface=1 l2net container
The formula to compute the MAC address is the following:
container-1
b588c219865f6fe336908e5991216b13
b588c219865f
-> b5:88:c2:19:86:5f
0xb5 | 0x02 = 0xb7 & 0xfe = 0xb6
b6:88:c2:19:86:5f
Example output from the container:
root@584e403aec5a:/# ifconfig eth1
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether b6:88:c2:19:86:5f txqueuelen 1000 (Ethernet)
RX packets 8 bytes 736 (736.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0