與本地 dhcp 和外部 ipv6 雙橋問題的 lxc 容器聯網

與本地 dhcp 和外部 ipv6 雙橋問題的 lxc 容器聯網

我想在所有容器上外部使用 ipv6,而僅在主機上使用外部 ipv4。我使用的是 Ubuntu 12.04 64 位元。對於容器上的 ipv4,我使用 lxc 安裝隨附的 DHCP。

我的設定工作正常,但我不確定這是否正確。你們能解釋一下嗎?

在我的容器主機上我使用:

 auto lo
 iface lo inet loopback
    address 127.0.0.1
    netmask 255.0.0.0

 auto eth0
 iface eth0 inet manual

 auto br-lxc
 iface br-lxc inet static
    address ipv4
    netmask 255.255.255.0
    gateway ipv4 gw
    bridge_ports eth0

 iface br-lxc inet6 static
    address exte:rnal::ipv6
    netmask 48
    gateway exte:rnal:ipv6:gw

在我的容器配置中:

 lxc.network.type= veth
 lxc.network.flags= up
 lxc.network.link= br-lxc
 lxc.network.hwaddr= random-mac
 lxc.network.name = eth0

 lxc.network.type=veth
 lxc.network.link=br-lxc-1 
 lxc.network.flags=up
 lxc.network.hwaddr= random-mac
 lxc.network.name = eth1

在我的容器中我使用:

 auto lo
 iface lo inet loopback

 auto eth0
 iface eth0 inet6 static
    address ipv6
    netmask 48
    gateway ipv6 gw

 auto eth1
 iface eth1 inet dhcp

我進入容器:

 $ip a|grep inet
    inet6 externalipv6:33/48 scope global
    inet6 internalipv6::78/64 scope link
    inet 10.0.3.52/24 brd 10.0.3.255 scope global eth1
    inet6 internalipv6::28/64 scope link
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
  • 它是否正確?
  • 有沒有更好的方法將 ipv6 橋接到容器?

當我需要重新啟動網路時,我得到:

$ /etc/init.d/networking restart

* Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
* Reconfiguring network interfaces...   

Device "br-lxc" does not exist.

相關內容