物理机上开启ipv6转发和ra通告
vim /etc/sysctl.conf
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.eno1.forwarding = 1
net.ipv6.conf.wlp0s20f3.forwarding = 1
net.ipv6.conf.docker0.forwarding = 1
net.ipv6.conf.all.accept_ra = 2 # 0表示不接受RA,1表示forwarding是关闭时就接受,2表示无论forwarding是否关闭,主机都接受RA
net.ipv6.conf.default.accept_ra = 2
net.ipv6.conf.eno1.accept_ra = 2
net.ipv6.conf.wlp0s20f3.accept_ra = 2
net.ipv6.conf.docker0.accept_ra = 2
sysctl -p
物理机上配置docker支持ipv6,fixed-cidr-v6为容器ipv6内网网段,default-gateway-v6为容器ipv6内网网关
vim /etc/docker/daemon.json
{
"experimental": true,
"ipv6": true,
"ip6tables": true,
"fixed-cidr-v6": "fd00::/80"
}
【host网络】
容器使用物理机网络,自动获得路由器下发的ipv6公网地址
【bridge网络】
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.eth0.forwarding = 1
net.ipv6.conf.all.accept_ra = 2 # 0表示不接受RA,1表示forwarding是关闭时就接受,2表示无论forwarding是否关闭,主机都接受RA
net.ipv6.conf.default.accept_ra = 2
net.ipv6.conf.eth0.accept_ra = 2