Currently, IPv4 addresses are exhausted, but IPv6 addresses continue to flow. However, if the address is too large, it may be difficult to configure it. The following describes two methods to add IPv6 addresses in batches for CentOS, Fedora, and Redhat.
Suppose you want to add 2607: f0d0: 1002: 11: 10 to 2607: f0d0: 1002: 11: 50 41 IPv6 addresses in total
Method 1: Open/etc/rc. local and enter the command to add IPv6 addresses in batches.
Bash language:
# IP Alias
For ip in {10 .. 40}; do/sbin/ifconfig eth0 inet6 add 2607: f0d0: 1002: 11 ::: {ip}/64; done
Execute the command line and add it to rc. local. This will take effect after restart.
Method 2: Modify the/etc/sysconfig/network-script/ifcfg-eth0 and add the Secondary IPv6 address.
Bash language:
20176addr_secondaries = "2607: f0d0: 1002: 11: 10/64 \
2607: f0d0: 1002: 11: 11/64 \
2607: f0d0: 1002: 11: 12/64 \
2607: f0d0: 1002: 11: 13/64 \
2607: f0d0: 1002: 11: 14/64 ″
After adding the network, restart the network interface:
Bash language:
Service network restart
The preceding method adds IPv6 addresses in batches for CentOS, Redhat, and Fedora. Sometimes the newly added IPv6 address cannot be pinged immediately. wait a few minutes.