3

Configuring IPv6 on Ubuntu

 2 years ago
source link: https://www.vultr.com/docs/configuring-ipv6-on-ubuntu
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
<?xml encoding="utf-8" ??>

Introduction

Vultr supports IPv6 for all VPS and Bare Metal instances. To enable IPv6, use either of these methods:

  • Select Enable IPv6 in the Additional Features section when deploying a new instance.
  • Use this guide to add IPv6 support, or add a secondary address, to a deployed instance.

This guide applies to Ubuntu 14.04 through 20.10.

Add IPv6 to an Instance

  1. IPv6 autoconfiguration depends on ICMP protocol. Please verify you haven't blocked ICMP in the OS firewall.
  2. Navigate to the Settings tab for the instance.
  3. Select the IPv6 menu.
  4. Click the Assign IPv6 Network button.

    Assign IPv6

  5. Restart the server via the Vultr Customer Portal. Important: rebooting via SSH doesn't activate the new network.

Ubuntu 17.10 through 20.10

Populate the /etc/netplan/10-ens3.yaml file with the following text.

network:
  version: 2
  renderer: networkd
  ethernets:
    ens3:
      dhcp4: yes
      addresses:
        - '2001:db8:1000::200/64'
  • The primary IPv6 is dynamic.
  • 2001:db8:1000::200 is the optional static secondary IPv6. Remove addresses: and the example IPv6 if a secondary address isn't required, or replace the example with an address in your IPv6 subnet.

Update networking or reboot.

netplan apply

Ubuntu 16.04 through 17.04

Dynamic configuration

For dynamic configuration, add the following lines to the /etc/network/interfaces file.

iface ens3 inet6 auto

Restart networking or reboot.

systemctl restart networking.service

Static configuration

For static configuration, add the following lines to the /etc/network/interfaces file.

iface ens3 inet6 static
address 2001:db8:1000::100
netmask 64
up /sbin/ip -6 addr add dev ens3 2001:db8:1000::200
  • 2001:db8:1000::100 is the primary IPv6, replace the example with an address in your IPv6 subnet.
  • 2001:db8:1000::200 is the optional secondary IPv6. Remove the example IP address line if a secondary address isn't required, or replace the example with an address in your IPv6 subnet.

Restart networking or reboot.

systemctl restart networking.service

Ubuntu 14.04

Dynamic configuration

For dynamic configuration, add the following lines to the /etc/network/interfaces file.

iface eth0 inet6 auto

Reboot the instance.

Static configuration

For static configuration, add the following lines to the /etc/network/interfaces file.

iface eth0 inet6 static
address 2001:db8:1000::100
netmask 64
up /sbin/ip -6 addr add dev eth0 2001:db8:1000::200
  • 2001:db8:1000::100 is the primary IPv6, replace the example with an address in your IPv6 subnet.
  • 2001:db8:1000::200 is the optional secondary IPv6. Remove the example IP address line if a secondary address isn't required, or replace the example with an address in your IPv6 subnet.

Reboot the instance.

IP forwarding

If you have IP forwarding enabled, such as when using your server as a VPN, add the following lines to /etc/sysctl.conf:

net.ipv6.conf.all.accept_ra=2
net.ipv6.conf.eth0.accept_ra=2

These variables default value is 1, which prevents IPv6 from working. To verify the status of IP forwarding, run:

# sysctl net.ipv4.ip_forward

More Information

Refer to specific network configuration examples on the instance's IPv6 information page.

Configuration Examples

Want to contribute?

You could earn up to $600 by adding new articles


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK