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

[iyunv@localhost ~]# service iptables start

Redirecting to /bin/systemctl start  iptables.service

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

[iyunv@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

6月15 09:00:49 localhost.localdomain systemd[1]: Started IPv4 firewall with...

6月23 09:24:07 localhost.localdomain systemd[1]: Stopped IPv4 firewall with...

6月23 09:24:17 localhost.localdomain systemd[1]: Stopped IPv4 firewall with...

6月23 09:31:26 localhost.localdomain systemd[1]: Stopped IPv4 firewall with...

6月23 09:31:35 localhost.localdomain systemd[1]: Stopped IPv4 firewall with...

6月23 10:54:34 localhost.localdomain systemd[1]: Started IPv4 firewall with...

6月23 10:54:42 localhost.localdomain systemd[1]: Started IPv4 firewall with...

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

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

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

[iyunv@localhost ~]#

解决办法:

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

[iyunv@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

[iyunv@localhost sysconfig]#

将iptables-config改为iptables

[iyunv@localhost sysconfig]# mv iptables-config iptables

命令初始化配置文件

[iyunv@localhost sysconfig]#iptables-save >/etc/sysconfig/iptables

然后重启防火墙,执行添加规则命令

[iyunv@localhost sysconfig]#iptables -I INPUT-p tcp –dport 3306 -j ACCEPT

重新启动防火墙

[iyunv@localhost sysconfig]#/bin/systemctlstart  iptables.service

查看状态,启动成功

[iyunv@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)

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

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

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

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

[iyunv@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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值