Introduction
IPv6 is the latest version of Internet Protocol. As the internet is running out of IPv4 addresses, the internet is slowly migrating towards the use of IPv6 addresses. IPv6 address is 128 bit long and provides a large number of address pools to choose from. It is more secure as it built-in IPSec protocol.
In this tutorial, we will learn how to assign an IPv6 address on Debian 10 “Buster” server.
Prerequisites
- Cloud VPS or Dedicated Server with Debian 10 installed.
- You must be logged in via SSH as a sudo or root user.
Step 1: Log in to shell using SSH
If you are not already logged into your remote server, login via SSH by following this guide.
Step 2: Find Network Interfaces
Run the following command to get the active network interfaces.
ip link show
As we can see in the above screenshot, lo is the loopback interface which is an internal virtual interface used by the computer to communicate with itself.
The second interface ens18 is the active Ethernet adapter which our computer is using to connect to the internet. Now that we have found the adapter interface, we will assign the static IPv6 on this interface. In your case, the adapter name can be different.
Step 3: Find the IP address assigned to the Interface
If you are a Snel user, you can go to the VPS dashboard and navigate to Network >> Interfaces.
Under interfaces, you will find the IP address assigned to the adapter.
Note that the example IP address is shown near 1, which is ff00:abab:1221:3000::190. The subnet mask will be 48 and Gateway will be fc00:abab:1221::1. DNS resolver servers are marked at 2 and 3. In your actual case, these addresses will be different.
If you are unsure about these values, feel free to contact Snel Support.
Step 4: Assign Static IPv6 Address
Edit the network configuration file by running the following command.
sudo nano /etc/network/interfaces
This file may look like the following.
If you have not set static IPv4 address, please follow the tutorial, How to Configure Static IPv4 on Debian 10.
Append the following IPv6 configuration at the end of the file.
iface ens18 inet6 static address ff00:abab:1221:3000::190 netmask 48 gateway fc00:abab:1221::1
After the change, it will look something like the following screenshot.
Save the file and exit from the editor.
Step 5: Restart Networking Service
Restart the networking service so that the updated configuration can be applied. Run the command.
sudo systemctl restart networking
Conclusion
In this tutorial, we have learned how to configure an IPv6 address on Debian 10 “Buster” server. Your server is now configured to use IPv6 address.
Hey Yavuz, maybe following addition might be useful:
1. it's also fine to not tell the netmask, but write the address as `ff00:abab:1221:3000::190/48`
2. after `systemctl`, check `ip a`. If interface is down, it might make sense to reboot the computer / server. (if `ip a` doesn't work, consider to `apt-get instal net-utils`)
Those are all useful additions, thank you for your contribution!