Linux在关闭防火墙firewall的情况下开启端口

修改配置文件

firewall防火墙有个配置文件

cat /etc/firewalld/zones/public.xml

内容如下,自行修改即可

<?xml version="1.0" encoding="utf-8"?>
<zone>
  <short>Public</short>
  <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
  <service name="ssh"/>
  <service name="dhcpv6-client"/>
<port port="22" protocol="tcp"/>
<port port="2201" protocol="tcp"/>
<port port="3306" protocol="tcp"/>
</zone>

切记,需要保证你当前登录ssh的端口已经加到上面!!!

启动防火墙

service firewalld start

查看已经开启的端口

firewall-cmd --list-all

Linux在关闭防火墙firewall的情况下开启端口

上一篇:Linux Kernel信号处理机制源码分析


下一篇:20、Linux 常用命令ll失效