0

I have an IPv6 IP on the guest server which running docker

301b:e0d0:401:0348:lk19:7:0:2

Configuration in the /etc/resolv.conf

domain my.domain

nameserver ::1
nameserver 301b:e0d0:401:0348:505:7:0:2
nameserver 301b:e0d0:401:0348:506:7:0:2

How to get its subnet? We can change the forth value start from right side. But keep other values the same.

I have tried to set the subnet to it in my network. Set it in my docker-compose.yml file

networks:
  default:
    driver: bridge
    enable_ipv6: true
    ipam:
      config:
        - subnet: 301b:e0d0:401:0348::/64

services:
  ipv6nat:
    container_name: ipv6nat
    restart: always
    image: robbertkl/ipv6nat
    privileged: true
    network_mode: host
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /lib/modules:/lib/modules:ro

But it doesn't work. Can't use ping6 to other network in the container with this format

# ping6 301b:e0d0:401:0348:[DIFFERENT_VALUE_HERE]:7:0:2
unreachable
rawmain
  • 151
  • 3
  • 14

1 Answers1

1

How to get an IPv6 subnet to use in Docker?

Ask your provider, ISP, or whatever for a delegation of address space. If you only have a /64 you don't have enough. Ideally you should be able to request a /48, though if they are being stingy they might give you something like a /56.

We can change the forth value start from right side

No, you can't. Your network is a /64, meaning the half the bits are used for the host address. The Docker Host, and the network that you are creating in that compose must be in separate subnets.

But you are both networks on the same subnet.

301b:e0d0:401:0348:[DIFFERENT_VALUE_HERE]:7:0:2

The 301b:e0d0:401:0348:: part of the address defines the subnet for a /64 everything after that just i used for hosts on that same subnet.

Zoredache
  • 128,755
  • 40
  • 271
  • 413