I have a VPS server running Ubuntu 18.04 which has a /64 subnet of IPv6 addresses. For the purpose of this post, let's call it 2601:aaaa:aaaa:aaaa::/64. The VPS website says I can use any address within this subnet, however the server has an automatically assigned address of 2601:aaaa:aaaa:aaaa:xxxx:xxxx:xxxx:xxxx. I have configured my netplan to use a static IPv6, which is 2601:aaaa:aaaa:aaaa::1, however it looks like that did not completely work, as when I type ifconfig, I see two public IPv6 addresses: the IP address I configured, and the automatically assigned one as well. And I notice that the server is still using the automatically assigned IP. If I run "/sbin/ip -6 addr del 2601:aaaa:aaaa:aaaa:xxxx:xxxx:xxxx:xxxx/64 dev ens3" and then run ifconfig, the automatically assigned IP is gone and the server uses the one I assigned, but the automatically assigned one reappears on its own after a few minutes or after rebooting. How can I permanently get the server to use the IPv6 that I assigned? Here's what I have tried: Editing netplan, changing config to disable ipv6 privacy addresses, disabling router advertisements (this did not work as I needed an ipv6 gateway, which my VPS provider would not provide to me)

Here is my netplan:

  version: 2
  renderer: networkd
      dhcp4: no
      dhcp6: no
      addresses: [xxx.xxx.xxx.xxx/23,'2601:aaaa:aaaa:aaaa::1/64']
      gateway4: xxx.xxx.xxx.1
        addresses: [My provider's IP]
      - to:
        via: [My provider's IP]
        metric: 100
  • Try removing your manual IP and pinging it. Usually when an automatic assigned IP appears after assigning a manual, it's due to a detected conflict. – duct_tape_coder Nov 14 '19 at 2:57

You want to stop accepting Router Announcement. I know nothing about Ubuntu and the configuration file you are using, but if you are using systemd-networkd, you can stop it with IPv6AcceptRA=no under the [Network] section of the .network file that manages your NIC. If you are NOT (not even behind the scene; as I see renderer: networkd), running one of the following should do:

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

or even just

sysctl -w net.ipv6.conf.ens3.accept_ra=0

(Put either of them, without sysctl -w, to /etc/sysctl.conf or /etc/sysctl.d/some_name.conf, should make the setting persistent among boots)

You may want to check the current value of net.ipv6.conf.ens3.accept_ra (with sysctl but without -w and =0) first to see if it's the kernel (instead of systemd-networkd) that has been handling Router Announcement. If it's already 0, then likely it's systemd-neworkd that has been doing the job.

EDIT: looks like you can add accept-ra: no to stop it

EDIT 2: The documentation states that If unset use the host kernel default setting., so maybe sysctl is what you need after all. But AFAIK, systemd-networkd always takes over the job as long as it is configured to manage an interface, at least with a recent version of it. But I guess accept-ra: no would do anyway, supposing that stops both the kernel and systemd-networkd from accepting RA.

See also: RFC 4862, systemd.network(5), ip-sysctl.txt

  • Thank you for the help, it worked after disabling router announcement – Computer_User Nov 15 '19 at 3:04
  • No problem. If it solved your problem, you can mark it as the solution. – Tom Yan Nov 15 '19 at 3:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.