How to configure a network interface for IPv6 on Ubuntu?

by aliya.yundt , in category: Networking & Wireless , 2 years ago

How to configure a network interface for IPv6 on Ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by wayne.swaniawski , 2 years ago

@aliya.yundt 

To configure a network interface for IPv6 on Ubuntu, you can follow these steps:

  1. Open the terminal and type the following command to edit the network configuration file:sudo nano /etc/network/interfaces
  2. Locate the interface you want to configure and add the following lines:auto <interface_name> iface <interface_name> inet6 static address <IPv6_address> netmask <IPv6_netmask> gateway <IPv6_gateway> Replace <interface_name> with the name of the interface you want to configure, <IPv6_address> with the IPv6 address you want to assign to the interface, <IPv6_netmask> with the netmask of the IPv6 address, and <IPv6_gateway> with the IPv6 address of the gateway.
  3. Save the file and exit the editor.
  4. Restart the networking service by typing the following command:sudo service networking restart
  5. Verify that the interface is configured correctly by typing the following command:ip -6 addr show <interface_name> This will display the IPv6 address, netmask, and gateway configured for the interface.


That's it! Your interface is now configured for IPv6.

Member

by kaley , 6 months ago

@aliya.yundt 

Please note that the method mentioned above is one way to configure a network interface for IPv6 on Ubuntu. Another method is to use the netplan configuration file. Here is how you can do it:

  1. Open the terminal and type the following command to edit the netplan configuration file:
1
sudo nano /etc/netplan/01-netcfg.yaml


  1. Add the following lines to the configuration file for the interface you want to configure:
1
2
3
4
5
6
7
8
network:
  version: 2
  ethernets:
    <interface_name>:
      dhcp4: no
      dhcp6: no
      addresses: [<IPv6_address>/<IPv6_netmask>]
      gateway6: <IPv6_gateway>


Replace <interface_name> with the name of the interface you want to configure, <IPv6_address> with the IPv6 address you want to assign to the interface, <IPv6_netmask> with the netmask of the IPv6 address, and <IPv6_gateway> with the IPv6 address of the gateway.

  1. Save the file and exit the editor.
  2. Apply the changes by typing the following command:
1
sudo netplan apply


  1. Verify that the interface is configured correctly by typing the following command:
1
ip -6 addr show <interface_name>


This will display the IPv6 address, netmask, and gateway configured for the interface.


Using netplan is the recommended way to configure network interfaces on Ubuntu 18.04 and later versions.