我有一台 Debian 7 服务器,其中运行了多个网络和 KVM 虚拟机,配置如下:
- 2a01:4f8:191:439b::/64
- 144.72.132.208/29
IPv6 子网被分为 /96 网络,以便为每个网桥分配一个自己的子网。
auto hetzner0 iface hetzner0 inet static address 144.76.43.151 network 144.76.43.128 netmask 27 gateway 144.76.43.129 iface hetzner0 inet6 static address 2a01:4f8:191:439b:0:0:0:1 netmask 96 gateway fe80::1 auto hetzner1 iface hetzner1 inet static address 144.72.132.209 broadcast 144.72.132.208 netmask 29 bridge_ports none bridge_fd 1 bridge_waitport 0 bridge_stp off iface hetzner1 inet6 static address 2a01:4f8:191:439b:0:1:0:1 netmask 96
虽然 IPv4 运行正常,但 IPv6 却让我抓狂。hetzner0 上的 v6 地址分配正确,我能够 ping 遍全球。但 hetzner1 上的地址没有分配!我可以通过执行以下操作手动添加它:
/sbin/ip -f inet6 addr add 2a01:4f8:191:439b:0:1:0:1/96 dev hetzner1
虽然这可行,但在后上勾和前下勾中执行此操作却不起作用......
post-up /sbin/ip -f inet6 addr add 2a01:4f8:191:439b:0:1:0:1/96 dev hetzner1
pre-down /sbin/ip -f inet6 addr add 2a01:4f8:191:439b:0:1:0:1/96 dev hetzner1
通过 sysctl 为该接口启用 IPv6,同时禁用大多数自动配置:
╰─$ sysctl -a | grep 'hetzner1' net.ipv4.conf.hetzner1.accept_local = 0 net.ipv4.conf.hetzner1.accept_redirects = 0 net.ipv4.conf.hetzner1.accept_source_route = 0 net.ipv4.conf.hetzner1.arp_accept = 0 net.ipv4.conf.hetzner1.arp_announce = 0 net.ipv4.conf.hetzner1.arp_filter = 0 net.ipv4.conf.hetzner1.arp_ignore = 0 net.ipv4.conf.hetzner1.arp_notify = 0 net.ipv4.conf.hetzner1.bootp_relay = 0 net.ipv4.conf.hetzner1.disable_policy = 0 net.ipv4.conf.hetzner1.disable_xfrm = 0 net.ipv4.conf.hetzner1.force_igmp_version = 0 net.ipv4.conf.hetzner1.forwarding = 1 net.ipv4.conf.hetzner1.igmpv2_unsolicited_report_interval = 10000 net.ipv4.conf.hetzner1.igmpv3_unsolicited_report_interval = 1000 net.ipv4.conf.hetzner1.log_martians = 0 net.ipv4.conf.hetzner1.mc_forwarding = 0 net.ipv4.conf.hetzner1.medium_id = 0 net.ipv4.conf.hetzner1.promote_secondaries = 0 net.ipv4.conf.hetzner1.proxy_arp = 0 net.ipv4.conf.hetzner1.proxy_arp_pvlan = 0 net.ipv4.conf.hetzner1.route_localnet = 0 net.ipv4.conf.hetzner1.rp_filter = 1 net.ipv4.conf.hetzner1.secure_redirects = 1 net.ipv4.conf.hetzner1.send_redirects = 0 net.ipv4.conf.hetzner1.shared_media = 1 net.ipv4.conf.hetzner1.src_valid_mark = 0 net.ipv4.conf.hetzner1.tag = 0 net.ipv4.neigh.hetzner1.anycast_delay = 100 net.ipv4.neigh.hetzner1.app_solicit = 0 net.ipv4.neigh.hetzner1.base_reachable_time_ms = 30000 net.ipv4.neigh.hetzner1.delay_first_probe_time = 5 net.ipv4.neigh.hetzner1.gc_stale_time = 60 net.ipv4.neigh.hetzner1.locktime = 100 net.ipv4.neigh.hetzner1.mcast_solicit = 3 net.ipv4.neigh.hetzner1.proxy_delay = 80 net.ipv4.neigh.hetzner1.proxy_qlen = 64 net.ipv4.neigh.hetzner1.retrans_time_ms = 1000 net.ipv4.neigh.hetzner1.ucast_solicit = 3 net.ipv4.neigh.hetzner1.unres_qlen = 31 net.ipv4.neigh.hetzner1.unres_qlen_bytes = 65536 net.ipv6.conf.hetzner1.accept_dad = 0 net.ipv6.conf.hetzner1.accept_ra = 0 net.ipv6.conf.hetzner1.accept_ra_defrtr = 0 net.ipv6.conf.hetzner1.accept_ra_pinfo = 0 net.ipv6.conf.hetzner1.accept_ra_rt_info_max_plen = 0 net.ipv6.conf.hetzner1.accept_ra_rtr_pref = 0 net.ipv6.conf.hetzner1.accept_redirects = 0 net.ipv6.conf.hetzner1.accept_source_route = 0 net.ipv6.conf.hetzner1.autoconf = 0 net.ipv6.conf.hetzner1.dad_transmits = 1 net.ipv6.conf.hetzner1.disable_ipv6 = 0 net.ipv6.conf.hetzner1.force_mld_version = 0 net.ipv6.conf.hetzner1.force_tllao = 0 net.ipv6.conf.hetzner1.forwarding = 1 net.ipv6.conf.hetzner1.hop_limit = 64 net.ipv6.conf.hetzner1.max_addresses = 16 net.ipv6.conf.hetzner1.max_desync_factor = 600 net.ipv6.conf.hetzner1.mc_forwarding = 0 net.ipv6.conf.hetzner1.mldv1_unsolicited_report_interval = 10000 net.ipv6.conf.hetzner1.mldv2_unsolicited_report_interval = 1000 net.ipv6.conf.hetzner1.mtu = 1500 net.ipv6.conf.hetzner1.ndisc_notify = 0 net.ipv6.conf.hetzner1.optimistic_dad = 0 net.ipv6.conf.hetzner1.proxy_ndp = 0 net.ipv6.conf.hetzner1.regen_max_retry = 3 net.ipv6.conf.hetzner1.router_probe_interval = 60 net.ipv6.conf.hetzner1.router_solicitation_delay = 1 net.ipv6.conf.hetzner1.router_solicitation_interval = 4 net.ipv6.conf.hetzner1.router_solicitations = 3 net.ipv6.conf.hetzner1.suppress_frag_ndisc = 1 net.ipv6.conf.hetzner1.temp_prefered_lft = 86400 net.ipv6.conf.hetzner1.temp_valid_lft = 604800 net.ipv6.conf.hetzner1.use_tempaddr = 0 net.ipv6.neigh.hetzner1.anycast_delay = 100 net.ipv6.neigh.hetzner1.app_solicit = 0 net.ipv6.neigh.hetzner1.base_reachable_time_ms = 30000 net.ipv6.neigh.hetzner1.delay_first_probe_time = 5 net.ipv6.neigh.hetzner1.gc_stale_time = 60 net.ipv6.neigh.hetzner1.locktime = 0 net.ipv6.neigh.hetzner1.mcast_solicit = 3 net.ipv6.neigh.hetzner1.proxy_delay = 80 net.ipv6.neigh.hetzner1.proxy_qlen = 64 net.ipv6.neigh.hetzner1.retrans_time_ms = 1000 net.ipv6.neigh.hetzner1.ucast_solicit = 3 net.ipv6.neigh.hetzner1.unres_qlen = 31 net.ipv6.neigh.hetzner1.unres_qlen_bytes = 65536
我很绝望,有人能帮我解决吗?
胜利者
更新:
我很尴尬,但当我随机点击右侧的链接,搜索与我类似的问题时,我发现了这一点:
下面几行引起了我的注意(是的,我的提供商是 Hetzner Germany):
因为 Debian 太疯狂了,竟然还没有这个? – Michael Hampton♦ 2013 年 2 月 23 日 9:29
该文件由 hetzner 提供:“### Hetzner Online AG - installimage”但这绝对是我的错,一开始没有看到它:D。 – dexstar 2013 年 2 月 23 日 9:31
所以我尝试了他的解决方案,终于成功了!我在 /etc/network/interfaces 中添加了以下内容,但 Hetzner 的安装映像没有提供以下内容:
iface lo inet6 loopback