centos7 配置IPV6

根据人行要求,金融机构到2020年12月底,关键服务需要支持IPV6,涉及配置Centos服务器的IPV6地址,过程如下:

 

通过ip addr命令查看网卡名称,这里是ens192:
ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:50:56:ae:2d:57 brd ff:ff:ff:ff:ff:ff
inet 10.1.148.51/24 brd 10.1.148.255 scope global ens192
valid_lft forever preferred_lft forever
inet6 ...........

 

修改网卡文件,配置IPV6
vi /etc/sysconfig/network-scripts/ifcfg-ens192

TYPE=Ethernet
PROXY_METHOD=none
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6ADDR=fd00:0:3:2010:10:1:148:51
IPV6_DEFAULTGW=fd00:0:3:2010:10:1:148:1
IPV6_FAILURE_FATAL=no
NAME=ens192
DEVICE=ens192
IPADDR=10.1.148.51
PREFIX=24
GATEWAY=10.1.148.1
ONBOOT=yes

 

重启网络
service network restart

测试一下网关
ping6 fd00:0:3:2010:10:1:148:1

PING fd00:0:3:2010:10:1:148:1(fd00:0:3:2010:10:1:148:1) 56 data bytes
64 bytes from fd00:0:3:2010:10:1:148:1: icmp_seq=1 ttl=64 time=0.907 ms
64 bytes from fd00:0:3:2010:10:1:148:1: icmp_seq=2 ttl=64 time=1.36 ms
64 bytes from fd00:0:3:2010:10:1:148:1: icmp_seq=3 ttl=64 time=1.53 ms

 

测试一下地址:
ping6 fd00:0:3:2010:10:1:148:51

[root@localhost ~]# ping6 fd00:0:3:2010:10:1:148:51
PING fd00:0:3:2010:10:1:148:51(fd00:0:3:2010:10:1:148:51) 56 data bytes
64 bytes from fd00:0:3:2010:10:1:148:51: icmp_seq=1 ttl=64 time=0.069 ms
64 bytes from fd00:0:3:2010:10:1:148:51: icmp_seq=2 ttl=64 time=0.051 ms
64 bytes from fd00:0:3:2010:10:1:148:51: icmp_seq=3 ttl=64 time=0.049 ms
64 bytes from fd00:0:3:2010:10:1:148:51: icmp_seq=4 ttl=64 time=0.050 ms

 

到这里就完成了。

 

上一篇:AcWing 148 合并果子 题解 (贪心—Huffman树)


下一篇:【LeetCode】148.排序链表