当前位置:首页 » 操作系统 » linux防火墙端口关闭

linux防火墙端口关闭

发布时间: 2025-01-02 09:18:29

linux端口被防火墙关闭如何打开吗

1) 重启后生效

开启: chkconfig iptables on

关闭: chkconfig iptables off

2) 即时生效,重启后失效

开启: service iptables start

关闭: service iptables stop

需要说明的是对于Linux下的其它服务都可以用以上命令执行开启和关闭操作。

在开启了防火墙时,做如下设置,开启相关端口,

修改/etc/sysconfig/iptables 文件,添加以下内容:

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

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

重起iptalbes服务:service iptables restart

❷ 如何关闭linux防火墙的443端口

1、首先需要在Linux终端输入指令:iptables -I INPUT -p tcp --dport 443 -j ACCEPT。

❸ linux如何关闭防火墙

关闭防火墙,就可以外部访问了。不受端口限制。生产环境,最好开启防火墙,开启部分端口。
1.永久有效
开启: chkconfig iptables on 关闭: chkconfig iptables off

2.即刻生效
开启: service iptables start 关闭: service iptables stop

3.开启部分端口
vim /etc/sysconfig/iptables

添加想要开启的相关端口
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8082 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
service iptables restart

更多详细Linux知识可参考《Linux就该这么学》。

热点内容
app什么情况下找不到服务器 发布:2025-05-12 15:46:25 浏览:714
php跳过if 发布:2025-05-12 15:34:29 浏览:467
不定时算法 发布:2025-05-12 15:30:16 浏览:131
c语言延时1ms程序 发布:2025-05-12 15:01:30 浏览:166
动物园灵长类动物配置什么植物 发布:2025-05-12 14:49:59 浏览:736
wifi密码设置什么好 发布:2025-05-12 14:49:17 浏览:148
三位数乘两位数速算法 发布:2025-05-12 13:05:48 浏览:399
暴风影音缓存在哪里 发布:2025-05-12 12:42:03 浏览:544
access数据库exe 发布:2025-05-12 12:39:04 浏览:632
五开的配置是什么 发布:2025-05-12 12:36:37 浏览:366