To be a better coder
分类: LINUX
2020-06-17 10:56:16
首先打开linux对ipv6的支持:
1
2
3
|
#vi /etc/sysconfig/network
NETWORKING_IPV6=yes
IPV6_AUTOCONF=no
|
阿里云的镜像默认是禁用ipv6的,我们需要手动开启:
1
2
3
4
5
|
lsmod | grep ipv6 #查看内核中有没有ipv6模块
modprobe ipv6 #加载ipv6模块
vi /etc/modprobe.d/disable_ipv6.conf
#alias net-pf-10 off #注释掉
options ipv6 disable=0 #修改为0
|
检查内核中ipv6的设置:
1
2
3
4
5
6
7
|
sysctl -a | grep disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0
net.ipv6.conf.eth0.disable_ipv6 = 0
net.ipv6.conf.eth1.disable_ipv6 = 0
net.ipv6.conf.sit0.disable_ipv6 = 0
|
##########################################################
设置ipv6的网络,不是隧道,是网络。
编辑网卡地址:
1
2
3
|
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
IPV6INIT=yes
IPV6ADDR=2001:470:18:ac4::2/64
|
设置ipv6的网关:
1
2
|
#vi /etc/sysconfig/network
IPV6_DEFAULTGW=2001:470:19:ac4::/64
|
临时设置ipv6生效的办法:
1
2
|
ifconfig eth1 inet6 add 2001:470:18:ac4::2/64
route -A inet6 add default gw 2001:470:19:ac4::/64 dev eth1
|