Creating overlay vlan networks in swarm

Loading

thomasa@swarm100:~$ docker network ls | grep swarm
og16srgvcvq0        ingress             overlay             swarm
thomasa@swarm100:~$ 
thomasa@swarm100:~$ 

 

# create a swarm overlay network with a vlan 
docker network create  swarm_vlan10 –driver overlay –subnet 192.168.10.0/24 –gateway 192.168.10.1
docker network create  swarm_vlan20 –driver overlay –subnet 192.168.20.0/24 –gateway 192.168.20.1

Creating a new service inside a vlan

 

thomasa@swarm100:~$ docker service create –name papajones –network swarm_vlan10 –replicas 3 nginx

thomasa@swarm100:~$ docker network inspect swarm_vlan10
[
    {
        “Name”: “swarm_vlan10”,
        “Id”: “sw2lvnp4sd2qanxjktav2xofp”,
        “Created”: “2020-10-04T09:15:46.281934306Z”,
        “Scope”: “swarm”,
        “Driver”: “overlay”,
        “EnableIPv6”: false,
        “IPAM”: {
            “Driver”: “default”,
            “Options”: null,
            “Config”: [
                {
                    “Subnet”: “192.168.10.0/24”,
                    “Gateway”: “192.168.10.1”
                }
            ]
        },
        “Internal”: false,
        “Attachable”: false,
        “Ingress”: false,
        “ConfigFrom”: {
            “Network”: “”
        },
        “ConfigOnly”: false,
        “Containers”: {
            “c2b4ac36a77d6e73d2f715a4e312b2863915829d6637fcbf8d338048e0a4bbc5”: {
                “Name”: “papajones.3.15nkh4m3njfxfbiwj5gelb0gq”,
                “EndpointID”: “cd27f6b42d4488bf14dbf728df5cee0a6cda6cc656b5295d84881f0f1edfeff3”,
                “MacAddress”: “02:42:c0:a8:0a:05”,
                “IPv4Address”: “192.168.10.5/24”,
                “IPv6Address”: “”
            },
            “lb-swarm_vlan10”: {
                “Name”: “swarm_vlan10-endpoint”,
                “EndpointID”: “d9b69cbde38040b3c943dadc352371ea3cf1a1f7e0b29687d416990bd10f69e1”,
                “MacAddress”: “02:42:c0:a8:0a:07”,
                “IPv4Address”: “192.168.10.7/24”,
                “IPv6Address”: “”
            }
        },
        “Options”: {
            “com.docker.network.driver.overlay.vxlanid_list”: “4099”
        },
        “Labels”: {},
        “Peers”: [
            {
                “Name”: “f3c7ec061c97”,
                “IP”: “192.168.1.21”
            },
            {
                “Name”: “7286f0d059a3”,
                “IP”: “192.168.1.22”
            },
            {
                “Name”: “d2a0c8859837”,
                “IP”: “192.168.1.23”
            }
        ]
    }
]
thomasa@swarm100:~$ 

(Visited 71 times, 1 visits today)

By C A Thomas

Chinchu A. Thomas is an Infrastructure Analyst specializing in Microsoft Azure, the Microsoft 365 suite, AWS, and Windows infrastructure management products.

Leave a Reply