Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 addresses with more than two groups set cause address collision #1302

Closed
hellt opened this issue Mar 21, 2023 · 2 comments · Fixed by #1372
Closed

IPv6 addresses with more than two groups set cause address collision #1302

hellt opened this issue Mar 21, 2023 · 2 comments · Fixed by #1372
Labels
documentation Improvements or additions to documentation

Comments

@hellt
Copy link
Member

hellt commented Mar 21, 2023

Consider the following topo:

---
name: c

mgmt:
  network: clab-mgmt
  ipv4_subnet: 172.30.0.0/16
  ipv6_subnet: fd1a:b128:5901::/32

topology:
  defaults:
    kind: linux
    image: alpine

  nodes:
    l1:
      mgmt_ipv4: 172.30.1.1
      mgmt_ipv6: fd1a:b128:5901::101
    l2:
      mgmt_ipv4: 172.30.1.2
      mgmt_ipv6: fd1a:b128:5902::101

Nodes l1 and l2 has different IPV6 addresses set, but they are not parsed either by clab or docker and cause address collision:

❯ clab dep -c -t test.clab.yml     
INFO[0000] Containerlab v0.38.0 started                 
INFO[0000] Parsing & checking topology file: test.clab.yml 
INFO[0000] Removing /tmp/clab-c directory...            
INFO[0000] Creating lab directory: /tmp/clab-c          
INFO[0000] Creating docker network: Name="clab-mgmt", IPv4Subnet="172.30.0.0/16", IPv6Subnet="fd1a:b128:5901::/32", MTU="1450" 
INFO[0000] Creating container: "l2"                     
INFO[0000] Creating container: "l1"                     
ERRO[0001] failed deploy phase for node "l2": Error response from daemon: Address already in use 
ERRO[0001] failed to run postdeploy task for node l2: failed to Statfs "": no such file or directory 

This is because the address that gets configured for the first node only has two groups set:

❯ docker inspect clab-mgmt
[
    {
        "Name": "clab-mgmt",
        "Id": "b301768abab95b091bd22f7d2720900efaaccc17c9c3e1441e068c5f5a36a408",
        "Created": "2023-03-21T15:00:49.717101046+01:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": true,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.30.0.0/16"
                },
                {
                    "Subnet": "fd1a:b128:5901::/32"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "1027b8dbe0df2b768d1283160aa1827f6d4128e740bb793a3c634fd8def76093": {
                "Name": "clab-c-l1",
                "EndpointID": "08f0a9da0dc45321e5c3b903f95c26b0516e1af78dc958406299368c8fc4a35f",
                "MacAddress": "02:42:ac:1e:01:01",
                "IPv4Address": "172.30.1.1/16",
                "IPv6Address": "fd1a:b128::101/32"
            }
        },
        "Options": {
            "com.docker.network.driver.mtu": "1450"
        },
        "Labels": {
            "containerlab": ""
        }
    }
]
@hellt hellt changed the title IPv6 addresses with more than two groups set causes address collision. IPv6 addresses with more than two groups set cause address collision Mar 21, 2023
@steiler
Copy link
Collaborator

steiler commented Apr 28, 2023

Reported to docker
moby/moby#45402

@hellt
Copy link
Member Author

hellt commented May 3, 2023

Thanks @steiler for digging all the way to moby, as explained in moby/moby#45402 (comment) this is an implementation detail in moby that truncates makes an address fd1a:b128:a:b:c:d:e:f to be truncated as fd1a:b128::c:d:e:f.

We have to make a note in the docs about it for ipv6 addresses

@hellt hellt added the documentation Improvements or additions to documentation label May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants