The adoption of IPv6 addresses has resolved the issue of limited IP address resources, facilitating the growth and application of the internet and overcoming obstacles to the connectivity of various devices. Below, we demonstrate how to set up an IPv6 address on cloud servers using various Linux operating systems as examples.
Assuming the network adapter is named ens3. Modify the content of the file /etc/sysconfig/network-scripts/ifcfg-ens3 as follows.
TYPE="Ethernet"
DEVICE="ens3"
ONBOOT="yes"
BOOTPROTO="dhcp"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6ADDR_SECONDARIES="2001:db8:1000::100 2001:db8:1000::200"
The primary IPv6 address is 2001:db8:1000:100, set dynamically using DHCP, and the secondary IPv6 address is 2001:db8:1000::200. If the secondary IPv6 is not required, the line IPV6ADDR_SECONDARIES can be removed.
Restart the network or reboot the operating system.
nmcli con load /etc/sysconfig/network-scripts/ifcfg-ens3
nmcli con up 'System ens3'
Modify the content of the file /etc/sysconfig/network-scripts/ifcfg-eth0 as follows.
IPV6INIT="yes"
IPV6ADDR="2001:db8:1000::100/64"
IPV6_AUTOCONF="yes"
IPV6ADDR_SECONDARIES="2001:db8:1000::200/64"
The primary IPv6 address is 2001:db8:1000:100, and the secondary IPv6 address is 2001:db8:1000::200, set statically. If the secondary IPv6 is not required, remove the IPV6ADDR_SECONDARIES line.
Restart the network or reboot the operating system.
service network restart
Assuming the network adapter is named ens3. Modify the content of the file /etc/netplan/10-ens3.yaml as follows.
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: yes
addresses:
- '2001:db8:1000::200/64'
The primary IPv6 address is 2001:db8:1000:100, set dynamically using DHCP, and the secondary IPv6 address is 2001:db8:1000::200. If the secondary IPv6 is not required, the addresses section can be removed.
Restart the network or reboot the operating system.
netplan apply
Assuming the network adapter is named ens3. Add the following code to the /etc/network/interfaces file.
For dynamic settings:
iface ens3 inet6 auto
For static settings:
iface ens3 inet6 static
address 2001:db8:1000::100
netmask 64
up /sbin/ip -6 addr add dev ens3 2001:db8:1000::200
The primary IPv6 address is 2001:db8:1000:100, set dynamically using DHCP, and the secondary IPv6 address is 2001:db8:1000::200. If the secondary IPv6 is not required, remove the last line.
Restart the network or reboot the operating system.
systemctl restart networking.service
Assuming the network adapter is named ens3. Modify the content of the file /etc/sysconfig/network-scripts/ifcfg-ens3 as follows.
nmcli con mod 'Wired connection 1' ipv6.method 'auto' ipv6.addresses ''
nmcli con mod 'Wired connection 1' +ipv6.addresses '2001:db8:1000::200/128'
nmcli con up 'Wired connection 1'
The primary IPv6 address is 2001:db8:1000:100, set dynamically using DHCP, and the secondary IPv6 address is 2001:db8:1000::200. If the secondary IPv6 is not required, remove the second line.
Restart the network or reboot the operating system.
systemctl restart network.service
Add the following code to the /etc/rc.conf file.
For dynamic settings:
ifconfig_vtnet0_ipv6="inet6 accept_rtadv"
ipv6_activate_all_interfaces="YES"
rtsold_enable="YES"
rtsold_flags="-aF"
For static settings:
rtsold_enable="YES"
ipv6_activate_all_interfaces="YES"
rtsold_flags="-aF"
ifconfig_vtnet0_ipv6="inet6 2001:db8:1000::100 prefixlen 64"
ifconfig_vtnet0_alias0="inet6 2001:db8:1000::200 prefixlen 64"
The primary IPv6 address is 2001:db8:1000:100, set dynamically using DHCP, and the secondary IPv6 address is 2001:db8:1000::200. If the secondary IPv6 is not required, remove the last line.
Restart the network or reboot the operating system.
service rtsold start
23-02-2024 02:02:07
22-02-2024 03:19:32
22-02-2024 03:16:03
22-02-2024 03:14:03
22-02-2024 03:11:58