Linux(centos6/7/8)配置IPV6
- 威海服務(wù)器/VPS 威海IPV6
- 3039
一、Linux系統(tǒng)
1.登錄系統(tǒng)
具體操作打開SecureCRT軟件,點(diǎn)擊快速連接輸入服務(wù)器IPv6地址、端口號、用戶名,再次點(diǎn)擊連接,輸入密碼,確認(rèn)登錄服務(wù)器。
1.png
2.png
2.確認(rèn)系統(tǒng)是否支持IPv6,顯示0表示應(yīng)支持
[root@localhost ~]# sysctl -a | grep ipv6.*disable
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
如果顯示為1,可以修改/etc/sysctl.conf
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
然后重載配置文件/etc/sysctl.conf 使文件內(nèi)容生效
sysctl -p
再次輸入ifconfig查看系統(tǒng)已支持IPv
3.配置IPv6地址,用vi等編輯器打開
/etc/sysconfig/network-scripts/ifcfg-eth0,添加以下三行:(注:紅色部分根據(jù)實(shí)際情況進(jìn)行修改。)
IPV6INIT=yes----初始化IPv6地址
IPV6ADDR=2400:a480:f:413:116:255:249:39----填寫服務(wù)器IPv6地址。
IPV6_DEFAULTGW=2400:a480:f:413::1----填寫服務(wù)器IPv6網(wǎng)關(guān)。
8.png
添加完之后,輸入:wq 保存退出。
重啟網(wǎng)絡(luò)服務(wù),輸入命令:service network restart
9.png
添加IPv6 DNS,用vi等編輯器打開/etc/resolv.conf,添加以下一行:
nameserver 2001:da8:202:10::37
10.png
添加完之后,輸入:wq 保存退出。
4.測試系統(tǒng)IPv6網(wǎng)絡(luò)連通性
輸入以下命令進(jìn)行測試:ping6 -c 4 ipv6.tsinghua.edu.cn
11.png
來源:景安