Setting a static IPv6 address on Ubuntu 22.04 LTS helps your server stay reachable. Netplan is the tool you will use. Follow these easy steps.
Why Use a Static IPv6 Address?
A static IPv6 address does not change.
It helps your server always have the same address.
This is important for web servers, email servers, and remote access.
What You Need
- Ubuntu 22.04 LTS installed
- IPv6 working on your network
- Your IPv6 address, prefix (like /64), gateway, and DNS servers
- Root or sudo access
Step 1: Find Your Network Interface
Open a terminal.
Type:
ip a
Look for your network name, like ens33
, eth0
, or enp0s3
.
Step 2: Backup Your Netplan File
Before making changes, make a backup.
Type:
sudo cp /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.bak
Step 3: Edit the Netplan File
Open the file to edit:
sudo nano /etc/netplan/00-installer-config.yaml
Add or update your IPv6 settings.
Change the example values to match your info.
network:
version: 2
ethernets:
ens33:
dhcp6: no
addresses:
- 2001:db8::1001/64
gateway6: 2001:db8::1
nameservers:
addresses:
- 2001:4860:4860::8888
- 2001:4860:4860::8844
Tip: Make sure the spaces match the example. YAML needs correct indentation.
Step 4: Test and Apply
Test your new setup:
sudo netplan try
If it works, apply the change:
sudo netplan apply
Step 5: Check Your Address and Connection
Check your address:
ip -6 addr show
Test the connection:
ping6 google.com
Tips for Success
- Always backup before making changes.
- Write down your settings.
- Have console access in case you get locked out.
Now your server uses a static IPv6 address on Ubuntu 22.04 LTS with Netplan.
Your server will have a reliable address for all your needs.
Leave a Reply