我使用firewalld将传入端口从因特网(9999)转发到本地LAN IP地址(100.1.1.1),如下所示:
external (active)
target: default
icmp-block-inversion: no
interfaces: tailscale0
sources:
services: ssh
ports: 9999/tcp
protocols:
forward: yes
masquerade: yes
forward-ports:
source-ports:
icmp-blocks:
rich rules:
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3
sources:
services: dhcpv6-client ssh
ports: 9999/tcp
protocols:
forward: yes
masquerade: no
forward-ports:
port=9999:proto=tcp:toport=9999:toaddr=100.1.1.1
source-ports:
icmp-blocks:
rich rulesLAN (100.1.1.1)来自运行在同一台机器上的Tailscale (VPN)接口,该接口通过Internet将流量传递给另一台计算机。
转发工作正常,但我的问题是,在目标机器上,所有流量似乎都来自100.1.1.1 (尾比例尺),而不是原来的源IP。这对于像fail2ban或统计之类的东西是不方便的。
是否有办法在保留源地址的同时仍允许转发通信量?
编辑:根据这篇文章,https://mghadam.blogspot.com/2020/05/forward-traffic-from-public-ip-to.html?m=1应该是可能的,但很复杂。
发布于 2022-12-25 15:18:19
禁用伪装命令:
firewall-cmd --permanent --zone=external --remove-masquerade如果您需要共享外部区域的internet,请为Public启用伪装:
firewall-cmd --permanent --zone=public --add-masqueradehttps://unix.stackexchange.com/questions/706044
复制相似问题