centos7重啟iptables時失敗铛嘱,通過systemctl status iptables.service查看錯誤信息暖释,內(nèi)容如下所示:
# *systemctl status iptables.service
— iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2018-01-10 05:11:42 EST; 4s ago
Process: 3994 ExecStop=/usr/libexec/iptables/iptables.init stop (code=exited, status=0/SUCCESS)
Process: 5236 ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=1/FAILURE)
Main PID: 5236 (code=exited, status=1/FAILURE)
Jan 10 05:11:42 master.example.com systemd[1]: Starting IPv4 firewall with i....
Jan 10 05:11:42 master.example.com iptables.init[5236]: iptables: Applying fi...
Jan 10 05:11:42 master.example.com iptables.init[5236]: Error occurred at lin...
Jan 10 05:11:42 master.example.com iptables.init[5236]: Try `iptables-restore...
Jan 10 05:11:42 master.example.com iptables.init[5236]: [FAILED]
Jan 10 05:11:42 master.example.com systemd[1]: iptables.service: main proces...E
Jan 10 05:11:42 master.example.com systemd[1]: Failed to start IPv4 firewall....
Jan 10 05:11:42 master.example.com systemd[1]: Unit iptables.service entered....
Jan 10 05:11:42 master.example.com systemd[1]: iptables.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
上面的錯誤是在啟動ipv4 firewall時失敗,可嘗試關(guān)閉firewalld服務(wù)在重啟iptables:
# service iptables save
# systemctl stop firewalld -- 關(guān)閉firewalld服務(wù)
# systemctl disable firewalld --設(shè)置開機(jī)禁用firewalld
# systemctl start iptables -- 啟動iptables
# systemctl status iptables --確認(rèn)iptables狀態(tài)
# systemctl enable iptables -- 設(shè)置iptables開機(jī)啟動
# systemctl status firewalld --確認(rèn)firewalld服務(wù)
除了使用上述的方法以外墨吓,啟動失敗的原因也可能是iptables的規(guī)則配置錯誤球匕。
可以check下/etc/sysconfig/iptables文件。