remove iptables 後的補救措施
恩,慘痛的教訓。因為remove iptables會解除安裝很多系統組建,導致出現很多問題,比如無法上網,比如中文字型變成亂碼。但只要還沒重啟伺服器,還是有補救措施的。
在補救前仍要大喊三遍說明:
不要remove iptables
不要remove iptables
不要remove iptables
先放參考連結:https://unix.stackexchange.com/questions/121764/why-did-removing-iptables-break-my-network-access
簡單說,就是先找一臺乾淨的伺服器,在伺服器上使用:
yum install yum-utils
repoquery --whatrequires --installed --recursive iptables
第一個命令是安裝yum的一個工具
第二個命令是搜尋作為iptables的依賴有哪些元件
[[email protected] ~]# repoquery --whatrequires --installed --recursive iptables
NetworkManager-1:1.4.0-12.el7.x86_64
NetworkManager-team-1:1.4.0-12.el7.x86_64
NetworkManager-tui-1:1.4.0-12.el7.x86_64
NetworkManager-wifi-1:1.4.0-12.el7.x86_64
dhclient-12:4.2.5-47.el7.centos.x86_64
dracut-network-0:033-463.el7.x86_64
firewalld-0:0.4.3.2-8.el7.noarch
initscripts-0:9.49.37-1.el7.x86_64
iproute-0:3.10.0-74.el7.x86_64
iptables-0:1.4.21-17.el7.x86_64
kbd-0:1.15.5-12.el7.x86_64
kexec-tools-0:2.0.7-50.el7.x86_64
plymouth-0:0.8.9-0.26.20140113.el7.centos.x86_64
plymouth-scripts-0:0.8.9-0.26.20140113.el7.centos.x86_64
將上述依賴元件全部安裝一遍,我們在來看看網路是否恢復
[[email protected] /root]#systemctl status network
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: active (exited) since Mon 2018-12-03 22:36:54 CST; 4min 51s ago
Docs: man:systemd-sysv-generator(8)
Process: 23872 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS)
Process: 24001 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)
Dec 03 22:36:53 ha171 systemd[1]: Starting LSB: Bring up/down networking...
Dec 03 22:36:53 ha171 network[24001]: 正在開啟環回介面: [ 確定 ]
Dec 03 22:36:53 ha171 network[24001]: 正在開啟介面 enp2s0: 連線已成功啟用(D-Bus 活動路徑:/org/freedesktop/NetworkManager/ActiveConnection/1)
Dec 03 22:36:54 ha171 network[24001]: [ 確定 ]
Dec 03 22:36:54 ha171 systemd[1]: Started LSB: Bring up/down networking.
網路已經恢復正常
好了,大體補救的措施就是這樣,希望大家在執行remove前三思而行