Overview
The vlan plugin creates a vlan subinterface off an master interface in the host network namespace and place the vlan subinterface inside the container namespace. Each container must use different master
and vlanId
pair.
The host-local IPAM plugin can be used to allocate an IP address to the container. The traffic of the container interface will be bridged through the master interface.
Example network configuration
{
"name": "mynet",
"cniVersion": "0.3.1",
"type": "vlan",
"master": "eth0",
"mtu": 1500,
"vlanId": 5,
"linkInContainer": false,
"ipam": {
"type": "host-local",
"subnet": "10.1.1.0/24"
},
"dns": {
"nameservers": [ "10.1.1.1", "8.8.8.8" ]
}
}
Network configuration reference
name
(string, required): the name of the networktype
(string, required): “vlan”master
(string, required): name of the host interface to enslave. Defaults to default route interface.vlanId
(integer, required): id of the vlanmtu
(integer, optional): explicitly set MTU to the specified value. Defaults to value chosen by the kernel.ipam
(dictionary, required): IPAM configuration to be used for this network.dns
(dictionary, optional): DNS information to return as described in the Result .linkInContainer
(boolean, optional) specifies if the master interface is in the container network namespace or the main network namespace