我已经更新了一台机器到Debian 9.1,似乎一切正常,但是我不能禁用IPv6自动configuration。
背景 :我只想在我在/etc/systemd/network/10-static-eth0.network定义的机器上使用一些特定的IPv6地址:
[Match] Name=eth0 [Network] Address=2a04:52c0:xxx:xxx::xxx/48 Address=2a04:52c0:xxx:xxx::xxx/48 Address=2a04:52c0:xxx:xxx::xx/48 Gateway=2a04:52c0:xxx::1 Address=5.2.xxx.xxx/25 Address=5.2.xxx.xxx/25 Address=5.2.xxx.xxx/25 Gateway=5.2.xxx.xxx
要禁用IPv6自动configuration,我在/etc/sysctl.conf的末尾添加了以下内容:
net.ipv6.conf.default.autoconf=0 net.ipv6.conf.all.autoconf=0 net.ipv6.conf.eth0.autoconf=0 net.ipv6.conf.default.accept_ra=0 net.ipv6.conf.all.accept_ra=0 net.ipv6.conf.eth0.accept_ra=0 net.ipv6.conf.default.accept_dad=0 net.ipv6.conf.all.accept_dad=0 net.ipv6.conf.eth0.accept_dad=0
重新启动后,没有dynamic/自动configurationIPv6地址,但过了一段时间它出现在ip addr show :
inet6 2a04:52c0:xxxx:xxxx:xxxx:xxx:xxxx:1e3d/64 scope global mngtmpaddr noprefixroute dynamic valid_lft 2590732sec preferred_lft 603532sec
我怎样才能避免这个自动configurationIPv6地址,并确保只有静态地址才能起作用?
谢谢。
我相信这些标记为mngtmpaddr和noprefixroute地址来自IPv6隐私扩展标准(RFC 4941) ,并由内核自己创build。
您应该能够closures该function添加
net.ipv6.conf.default.use_tempaddr=0 net.ipv6.conf.all.use_tempaddr=0 net.ipv6.conf.eth0.use_tempaddr=0
到你的/etc/sysctl.conf
希望能帮助到你!