码迷,mamicode.com
首页 > Web开发 > 详细

Loaded:loaded(/usr/lib/systemd/system/iptables.service;enabled)Active: inactive

时间:2016-01-17 00:01:57      阅读:254      评论:0      收藏:0      [点我收藏+]

标签:active: inactive

[root@localhost ~]# service iptables start

Redirecting to /bin/systemctl start  iptables.service

[root@localhost ~]# /bin/systemctl start  iptables.service

[root@localhost ~]# 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)

   Active: inactive (dead)

         start condition failed at 2016-01-16 20:06:38 CST; 9s ago

615 09:00:49 localhost.localdomain systemd[1]: Started IPv4 firewall with...

623 09:24:07 localhost.localdomain systemd[1]: Stopped IPv4 firewall with...

623 09:24:17 localhost.localdomain systemd[1]: Stopped IPv4 firewall with...

623 09:31:26 localhost.localdomain systemd[1]: Stopped IPv4 firewall with...

623 09:31:35 localhost.localdomain systemd[1]: Stopped IPv4 firewall with...

623 10:54:34 localhost.localdomain systemd[1]: Started IPv4 firewall with...

623 10:54:42 localhost.localdomain systemd[1]: Started IPv4 firewall with...

114 21:11:24 localhost.localdomain systemd[1]: Started IPv4 firewall with...

116 20:06:24 localhost.localdomain systemd[1]: Started IPv4 firewall with...

116 20:06:38 localhost.localdomain systemd[1]: Started IPv4 firewall with...

[root@localhost ~]#

 

解决办法:

[root@localhost ~]# cd /etc/sysconfig

[root@localhost sysconfig]# ls

atd              ip6tables-config  nfs           saslauthd

authconfig       iptables-config   nfs~           selinux

cbq              iptables-config~  pluto         sendmail

console          irda              prelink        smartmontools

crond            irqbalance        radvd          sshd

ebtables-config  kernel            raid-check     svnserve

firewalld        libvirtd          rdisc          sysstat

glusterd         libvirt-guests    readonly-root  sysstat.ioconf

glusterfsd       man-db            rpcbind        system-config-users

grub             modules           rsyncd         virtlockd

htcacheclean     netconsole        rsyslog        vncservers

httpd            network           run-parts      wpa_supplicant

init             network-scripts   samba

[root@localhost 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/systemctlstart  iptables.service

查看状态,启动成功

[root@localhost sysconfig]#service iptablesstatus

Redirecting to /bin/systemctl status  iptables.service

iptables.service - IPv4 firewall withiptables

  Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled)

  Active: active (exited) since 2016-01-16 16:50:17 CST; 3h 29min ago

 Process: 24462 ExecStop=/usr/libexec/iptables/iptables.init stop(code=exited, status=0/SUCCESS)

 Process: 24596 ExecStart=/usr/libexec/iptables/iptables.init start(code=exited, status=0/SUCCESS)

 

116 16:50:17 localhost.cs1cloud.internal iptables.init[24596]: iptabl...

116 16:50:17 localhost.cs1cloud.internal systemd[1]: Started IPv4 fir...

116 16:50:23 localhost.cs1cloud.internal systemd[1]: Started IPv4 fir...

 

查看端口号,3306端口已经打开

[root@localhost ~]#iptables -L -n

Chain INPUT (policy ACCEPT)

target    prot opt source              destination

ACCEPT    all  --  0.0.0.0/0            0.0.0.0/0

ACCEPT    all  --  0.0.0.0/0            0.0.0.0/0

ACCEPT    tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22

ACCEPT    tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:3306

 

Chain FORWARD (policy ACCEPT)

target    prot opt source               destination

 

Chain OUTPUT (policy ACCEPT)

target    prot opt source              destination


本文出自 “DOSOM” 博客,谢绝转载!

Loaded:loaded(/usr/lib/systemd/system/iptables.service;enabled)Active: inactive

标签:active: inactive

原文地址:http://8656934.blog.51cto.com/8646934/1735636

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!