I have a VPS that supports IPv6, provided by the merchant a /64 IPv6 subnet per server.
But how should I configure it to the LXC container?
This is my environment
root@lxc:~# cat /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 172.x.x.x
netmask 255.255.255.0
gateway 172.x.x.1
iface eth0 inet6 static
accept_ra 0
address 2604:fbc0:7b:031d:0000:0000:0000:0001
netmask 64
gateway 2604:fbc0:7b::1
post-up /sbin/ip -r route add 2604:fbc0:7b::1 dev eth0
post-up /sbin/ip -r route add default via 2604:fbc0:7b::1
root@lxc:~# cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
root@lxc:~# lxc network list
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
+--------+----------+---------+-------------+------+-------------+---------+
| NAME | TYPE | MANAGED | IPV4 | IPV6 | DESCRIPTION | USED BY |
+--------+----------+---------+-------------+------+-------------+---------+
| eth0 | physical | NO | | | | 0 |
+--------+----------+---------+-------------+------+-------------+---------+
| lxdbr0 | bridge | YES | 10.0.0.1/24 | | | 1 |
+--------+----------+---------+-------------+------+-------------+---------+
root@lxc:~# lxc network show lxdbr0
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
config:
ipv4.address: 10.0.0.1/24
ipv4.nat: "true"
ipv6.nat: "true"
description: ""
name: lxdbr0
type: bridge
used_by:
- /1.0/profiles/default
managed: true
status: Created
locations:
- none
root@lxc:~# ip route
default via 172.x.x.x dev eth0 onlink
10.0.0.0/24 dev lxdbr0 proto kernel scope link src 10.0.0.1 linkdown
172.x.x.0/24 dev eth0 proto kernel scope link src 172.x.x.x
root@lxc:~# ip -6 route
::1 dev lo proto kernel metric 256 pref medium
2604:fbc0:7b::1 dev eth0 metric 1024 pref medium
2604:fbc0:7b:31d::/64 dev eth0 proto kernel metric 256 pref medium
2604:fbc0:7b:31d::/64 dev lxdbr0 proto kernel metric 256 linkdown expires 3538sec pref medium
fe80::/64 dev eth0 proto kernel metric 256 pref medium
fe80::/64 dev lxdbr0 proto kernel metric 256 linkdown pref medium
default via 2604:fbc0:7b::1 dev eth0 metric 1024 onlink pref medium
root@lxc:~# lxc launch ubuntu/20.04 ubuntu
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
Creating ubuntu
The local image 'ubuntu/20.04' couldn't be found, trying 'ubuntu:20.04' instead.
Starting ubuntu
root@lxc:~# lxc list
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
+--------+---------+-----------------+------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+--------+---------+-----------------+------+-----------+-----------+
| ubuntu | RUNNING | 10.0.0.9 (eth0) | | CONTAINER | 0 |
+--------+---------+-----------------+------+-----------+-----------+
root@lxc:~# lxc exec ubuntu -- bash
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
root@ubuntu:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
6: eth0@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:16:3e:41:4e:b8 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.0.0.9/24 brd 10.0.0.255 scope global dynamic eth0
valid_lft 3582sec preferred_lft 3582sec
inet6 fe80::216:3eff:fe41:4eb8/64 scope link
valid_lft forever preferred_lft forever
root@ubuntu:~# ping6 www.gogole.com
ping6: connect: Network is unreachable