How to configure IPv6 on Linux

There are two versions of IP addresses: IPv4 and IPv6. IPv4 was created in 1983. It uses a 32-bit address space. It provides 4,294,967,296 (232) unique IP addresses. These IP addresses were sufficient to meet the requirements of that time. In modern times, where computers, laptops, servers, smartphones, tablets, lightbulbs, plugs, security cameras, and all other IoT devices require an IP address, these IP addresses are inadequate to provide a unique IP address for each device. To meet the requirements of modern networks, IPv6 was created in 1998. It uses a 128-bit address space. It provides 2128 (3.4 x 1038 addresses) IP addresses that are sufficient to provide a unique IP address for all devices of modern networks. This tutorial explains how to configure and manage IPv6 addresses on Linux.

The NetworkManager service manages network configurations. It is part of the NetworkManager utility. The NetworkManager utility offers three tools to manage interfaces and their configurations. These tools are the nmcli, nmtui, and nm-connection-editor. The nmcli is a command line utility. The nmtui is a curses-based utility. The nm-connection editor is a graphical tool. You can use anyone you prefer to configure and manage the IP configuration on interfaces. Along with these tools, you need one more tool called the ip tool to view and troubleshoot the configuration.

Managing IPv6 address with the nmcli

NetworkManager allows us to create multiple connections for an interface. A connection is a collection of all the settings the interface needs to connect with the network. You can create separate connections for both IPv4 and IPv6 networks.

The following command lists all connections.

#nmcli connection show

The following command adds a new IPv6 connection.

nmcli command

To apply the new connection, you need to restart the connection. The following command restarts the connection.

#nmcli connection down [connection-name]
#nmcli connection up [connection-name]

connection restart

Use the 'ip address show' command to verify the new connection.

verify nmcli ip update

Managing IPv6 with the nmtui utility

The following command starts the nmtui utility.

nmtui

Select the 'Edit a connection' option on the first screen.

edit a connection

The next screen lists all existing connections in the left pane and management options in the right pane.

To create a new connection, select the New option from the right pane. To edit an existing connection, select the connection from the left pane and use the Edit option from the right pane.

new connection

The next screen displays all connection-related options. If you have selected the New option on the previous screen, you will see all settings empty on this screen. But if you have selected the Edit option, you will see all configured values on this screen.

default ip configuration

Configure or update the IPv6 address, select OK, and press the Enter key.

update ip config

Use the Back button to return to the main screen.

back

Select the 'Activate a Connection' option

activate a connection

Select the connection you created or updated from the left pane and deactivate it from the right pane.

deactivate

Activate it again. It will restart the connection.

activate

Use the Back button to return to the main screen.

back button

Quit the nmtui utility.

quit

Use the ip addr show command to view the new or updated IPv6 configuration. By default, it lists the configuration of all interfaces. To view the configuration of a single interface, specify the interface name as an argument.

show ip address

Managing IPv6 with the nm-connection-editor tool

The following command starts the nm-connection-editor.

nm-connection-editor

The first screen lists all interfaces and their connections. It has three options at the bottom bar. These options are Add, Remove, and Edit. The Add option adds a new connection. The Remove option removes the selected connection. The Edit option edits the selected connection.

add or edit connection

If you click the Add or Edit options, the next screen allows you to configure/update connection settings.

default ipv6 setting

Add or update the IPv6 configuration and close the nm-connection-editor.

update ipv6 setting

The nm-connection-editor has no option to restart the connection. Use the nmcli command or nmtui utility to restart the connection. After that, use the ip addr command again to verify the new IPv6 configuration.

show ip addr show

Key points:-

  • NetworkManager manages network interfaces and their connections.
  • NetworkManager includes three tools to manage connections: nmcli, nmtui, and nm-connection-editor.
  • All three tools support both IP versions.
  • You can use the ip tool to verify and troubleshoot the IP configuration.

ComputerNetworkingNotes Linux Tutorials How to configure IPv6 on Linux