Centos iptables 启动错误
在启动防火墙时候出现的问题
[root@localhost sysconfig]# service iptables start
Redirecting to /bin/systemctl start iptables.service
Job for iptables.service failed because the control process exited with error code. See "systemctl status iptables.service" and "journalctl -xe" for details.
[root@localhost sysconfig]# service iptables status
Redirecting to /bin/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 五 2017-07-28 10:47:21 CST; 3s ago
Process: 3961 ExecStop=/usr/libexec/iptables/iptables.init stop (code=exited, status=0/SUCCESS)
Process: 4147 ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=1/FAILURE)
Main PID: 4147 (code=exited, status=1/FAILURE)
7月 28 10:47:21 localhost.localdomain systemd[1]: Starting IPv4 firewall with iptables...
7月 28 10:47:21 localhost.localdomain iptables.init[4147]: iptables: Applying firewall rules: iptables-restore...ied
7月 28 10:47:21 localhost.localdomain iptables.init[4147]: Error occurred at line: 11
7月 28 10:47:21 localhost.localdomain iptables.init[4147]: Try `iptables-restore -h' or 'iptables-restore --he...on.
7月 28 10:47:21 localhost.localdomain iptables.init[4147]: [失败]
7月 28 10:47:21 localhost.localdomain systemd[1]: iptables.service: main process exited, code=exited, status=...LURE
7月 28 10:47:21 localhost.localdomain systemd[1]: Failed to start IPv4 firewall with iptables.
7月 28 10:47:21 localhost.localdomain systemd[1]: Unit iptables.service entered failed state.
7月 28 10:47:21 localhost.localdomain systemd[1]: iptables.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
解决办法:
[root@localhost ~]# cd /etc/sysconfig
将iptables-config改为iptables
[root@localhost sysconfig]# mv iptables-config iptables
命令初始化配置文件
[root@localhost sysconfig]#iptables-save >/etc/sysconfig/iptables
然后重启防火墙,执行添加规则命令
[root@localhost sysconfig]#iptables -I INPUT-p tcp –dport 3306 -j ACCEPT
重新启动防火墙
[root@localhost sysconfig]#/bin/systemctl start iptables.service
查看状态,启动成功
[root@localhost sysconfig]#service iptablesstatus
Redirecting to /bin/systemctl status iptables.service
查看端口号,3306端口已经打开
- 点赞
- 收藏
- 关注作者
评论(0)