CentOS 环境下 IPv6设置方法:
1)/etc/sysconfig/network 打开/关闭网络配置
添加:
NETWORKING_IPV6=yes 打开IPv6
IPV6_AUTOCONF=no 如果不喜欢自动获取地址,选择”no”
2) /etc/sysconfig/network-scripts/ifcfg-eth0 配置IP/IPv6地址,网关等
IPV6INIT=yes 网卡初始化IPv6协议栈
IPV6ADDR=2001:250:4000:2000::53 配置IPv6地址
IPV6_DEFAULTGW=2001:250:4000:2000::1 配置IPv6网关
3) service network restart 重启网络服务,使配置生效
测试:
ping6 ipv6.google.com
PING ipv6.google.com(2404:6800:8002::69) 56 data bytes
64 bytes from 2404:6800:8002::69: icmp_seq=0 ttl=50 time=99.4 ms
64 bytes from 2404:6800:8002::69: icmp_seq=1 ttl=50 time=99.2 ms
64 bytes from 2404:6800:8002::69: icmp_seq=2 ttl=50 time=98.1 ms