Home » Questions » Computers [ Ask a new question ]

How to disable autoconfiguration on IPv6 in Linux?

How to disable autoconfiguration on IPv6 in Linux?

How can I permanently disable autoconfiguration of IPv6 in Linux? When I try to manually delete an address from an interface with:

Asked by: Guest | Views: 88
Total answers/comments: 3
Guest [Entry]

"Auto configuration can be disabled temporary for eth1 with:

sudo sysctl -w net.ipv6.conf.eth1.autoconf=0
sudo sysctl -w net.ipv6.conf.eth1.accept_ra=0

or for all interfaces with:

sudo sysctl -w net.ipv6.conf.all.autoconf=0
sudo sysctl -w net.ipv6.conf.all.accept_ra=0

Reenabling works by using 1 instead of 0 in the call.

Disabling it permanently can be done with an entry to /etc/sysctl.conf.
On Debian Etch (probably on newer too), without setting the accept_ra, the system will autoconfigure using the Link local adress (fe80..)

As Gart mentioned below, automatic address configuration and router discovery will be disabled if the host itself is a router and accept_ra is not 2, i.e

net.ipv6.conf.<iface|all|default>.forwarding=1

and

net.ipv6.conf.<iface|all|default>.accept_ra=0
or net.ipv6.conf.<iface|all|default>.accept_ra=1.

where iface is your interface"
Guest [Entry]

"The sysctl solution did not work for us on Ubuntu 18.04 Bionic.
We solved it by:

Editing /etc/netplan/01-netcfg.yaml, configure:

network:
...
ethernets:
eth0:
...
dhcp6: no
accept-ra: no

You may need to use your interface name instead of eth0.
After you save the file execute:

netplan apply or reboot

If you already have received an IPv6 IP from autoconfiguration and you want to remove it without rebooting, you can execute:

ip -6 addr del 1111:2222:1:0:aaaa:bbbb:cccc:dddd/64 dev eth0

Of course you need to replace the IP and device in this command."
Guest [Entry]

"You need to pay attention to tags in the address

inet6 xxxx:ffc8:1:20:ec4:7aff:fe0f:77e5/64 scope global dynamic mngtmpaddr noprefixroute

mngtmpaddr is created by IPv6 Privacy Extensions standard (RFC 4941) hence it will be necessary to disable the autoconf and tempaddr

sysctl -w net.ipv6.conf.all.autoconf=0
sysctl -w net.ipv6.conf.default.autoconf=0
sysctl -w net.ipv6.conf.default.use_tempaddr=0
sysctl -w net.ipv6.conf.all.use_tempaddr=0
sysctl -w net.ipv6.conf.eth0.use_tempaddr=0

also, you should check if the current flag is false with

/proc/sys/net/ipv6/conf/*/use_tempaddr
/proc/sys/net/ipv6/conf/*/autoconfg

to make changes persistent to reboot, add to the /etc/sysctl.conf net.ipv6.conf.all.autoconf=0 net.ipv6.conf.default.autoconf=0 net.ipv6.conf.default.use_tempaddr=0 net.ipv6.conf.all.use_tempaddr=0 net.ipv6.conf.eth0.use_tempaddr=0

also by last, if you are using netplan, seems that it may override it all. only solution I found was to disable RA, by adding the flag to /etc/netplan/xxx.yaml

accept-ra: false"
"You need to pay attention to tags in the address

inet6 xxxx:ffc8:1:20:ec4:7aff:fe0f:77e5/64 scope global dynamic mngtmpaddr noprefixroute

mngtmpaddr is created by IPv6 Privacy Extensions standard (RFC 4941) hence it will be necessary to disable the autoconf and tempaddr

sysctl -w net.ipv6.conf.all.autoconf=0
sysctl -w net.ipv6.conf.default.autoconf=0
sysctl -w net.ipv6.conf.default.use_tempaddr=0
sysctl -w net.ipv6.conf.all.use_tempaddr=0
sysctl -w net.ipv6.conf.eth0.use_tempaddr=0

also, you should check if the current flag is false with

/proc/sys/net/ipv6/conf/*/use_tempaddr
/proc/sys/net/ipv6/conf/*/autoconfg

to make changes persistent to reboot, add to the /etc/sysctl.conf net.ipv6.conf.all.autoconf=0 net.ipv6.conf.default.autoconf=0 net.ipv6.conf.default.use_tempaddr=0 net.ipv6.conf.all.use_tempaddr=0 net.ipv6.conf.eth0.use_tempaddr=0

also by last, if you are using netplan, seems that it may override it all. only solution I found was to disable RA, by adding the flag to /etc/netplan/xxx.yaml

accept-ra: false"