Linux iptables firewalld配置 iptables 开放端口 1 2 3 4 iptables -I INPUT -p udp --dport 137 -j ACCEPT iptables -I INPUT -p udp --dport 138 -j ACCEPT iptables -I INPUT -p tcp --dport 139 -j ACCEPT iptables -I INPUT -p tcp --dport 445 -j ACCEPT 1 iptables-save 1 service iptables save 1 chkconfig iptables on 关闭iptables 非本地环境不推荐关闭防火墙 重启后生效 1 2 chkconfig iptables on chkconfig iptables off 即时生效,重启后失效 1 2 service iptables start service iptables stop firewalld 开放端口 1 firewall-cmd --zone=public --add-port=80/tcp --permanent 命令含义: 1 2 3 --zone #作用域 --add-port=80/tcp #添加端口,格式为:端口/通讯协议 --permanent #永久生效,没有此参数重启后失效 重启防火墙 1 firewall-cmd --reload