[root@localhost ~]# uname -a #查看系统内核版本
Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# cd /etc/sysconfig/network-scripts/ #切换到网卡所在目录
[root@localhost network-scripts]# pwd #查看当前所在路径
/etc/sysconfig/network-scripts
[root@localhost network-scripts]# ls #查看当前目录下资源
ifcfg-eno16777736 ifdown-eth ifdown-isdn ……
[root@localhost network-scripts]# vi ifcfg-eno16777736 #进入编辑模式添加如下配置
IPV6ADDR=240e:51:edff:eeee:1:2:0:f6/96 IPv6地址/前缀
IPV6_DEFAULTGW=240e:51:edff:eeee:1:2:: #网关
[root@localhost network-scripts]# cat ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=b4ed7b55-c3bc-4a68-a137-137fef95c470
DEVICE=eno16777736
ONBOOT=yes
DNS1=114.114.114.114
IPADDR=192.168.114.129
PREFIX=24
GATEWAY=192.168.114.2
IPV6ADDR=240e:51:edff:eeee:1:2:0:6/96
IPV6_DEFAULTGW=240e:51:edff:eeee:1:2:0:1
[root@localhost network-scripts]# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.114.129 netmask 255.255.255.0 broadcast 192.168.114.255
inet6 fe80::20c:29ff:fef7:8d21 prefixlen 64 scopeid 0x20<link>
inet6 240e:51:dbff:ffff:1:2:0:f6 prefixlen 96 scopeid 0x0<global>
ether 00:0c:29:f7:8d:21 txqueuelen 1000 (Ethernet)
RX packets 3470 bytes 309643 (302.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1716 bytes 259259 (253.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost network-scripts]# ping6 240e:51:dbff:ffff:1:2:0:f6 #用ping6 进行对本机ipv6进行测试
PING 240e:51:dbff:ffff:1:2:0:f6(240e:51:dbff:ffff:1:2:0:f6) 56 data bytes
64 bytes from 240e:51:dbff:ffff:1:2:0:f6: icmp_seq=1 ttl=64 time=0.834 ms
64 bytes from 240e:51:dbff:ffff:1:2:0:f6: icmp_seq=2 ttl=64 time=0.095 ms
64 bytes from 240e:51:dbff:ffff:1:2:0:f6: icmp_seq=3 ttl=64 time=0.073 ms
[root@localhost network-scripts]# ping6 ::1 #::1相当于127.0.0.1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.052 ms
64 bytes from ::1: icmp_seq=2 ttl=64 time=0.148 ms