前面一篇文章介绍了<a target="_blank" href="http://manager.blog.useasp.net/archive/2015/10/11/Multiple-ip-address-bind-on-one-card-in-linux.aspx">如何给linux网卡配置多个ipv4地址</a>,这里将介绍Linux网卡配置多个IPv6地址
(这里以绑定IP到eth1为例,其它网卡的话修改相应的文件名即可)
/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1 //绑定IP段的网卡名称
BOOTPROTO=static //协议为静态,用none也可以
ONBOOT=yes //开机启用此网卡
HWADDR=00:1c:49:18:32:6a //MAC地址
NETMASK=255.255.255.0
IPADDR=192.168.1.14
TYPE=Ethernet
USERCTL=no
PEERDNS=yes
IPV6INIT=yes
IPV6ADDR=fc00:502::c0a8:10e //IPv6 address
IPV6ADDR_SECONDARIES=fc00:502::c0a8:10f //second ipv6 address
IPV6PREFIX=64 //the prefix is 64
IPV6_DEFAULTGW=fc00:502::ca8:13 //default gateway
保存退出,然后重启网络:
[root@lc /]# service network restart
用ifconfig查看是否配置成功:
eth1 Link encap:Ethernet HWaddr 00:1C:49:18:32:6A
inet addr:10.15.1.14 Bcast:10.15.1.255 Mask:255.255.255.0
inet6 addr: fe80::021c:49ff:fe18:326a/64 Scope:Link
inet6 addr: fc00:502::a0f:10e/64 Scope:Global
inet6 addr: fc00:502::a0f:10f/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:75150 errors:0 dropped:0 overruns:0 frame:0
TX packets:47345 errors:0 dropped:0 overruns:0 carrier:1
collisions:0 txqueuelen:1000
RX bytes:7195527 (6.8 MiB) TX bytes:4920915 (4.6 MiB)
Interrupt:66