网卡信息举例
[root@xxx ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 40:C8:F0:6F:AD:B5
inet addr:10.153.84.178 Bcast:10.153.85.255 Mask:255.255.252.0
inet6 addr: 2200::ae62:206/64 Scope:Global => 这些带Global的是可用的IPv6地址
inet6 addr: 2200::ae62:207/64 Scope:Global
inet6 addr: 2200::ae62:204/64 Scope:Global
inet6 addr: 2200::ae62:205/64 Scope:Global
inet6 addr: 2200::ae62:202/64 Scope:Global
inet6 addr: 2200::ae62:203/64 Scope:Global
inet6 addr: 2200::ae62:201/64 Scope:Global
inet6 addr: 2200::ae62:178/64 Scope:Global
inet6 addr: fc60::42c8:f0ff:fe6f:adb5/64 Scope:Link => 这个带Link的类似于IPv4的MAC地址
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:19624572 errors:0 dropped:0 overruns:0 frame:0
TX packets:32685058 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4362632421 (4.0 GiB) TX bytes:45306448685 (42.1 GiB)
……
IPv6地址参考阅读
IPv6地址格式简介以及常见的IP地址 https://blog.csdn.net/u011003120/article/details/88398371
IPv6地址格式 https://www.jianshu.com/p/3c8a4cce9cd1
===========================================
起停IPv4虚拟IP的命令,eg:
ifconfig eth0:1 10.153.84.201/16 up
ifconfig eth0:1 10.153.84.201/16 down
起停IPv6虚拟IP的命令,eg:
ifconfig eth0 inet6 add 2200::ae62:201/64
ifconfig eth0 inet6 del 2200::ae62:201/64
如果需要批量启动虚拟IPv6,且重启不丢失可以写入如下行至网卡文件,然后重启网络
IPV6ADDR_SECONDARIES="<ipv6 addr1>/<prefix> \
<ipv6 addr1>/<prefix> \
<ipv6 addr2>/<prefix> \
……
<ipv6 addr3>/<prefix> "
IPV6_DEFAULTGW=<ipv6 addr gw>
以下是一个例子
[root@xxx network-scripts]# cat ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=10.153.84.178
NETMASK=255.255.252.0
GATEWAY=10.153.82.1
BONDING_OPTS="mode=1 miimon=100"
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6ADDR=2200::ae62:178
IPV6ADDR_SECONDARIES="2200::ae62:201/64 \
2200::ae62:202/64 \
2200::ae62:203/64 \
2200::ae62:204/64 \
2200::ae62:205/64 \
2200::ae62:206/64 \
2200::ae62:207/64"
IPV6_DEFAULTGW=2100::1
[root@xxx network-scripts]#