我们最近在Debian Wheezy Beta 3(x86_64)上build立了一个服务器,它具有本地IPv6连接。
我们configuration了eth0接口,通过/etc/network/interfaces一些post-up hook命令获得IPv6configuration。 结果是,启动系统后,接口上只configuration了IPv4和自动configuration的链路本地IPv6地址,就好像该命令从未执行过一样。
当我们在/etc/init.d/networking初始化脚本中调用ifup -a之后,另外放置这些命令时,一切都按预期工作,并且在启动后我们有一个完全configuration的接口。
这是一个非常丑陋的方式来configuration接口。 我们在做什么错了ifup post-up hooks? 或者这是一个错误?
更新:另外一个事实是,我正在使用Dropbear SSH服务器来使我能够解锁我的LUKSencryption根文件系统。 Linux内核因此通过GRUB引导程序给予一个IP地址。 这可能意味着IPv6configuration没有完成,因为eth0已经启动。 然后,我尝试在ifup -a之前放置一个ifdown eth0 ifup -a /etc/init.d/networking脚本中的一行。 它没有改变任何东西。 这里是一个例子:
ifdown eth0 if ifup -a $exclusions $verbose && ifup_hotplug $exclusions $verbose
更新:我设置了一个小脚本作为configuration接口并将输出写入日志文件的后挂钩。 结果是日志文件从未写入,这意味着后挂钩根本不被调用。
/etc/network/interfaces的部分如下所示(更改了IP地址):
allow-hotplug eth0 iface eth0 inet static address 1.2.3.1 netmask 255.255.255.192 network 1.2.3.0 broadcast 1.2.3.63 gateway 1.2.3.62 dns-nameservers 8.8.8.8 dns-search mydomain.tld post-up ip -6 addr add 2001:db8:100:3022::2 dev eth0 post-up ip -6 route add fe80::1 dev eth0 post-up ip -6 route add default via fe80::1 dev eth0
我也尝试了这种替代方法:
auto eth0 iface eth0 inet static address 1.2.3.1 netmask 255.255.255.192 network 1.2.3.0 broadcast 1.2.3.63 gateway 1.2.3.62 dns-nameservers 8.8.8.8 dns-search mydomain.tld iface eth0 inet6 static address 2001:db8:100:3022::2 netmask 64 gateway fe80::1
我们添加到/etc/init.d/networking :
… case "$1" in start) process_options check_ifstate if [ "$CONFIGURE_INTERFACES" = no ] then log_action_msg "Not configuring network interfaces, see /etc/default/networking" exit 0 fi set -f exclusions=$(process_exclusions) log_action_begin_msg "Configuring network interfaces" if ifup -a $exclusions $verbose && ifup_hotplug $exclusions $verbose then # Our additions ip -6 addr add 2001:db8:100:3022::2 dev eth0 ip -6 route add fe80::1 dev eth0 ip -6 route add default via fe80::1 dev eth0 log_action_end_msg $? else log_action_end_msg $? fi ;; …
更新 :启动后ip -6 address show eth0的输出是:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000 inet6 fe80::abcd:abcd:abcd:abc/64 scope link valid_lft forever preferred_lft forever
我有同样的问题,当我将ipparameter passing给内核时,IPv6configuration会失败。 问题是networking脚本尝试将IP地址添加到已经存在的eth0接口。 这当然会失败,所以进一步的configuration会停止。
最简单的解决scheme是简单地从/etc/network/interfaces删除IPv4部分,因为它已经通过ip参数进行了configuration:
auto eth0 iface eth0 inet6 static address 2001:db8:100:3022::2 netmask 64 gateway fe80::1
在debian wheezy我不得不做一些愚蠢的工作。对格式的抱歉,我真的没有得到这个网站的布局,这是晚了。
auto lo iface lo inet loopback allow-hotplug eth0 auto eth0 eth0:0 eth0:1 eth0:2 iface eth0 inet static address 66.xxx.xxx.101 netmask 255.255.255.0 gateway 66.xxx.xxx.1 iface eth0:0 inet static address 173.xxx.xxx.6 netmask 255.255.255.0 iface eth0:1 inet static address 192.xxx.xxx.180 netmask 255.255.xxx.0 iface eth0 inet6 static address fe80::xxxx:xxxx:xxxx:f48e netmask 64 gateway fe80::1 iface eth0:0 inet6 static address 2600:xxx::f03c:xxx:xxx:f48e netmask 64 iface eth0:1 inet6 static address 2600:xxx:xxx:007a::1 netmask 64 iface eth0:2 inet6 static address 2600:xxx:xxx:007a::2 netmask 64
这导致了以下结果:
eth0 Link encap:Ethernet HWaddr bogus:mac inet addr:66.xxx.xxx.101 Bcast:66.xxx.xxx.255 Mask:255.255.255.0 inet6 addr: 2600:xxx::f03c:xxx:xxx:f48e/64 Scope:Global inet6 addr: fe80::f03c:91ff:feae:f48e/64 Scope:Link inet6 addr: 2600:xxx:xxx:7a::2/64 Scope:Global inet6 addr: 2600:xxx:xxx:7a::1/64 Scope:Global UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:37908 errors:0 dropped:0 overruns:0 frame:0 TX packets:30834 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3201392 (3.0 MiB) TX bytes:3735827 (3.5 MiB) eth0:0 Link encap:Ethernet HWaddr bogus:mac inet addr:173.xxx.xxx.6 Bcast:173.xxx.xxx.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 eth0:1 Link encap:Ethernet HWaddr bogus:mac inet addr:192.xxx.xxx.180 Bcast:192.xxx.xxx.255 Mask:255.255.xxx.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
iproute2是应该支持声明所有这些(至lessipv4)在eth0而不是eth0:0 …等,但是这并没有工作..即使我宣布eth0:0等ipv6所有这些都显示在eth0下而当他们被宣布为eth0时,他们肯定没有工作。