1

Why I cannot disable IPv6 autoconfiguration even if the sysctl values are set to this?

net.ipv6.conf.default.autoconf = 0
net.ipv6.conf.default.accept_ra = 0
net.ipv6.conf.all.accept_ra = 0
net.ipv6.conf.all.autoconf = 0
net.ipv6.conf.enp2s0.accept_ra = 0
net.ipv6.conf.enp2s0.autoconf = 0
net.ipv6.conf.enp2s0.use_tempaddr = 0
net.ipv6.conf.all.use_tempaddr = 0
net.ipv6.conf.default.use_tempaddr = 0

Thank you for your help.

Seolh
  • 11

2 Answers2

1

For reasons I am unclear about, I found that netplan needed an explicit configuration for accept_ra regardless of what was set in sysctl values, for example:

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      accept-ra: false
      addresses:
        - xxx.xxx.xx.xx/22

And apply the new config with netplan try. No reboot was required.

I was using Ubuntu 18.04 but I assume 20.04 would be the same.

TommyPeanuts
  • 1,147
0

If you're using Netplan (which Ubuntu does by default since Ubuntu 18.04) and just want to disable privacy addresses (RFC 8981, previous RFC 4941), then in your Netplan configuration file (e.g. /etc/netplan/00-installer-config.yaml), set the ipv6-privacy parameter to false/no for the network interface in question, such as in the following example:

# This is the network config written by 'subiquity'
network:
  version: 2
  ethernets:
    eth0:
      accept-ra: yes
      ipv6-privacy: no

If you neither want to use SLAAC in response to receipt of an RA, nor DHCPv6, then you should set accept-ra to false/no instead. You will then have to set addresses statically via the addresses list, and routes manually via the routes object.

If you want to use receipt of an RA to set routes, but not to set addresses via SLAAC, then you should leave accept-ra unspecified entirely and rely on sysctl to configure the desired behaviour; see the documentation (from the section that the first link above points to, emphasis mine):

  • accept-ra (boolean)

Accept Router Advertisement that would have the kernel configure IPv6 by itself. When enabled, accept Router Advertisements. When disabled, do not respond to Router Advertisements. If unset use the host kernel default setting.

Jivan Pal
  • 157