thaughtZhao

service iptables start时提示:“iptables: No config file.                                  [WARNING]”

此时打开配置文件所在目录,如

[root@EM5VMA064 sysconfig]# cd /etc/sysconfig
[root@EM5VMA064 sysconfig]# ls|grep iptables
iptables-config
iptables.old

[root@EM5VMA064 sysconfig]# mv iptables.old iptables

再次执行 service iptables start,就可以开启防火墙;

 

linux下打开80 、9200端口

 1.vi打开 /etc/sysconfig/iptables文件;

2.黏贴

-A INPUT -m state --state NEW -m tcp -p tcp --dport 9200 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

注意:

添加的行一定要在 
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited

这两行前面,否则没有效果;

重启防火墙。

其他操作命令:

查询防火墙状态:
[root@localhost ~]# service   iptables status
停止防火墙:
[root@localhost ~]# service   iptables stop
启动防火墙:
[root@localhost ~]# service   iptables start
重启防火墙:
[root@localhost ~]# service   iptables restart
永久关闭防火墙:
[root@localhost ~]# chkconfig   iptables off
永久关闭后启用:
[root@localhost ~]# chkconfig   iptables on

 

关闭端口则只需要将ACCEPT改成drop即可。

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
  • 2021-12-07
  • 2021-11-30
  • 2022-01-30
  • 2021-11-19
  • 2021-12-19
猜你喜欢
  • 2021-12-09
  • 2018-02-28
  • 2021-12-07
  • 2022-02-04
  • 2021-12-10
  • 2021-12-19
相关资源
相似解决方案