启动IPv6虚拟地址

网卡信息举例

[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]#

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值