>[оверквотинг удален]
> iptables -t nat -A POSTROUTING -o INT_IF -p tcp -d LAN_IP --drort
> 5900 -j SNAT --to-source INT_IP
> разрешаем форвард пакетов в обеих направлениях. в первом правиле указан LAN_IP, поскольку
> правило в цепочке PREROUTING выполниться раньше цепочки FORWARD и адрес получателя
> пакета к этому времени уже будет сменен (с EXT_IP на LAN
> IP)
> iptables -A FORWARD -i EXT_IF -p tcp -d LAN_IP --dport 5900 -j
> ACCEPT
> iptables -A FORWARD -o EXT_IF -p tcp -s LAN_IP --sport 5900 -j
> ACCEPT Спасибо за ответ, не работает!
Вот вывод:
iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- 192.168.1.0/24 anywhere udp dpt:30006
ACCEPT tcp -- anywhere anywhere tcp dpt:30005
ACCEPT tcp -- anywhere anywhere tcp dpt:telnet
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT udp -- anywhere anywhere udp dpt:snmp
ACCEPT icmp -- anywhere anywhere icmp echo-request
ACCEPT tcp -- anywhere anywhere tcp dpt:www
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
LOG tcp -- anywhere anywhere tcp flags:SYN,RST,ACK/SYN limit: avg 6/hour burst 5 LOG level alert prefix `Intrusion -> '
DROP all -- anywhere anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere 192.168.1.2 tcp dpt:2642
ACCEPT tcp -- anywhere 192.168.1.2 tcp dpt:6769
ACCEPT udp -- anywhere 192.168.1.2 udp dpt:6769
ACCEPT udp -- 192.168.1.0/24 anywhere udp dpt:30006
ACCEPT tcp -- anywhere anywhere tcp dpt:30005
ACCEPT tcp -- anywhere 192.168.1.2 tcp dpt:3389
TCPMSS tcp -- anywhere anywhere tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU
TCPMSS tcp -- anywhere anywhere tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
LOG tcp -- anywhere anywhere tcp flags:SYN,RST,ACK/SYN limit: avg 6/hour burst 5 LOG level alert prefix `Intrusion -> '
DROP all -- anywhere anywhere
ACCEPT tcp -- anywhere 192.168.1.1 tcp dpt:5900
ACCEPT tcp -- 192.168.1.1 anywhere tcp spt:5900
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DROP all -- anywhere 239.255.255.250
> iptables -t nat --list
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DNAT udp -- anywhere 192.168.1.1 udp dpt:domain to:94.255.29.122
DNAT tcp -- anywhere anywhere tcp dpt:3389 to:192.168.1.2
DNAT udp -- anywhere anywhere udp dpt:6769 to:192.168.1.2:6769-0
DNAT tcp -- anywhere anywhere tcp dpt:6769 to:192.168.1.2:6769-0
DNAT tcp -- anywhere anywhere tcp dpt:2642 to:192.168.1.2:2642-0
DNAT tcp -- anywhere anywhere tcp dpt:5900 to:192.168.1.2:5900
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 192.168.1.0/24 anywhere
SNAT tcp -- anywhere 192.168.1.2 tcp dpt:5900 to:192.168.1.1
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
>