首页 > 其他 > 详细

firewalld 是什么?提供什么功能?如何使用?

时间:2020-02-21 02:02:25      阅读:76      评论:0      收藏:0      [点我收藏+]

firewalld 相关链接: https://firewalld.org/

 

What is firewalld?

  Firewalld provides a dynamically managed firewall with support for network/firewall zones that define the trust level of network connections or interfaces.

  Changes can be done immediately in the runtime environment. No restart of the service or daemon is needed.

 

提供三种开通防火墙方式

  $ firewall-cmd --zone=public --add-port=443/tcp --permanent

  $ firewall-cmd --zone=public --add-service=https --permanent

  $ firewall-cmd --zone=public --add-rich-rule=‘rule family="ipv4" source address="10.10.10.0/24" port protocol="tcp" port="443" accept‘ --permanent

 

SNAT/DNAT配置

  SNAT
  # 开启 NAT 转发
  firewall-cmd --permanent --zone=public --add-masquerade

  # 开放 DNS 使用的 53 端口,UDP
  # 必须,否则其他机器无法进行域名解析
  firewall-cmd --zone=public --add-port=80/tcp --permanent

  # 检查是否允许 NAT 转发
  firewall-cmd --query-masquerade

  # 禁止防火墙 NAT 转发
  firewall-cmd --remove-masquerade

  DNAT
  # 将80端口的流量转发至8080
  firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080

  # 将80端口的流量转发至192.168.0.1
  firewall-cmd --add-forward-port=port=80:proto=tcp:toaddr=192.168.0.1

  # 将80端口的流量转发至192.168.0.1的8080端口
  firewall-cmd --add-forward-port=port=80:proto=tcp:toaddr=192.168.0.1:toport=8080

 

firewalld 是什么?提供什么功能?如何使用?

原文:https://www.cnblogs.com/vincenshen/p/12339778.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!