Step 1: Check for IPv6 Support
Before configuring IPv6 on your Ubuntu machine, it is important to verify that your network interface supports IPv6. You can do this by running the following command:
ip a | grep inet6
If you see an IPv6 address, your network interface supports IPv6. If not, you will need to enable IPv6 support or update your network drivers.
Step 2: Configure the Network Interface
The network interface configuration for IPv6 on Ubuntu is managed within the /etc/network/interfaces file or by using the netplan utility, depending on your system's configuration. For systems using netplan, the configuration files are located in /etc/netplan/.
Edit the appropriate configuration file to define your IPv6 settings. Here is an example configuration using static IPv6 addressing with netplan:
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
dhcp4: no
dhcp6: no
addresses:
- 2001:db8::10/64
gateway6: 2001:db8::1
nameservers:
addresses: [2001:db8::53, '8.8.8.8']
Replace enp3s0 with your actual network interface name, and 2001:db8::10/64 with your IPv6 address and prefix. Also, set the appropriate IPv6 gateway and DNS server addresses.
Step 3: Apply the Configuration
After editing the configuration file, apply the changes by running:
sudo netplan apply
This will apply your new network settings immediately. You can verify that your IPv6 address has been assigned by running:
ip -6 addr
Step 4: Test IPv6 Connectivity
Now that your IPv6 address is configured, it's important to test the connectivity. You can use the ping6 command to ping an IPv6 address:
ping6 2001:db8::1
Replace 2001:db8::1 with the IPv6 address you want to test. Successful replies indicate that your IPv6 configuration is working correctly.
Step 5: Configure IPv6 Firewall Rules
Security is vital for any network configuration. Ensure that you configure your firewall to allow or deny IPv6 traffic according to your policy. Ubuntu uses ufw (Uncomplicated Firewall) to manage firewall settings. To enable IPv6 support in ufw, edit the /etc/default/ufw file and set IPV6=yes.
After enabling IPv6 in ufw, you can add your firewall rules as needed, such as:
sudo ufw allow from 2001:db8::/64
Do not forget to enable the firewall with sudo ufw enable after adding your rules.
Sumber:
https://reintech.io/blog/configuring-ipv6-network-ubuntu-22