CENTOS FIREWALLD防火墙学习笔记(四)-Firewalld端口转发
CENTOS FIREWALLD防火墙的端口转发实现起来非常简单,可以把某个端口转发到本机(或者其它服务器)的另外一个端口上,实现真实端口、主机的隐藏,可以使服务器更安全。
实现方法:
查看FirewallD运行状态FirewallD服务必须运行状态。
添加提供访问的端口firewall-cmd --add-port=8091/tcp --permanent#permanent永久生效,但是不会立即生效
添加转发的端口和ip地址格式:
firewall-cmd --permanet --zone<区域> --add-forward-port=port=源端口号:proto=<协议>:toport=<目标端口>:toaddr=<目标IP地址>
friewall-cmd --permanent --add-forward-port=port=8091:proto=tcp:toport=4000:toaddr=ip#ip为另一外一台服务器的ip地址(这里是本机),4000端口是另一服务器上提供访问的Grafana系统的端口,
开启FirewallD的ip地址伪装firewall-cmd --add-masquerade --permanent
生效配置systemctl status firewallD或firewall-cmd --reload或者重启服务器
配置展示
效果展示原服务器访问:
转发访问:
特别声明:以上内容(如有图片或视频亦包括在内)为自媒体平台“网易号”用户上传并发布,本平台仅提供信息存储服务。
Notice: The content above (including the pictures and videos if any) is uploaded and posted by a user of NetEase Hao, which is a social media platform and only provides information storage services.