CentOS 6.0/7.0关闭默认防火墙启用iptables防火墙

约定不等于承诺〃 2022-06-08 08:16 308阅读 0赞

CentOS 6.0

  1. 命令一
  2. netstat -a 查看所有服务端口
  3. 命令二
  4. nmap +ip地址
  5. yum install nmap 安装nmap软件包
  6. linux开放服务端口的设置
  7. /etc/sysconfig/iptables
  8. vi iptables
  9. 加入如下内容
  10. -A INPUT -p tcp -m tcp --dport 6001 -j ACCEPT
  11. 然后保存退出,重启服务
  12. /etc/init.d/iptables restarts
  13. 查看端口是否开放
  14. /sbin/iptables -L -n

CentOS 7.0
命令一

netstat -a 查看所有服务端口

  1. cd /etc/firewalld/
  2. cd zones
  3. vi public.xml
  4. <?xml version="1.0" encoding="utf-8"?>
  5. <zone>
  6. <short>Public</short>
  7. <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>
  8. <service name="dhcpv6-client"/>
  9. <service name="ssh"/>
  10. <port protocol="tcp" port="8080"/>
  11. <port protocol="tcp" port="80"/>
  12. </zone>

发表评论

表情:
评论列表 (有 0 条评论,308人围观)

还没有评论,来说两句吧...

相关阅读