-1
目前我嘗試使用firewall-cmd爲CentOS設置端口轉發。firewall-cmd centos端口轉發似乎不起作用?
目前我的盒子有兩個接口:eth0,eth1。
eth0的表示內部網絡,並且在區=公共(默認),
ETH1表示外部網絡,並且在區=外部
當前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機器是不是沒有網絡的默認路由器。兩者都有其他路由器。