当前位置:首页 » 操作系统 » 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就该这么学》。

热点内容
java返回this 发布:2025-10-20 08:28:16 浏览:577
制作脚本网站 发布:2025-10-20 08:17:34 浏览:868
python中的init方法 发布:2025-10-20 08:17:33 浏览:566
图案密码什么意思 发布:2025-10-20 08:16:56 浏览:748
怎么清理微信视频缓存 发布:2025-10-20 08:12:37 浏览:668
c语言编译器怎么看执行过程 发布:2025-10-20 08:00:32 浏览:989
邮箱如何填写发信服务器 发布:2025-10-20 07:45:27 浏览:239
shell脚本入门案例 发布:2025-10-20 07:44:45 浏览:97
怎么上传照片浏览上传 发布:2025-10-20 07:44:03 浏览:790
python股票数据获取 发布:2025-10-20 07:39:44 浏览:696