目前我尝试使用firewall-cmd为CentOS设置端口转发 .
目前我的盒子有两个界面:eth0,eth1 .
eth0代表内部网络,位于zone = public(默认值),
eth1代表外部网络,位于zone = external
目前eth1连接到另一个包含到互联网的路由器的网络 .
我的外部防火墙看起来像这样:
external (active)
target: default
icmp-block-inversion: no
interfaces: eth1
sources: 192.168.178.0/24
services: dhcpv6-client http https ssh
ports: 1194/udp
protocols:
masquerade: yes
forward-ports: port=1194:proto=udp:toport=:toaddr=192.168.179.4
sourceports:
icmp-blocks:
rich rules:
我也有端口22的规则:
firewall-cmd --zone=external --add-forward-port=port=22:proto=tcp:toport=22:toaddr=192.168.179.8
但是这两个规则都不起作用,无论是1194还是带有端口22的规则 . 实际上我测试过来自我们的路由器的端口转发工作到机器,实际上它确实是因为如果我设置HAPROXY指向另一台SSH机器:
frontend sshd
bind 192.168.178.254:22
mode tcp
default_backend ssh
timeout client 1h
backend ssh
mode tcp
server static 192.168.179.8:22 check
并删除 port=22
规则,我可以连接到它 . 我实际上是在允许的selinux规则上运行 .
公共区域看起来像这样:
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0
sources: 192.168.179.0/24
services: dhcpv6-client http https ssh
ports: 7583/tcp
protocols:
masquerade: no
forward-ports:
sourceports:
icmp-blocks:
rich rules:
有什么我想念的吗?我的意思是我也尝试使用iptables,但它根本没用 .
sysctl net.ipv4.ip_forward
返回 net.ipv4.ip_forward = 1
Linux Box不是两个网络的默认路由器 . 两者都有其他路由器 .
1 回答
看起来需要为两个网络打开假面舞会: