大网数据广告活动
服务器运维问答

Debian 9.1: Can't disable IPv6 autoconfig

· 52CE 我爱测

I've updated a machine to Debian 9.1 and everything seems to be fine, however I can't disable IPv6 autoconfig. Background : I only want to use some specific IPv6 addresses on the machine that I'm defining in /etc/systemd/network/…

问题原文

原帖链接 · TCB13 · CC BY-SA 3.0

I've updated a machine to Debian 9.1 and everything seems to be fine, however I can't disable IPv6 autoconfig.

Background: I only want to use some specific IPv6 addresses on the machine that I'm defining in /etc/systemd/network/10-static-eth0.network:

[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

To disable IPv6 autoconfig I added the following at the end of /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

After rebooting there's no dynamic / autoconfig IPv6 address but after a while it appears on ip addr show:

inet6 2a04:52c0:xxxx:xxxx:xxxx:xxx:xxxx:1e3d/64 scope global mngtmpaddr noprefixroute dynamic 
   valid_lft 2590732sec preferred_lft 603532sec

How can I avoid this autoconfig IPv6 address and make sure only the static addresses get to work?

Thank you.

已采纳解答

原帖链接 · Pablo · CC BY-SA 3.0

I believe these addresses marked as mngtmpaddr and noprefixroute come from the IPv6 Privacy Extensions standard (RFC 4941) and are created by the kernel itself.

You should be able to turn that feature off adding

net.ipv6.conf.default.use_tempaddr=0
net.ipv6.conf.all.use_tempaddr=0
net.ipv6.conf.eth0.use_tempaddr=0

to your /etc/sysctl.conf

Hope it helps!

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-09-19)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。