centOS 7 x如何配置ipv6

2021-09-17 21:53:55 字數 2116 閱讀 4401

1.場景還原2.實現方案① 修改 /etc/modprobe.d/disable_ipv6.conf

vim /etc/modprobe.d/disable_ipv6.conf 修改前

alias net-pf-10 off

options ipv6 disable=1

修改後alias net-pf-10 off

options ipv6 disable=0

②修改 /etc/sysconfig/network

vim /etc/sysconfig/network 修改前

peerntp=no

networking_ipv6=no

gateway=139.255.255.0(一般不用修改,預設即可)

修改後peerntp=no

networking_ipv6=yes

gateway=139.255.255.0

③修改 /etc/sysconfig/network-scripts/ifcfg-eth0

vim /etc/sysconfig/network-scripts/ifcfg-eth0 修改前

device=eth0

onboot=yes

bootproto=static

ipaddr=10.10.10.1

netmask=255.255.254.0

修改後device=eth0

onboot=yes

bootproto=static

ipaddr=10.10.10.1

netmask=255.255.254.0

ipv6init=yes

ipv6_autoconf=yes

④修改 /etc/sysctl.conf

⑤建立系統在啟動時自動載入 ipv6 模組的指令碼

vim /etc/sysconfig/modules/ipv6.modules 指令碼內容

!/bin/sh

if [ ! -c /proc/net/if_inet6 ] ; then

exec /sbin/insmod /lib/modules/uname -r/kernel/net/ipv6/ipv6.ko

fi⑥重啟系統,載入 ipv6 模組

ifconfig | grep -i inet6

⑦申請 ipv6 位址

1.訪問 tunnelbroker.net 註冊乙個自己的賬號。

2.選擇 create regular tunnel 建立乙個到自己公網 ip 的通道。(經本人測試,tunnel servers 可用 tokyo, jp,los angeles, ca, us 可以配置,但實際網路環境不可用)

3.找到 example configurations,選擇作業系統對應的指令碼(centos 7.x 選擇 linux-net-tools),複製下來,在 linux 的控制台中執行指令碼。

複製整個指令碼在xshell命令終端執行;

ping6 ipv6位址測試一波

ok,到此ipv6基本上配置成功了;

⑧修改 /etc/init.d/network 網絡卡的啟動指令碼, 系統重啟時自動配置 ipv6 tunnel

vim /etc/init.d/network 在 touch /var/lock/subsys/network 之前新增以下指令碼

# 新增 ipv6 指令碼支援ifconfig sit0 upifconfig sit0 inet6 tunnel ::66.220.15.43ifconfig sit1 upifconfig sit1 inet6 add 2001:4e0:d:e60::2/64route -a inet6 add ::/0 dev sit1#修改結束

該指令碼是剛才註冊tunnelbroker.net自動生成的,現在每次重啟機器都可以自動分配好 ipv6 位址;

⑨最後一步,使用 aaaa 記錄設定 ipv6 網域名稱解析

模糊塊填寫的就是ipv6的位址;

3.測試ipv6訪問位址,輸入你的網域名稱進行測試

20171024140735509.png

2018-9-3 17:35 上傳

好了,今天就到此為止;

Centos7 x防火牆配置

1 檢視firewall服務狀態 2 檢視firewall的狀態 firewall cmd state3 開啟 重啟 關閉 firewalld.service服務 開啟 service firewalld start 重啟 service firewalld restart 關閉 service f...

CentOS 7 X 安全手記

一 安裝雲鎖 1 報錯 2 關閉selinux vim etc selinux config 將 selinux enforcing 改 selinux disabled 3 重啟系統 reboot now 二 centos7相關的操作 1 防火牆 firewall cmd 1 禁止被ping 禁止...

CentOS7 X磁碟掛載

假設掛載點為 www 假設磁碟為 dev vdc 假設磁碟只有卷 dev vdc1 該方案可能會丟失磁碟所有資料,操作前請先備份 磁碟已格式化 用過的磁碟 磁碟立即掛載 mkdir www mount dev vdc1 www 啟用開機掛載 獲取磁碟id ll dev disk by path lr...