CentOS Linux 防火墙添加端口开放(linux防火墙开放端口命令给指定ip)
admin
2023-03-27 08:41:04

首先可以查看有哪些端口是开放状态:

netstat -ntpl

Centos 7.0 之前的版本,防火墙用的是 iptables,7.0 之后使用 firewalld 代替了 iptables,那么我们来分别看看这两种防火墙的命令操作:

iptables

1. 查看防火墙状态

systemctl status firewalld

service iptables status

2. 暂时关闭防火墙

systemctl stop firewalld

service iptables stop

3. 永久关闭防火墙

systemctl disable firewalld

chkconfig iptables off

4. 重启防火墙

systemctl enable firewalld

service iptables restart

5. 开放指定端口

编辑文件: vi /etc/sysconfig/iptables

添加开放端口:iptables -I INPUT -p tcp –dport 端口号 -j ACCEPT

保存配置:service iptables save

重启防火墙:service iptables restart

firewalld

1. 查看防火墙状态

systemctl status firewalld

firewall-cmd –state

2. 启动防火墙

systemctl start firewalld

3.禁用防火墙

systemctl stop firewalld

4.设置开机启动

systemctl enable firewalld

5.停止并禁用开机启动

sytemctl disable firewalld

6.重启防火墙

systemctl restart firewalld.service

firewall-cmd –reload

7. 开放指定端口

添加端口: firewall-cmd –zone=public –add-port=端口号/tcp –permanent

重启防火墙:systemctl restart firewalld.service

以上就是我服了网»linux防火墙开放端口命令给指定ip(CentOS Linux 防火墙添加端口开放)的相关内容了,更多精彩请关注我服了号公众号。

声明:本文由猫小编【创业者资源平台】作者编辑发布,更多技术关注猫小编技术!

相关内容

热门资讯

脚上的穴位图 脚面经络图对应的... 人体穴位作用图解大全更清晰直观的标注了各个人体穴位的作用,包括头部穴位图、胸部穴位图、背部穴位图、胳...
应用未安装解决办法 平板应用未... ---IT小技术,每天Get一个小技能!一、前言描述苹果IPad2居然不能安装怎么办?与此IPad不...
阿西吧是什么意思 阿西吧相当于... 即使你没有受到过任何外语培训,你也懂四国语言。汉语:你好英语:Shit韩语:阿西吧(아,씨발! )日...
长白山自助游攻略 吉林长白山游... 昨天介绍了西坡的景点详细请看链接:一个人的旅行,据说能看到长白山天池全凭运气,您的运气如何?今日介绍...
demo什么意思 demo版本... 618快到了,各位的小金库大概也在准备开闸放水了吧。没有小金库的,也该向老婆撒娇卖萌服个软了,一切只...