网站运营
位置:首页>> 网站运营>> linux下防火墙开启某个端口号及防火墙常用命令使用(详解)

linux下防火墙开启某个端口号及防火墙常用命令使用(详解)

作者:jingxian  发布时间:2023-08-16 07:20:30 

标签:linux,开启,防火墙,命令

1、永久性生效,重启后不会复原

开启:chkconfigiptables on

关闭:chkconfigiptables off

2、即时生效,重启后复原

重启防火墙

方式一:/etc/init.d/iptables restart

方式二:service iptables restart

关闭防火墙:

方式一:/etc/init.d/iptables stop

方式二:service iptables stop

启动防火墙

方式一:/etc/init.d/iptables start

方式二:service iptables start

开启相关接口

1、找到防火墙配置文件并修改

目录在/etc/sysconfig/iptables

在里面增加行代码,代码如下:

-A RH-Firewall-1-INPUT -p tcp -m state –state NEW -m tcp –dport 8088 -j ACCEPT

此代码必须放在以下代码之上

-A RH-Firewall-1-INPUT -j REJECT –reject-with icmp-host-prohibited之上,否则不会起作用具体的配置文件如下图:


linux下防火墙开启某个端口号及防火墙常用命令使用(详解)

2、重启防火墙以便改动生效

service iptables restart

0
投稿

猜你喜欢

手机版 网站运营 asp之家 www.aspxhome.com