Народ, помогите плиз, неделю бьюсь уже...Есть гейтвей на Suse 10.2, надо сделать так, чтобы коннект к порту ВНЕШНИЙ.АЙПИ.ГЕЙТ.ВЕЯ:ПОРТ перенапрявлялся на порт машины в локальной сети АЙПИ.КОМПА.ВЛОКАЛЬНОЙ.СЕТКЕ:ПОРТ
Например, мне надо настроить возможность подключаться к виндовому компу в локальной сети из инета через гейтвей по ремоут десктоп.
iptables прописал, маскирование в фаерволе сделал, а нифига не пашет, помогите плизз кто знает....
не плохо бы получившиеся правила увидеть.
покажите вывод iptables-save.
>не плохо бы получившиеся правила увидеть.
>покажите вывод iptables-save.Вот:
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [460:18400]
:forward_ext - [0:0]
:forward_int - [0:0]
:input_ext - [0:0]
:input_int - [0:0]
:reject_func - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i eth1 -j input_int
-A INPUT -i eth0 -j input_ext
-A INPUT -j input_ext
-A INPUT -m limit --limit 3/min -j LOG --log-prefix "SFW2-IN-ILL-TARGET " --log-
tcp-options --log-ip-options
-A INPUT -j DROP
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
-A FORWARD -i eth1 -j forward_int
-A FORWARD -i eth0 -j forward_ext
-A FORWARD -m limit --limit 3/min -j LOG --log-prefix "SFW2-FWD-ILL-ROUTING " --
log-tcp-options --log-ip-options
-A FORWARD -j DROP
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -m limit --limit 3/min -j LOG --log-prefix "SFW2-OUT-ERROR " --log-tcp
-options --log-ip-options
-A forward_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
0 -j ACCEPT
-A forward_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
3 -j ACCEPT
-A forward_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
11 -j ACCEPT
-A forward_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
12 -j ACCEPT
-A forward_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
14 -j ACCEPT
-A forward_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
18 -j ACCEPT
-A forward_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
3/2 -j ACCEPT
-A forward_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
5 -j ACCEPT
-A forward_ext -p tcp -m limit --limit 3/min -m tcp --dport 500 -m state --state
NEW -j LOG --log-prefix "SFW2-FWDext-ACC-FORW " --log-tcp-options --log-ip-opti
ons
-A forward_ext -p tcp -m state --state NEW,RELATED,ESTABLISHED -m tcp --dport 50
0 -j ACCEPT
-A forward_ext -p tcp -m state --state RELATED,ESTABLISHED -m tcp --sport 500 -j
ACCEPT
-A forward_ext -o eth0 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
-A forward_ext -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A forward_ext -m limit --limit 3/min -m pkttype --pkt-type multicast -j LOG --l
og-prefix "SFW2-FWDext-DROP-DEFLT " --log-tcp-options --log-ip-options
-A forward_ext -m pkttype --pkt-type multicast -j DROP
-A forward_ext -p tcp -m limit --limit 3/min -m tcp --tcp-flags FIN,SYN,RST,ACK
SYN -j LOG --log-prefix "SFW2-FWDext-DROP-DEFLT " --log-tcp-options --log-ip-opt
ions
-A forward_ext -p icmp -m limit --limit 3/min -j LOG --log-prefix "SFW2-FWDext-D
ROP-DEFLT " --log-tcp-options --log-ip-options
-A forward_ext -p udp -m limit --limit 3/min -j LOG --log-prefix "SFW2-FWDext-DR
OP-DEFLT " --log-tcp-options --log-ip-options
-A forward_ext -m limit --limit 3/min -m state --state INVALID -j LOG --log-pref
ix "SFW2-FWDext-DROP-DEFLT-INV " --log-tcp-options --log-ip-options
-A forward_ext -j DROP
-A forward_int -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
0 -j ACCEPT
-A forward_int -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
3 -j ACCEPT
-A forward_int -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
11 -j ACCEPT
-A forward_int -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
12 -j ACCEPT
-A forward_int -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
14 -j ACCEPT
-A forward_int -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
18 -j ACCEPT
-A forward_int -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
3/2 -j ACCEPT
-A forward_int -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type
5 -j ACCEPT
-A forward_int -p tcp -m limit --limit 3/min -m tcp --dport 500 -m state --state
NEW -j LOG --log-prefix "SFW2-FWDint-ACC-FORW " --log-tcp-options --log-ip-opti
ons
-A forward_int -p tcp -m state --state NEW,RELATED,ESTABLISHED -m tcp --dport 50
0 -j ACCEPT
-A forward_int -p tcp -m state --state RELATED,ESTABLISHED -m tcp --sport 500 -j
ACCEPT
-A forward_int -o eth0 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
-A forward_int -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A forward_int -m limit --limit 3/min -m pkttype --pkt-type multicast -j LOG --l
og-prefix "SFW2-FWDint-DROP-DEFLT " --log-tcp-options --log-ip-options
-A forward_int -m pkttype --pkt-type multicast -j DROP
-A forward_int -p tcp -m limit --limit 3/min -m tcp --tcp-flags FIN,SYN,RST,ACK
SYN -j LOG --log-prefix "SFW2-FWDint-DROP-DEFLT " --log-tcp-options --log-ip-opt
ions
-A forward_int -p icmp -m limit --limit 3/min -j LOG --log-prefix "SFW2-FWDint-D
ROP-DEFLT " --log-tcp-options --log-ip-options
-A forward_int -p udp -m limit --limit 3/min -j LOG --log-prefix "SFW2-FWDint-DR
OP-DEFLT " --log-tcp-options --log-ip-options
-A forward_int -m limit --limit 3/min -m state --state INVALID -j LOG --log-pref
ix "SFW2-FWDint-DROP-DEFLT-INV " --log-tcp-options --log-ip-options
-A forward_int -j reject_func
-A input_ext -m pkttype --pkt-type broadcast -j DROP
-A input_ext -p icmp -m icmp --icmp-type 4 -j ACCEPT
-A input_ext -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A input_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type 0
-j ACCEPT
-A input_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type 3
-j ACCEPT
-A input_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type 11
-j ACCEPT
-A input_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type 12
-j ACCEPT
-A input_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type 14
-j ACCEPT
-A input_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type 18
-j ACCEPT
-A input_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type 3/
2 -j ACCEPT
-A input_ext -p icmp -m state --state RELATED,ESTABLISHED -m icmp --icmp-type 5
-j ACCEPT
-A input_ext -p esp -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 20 --tcp-flags FIN,SYN
,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-options --log-i
p-options
-A input_ext -p tcp -m tcp --dport 20 -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 2003 --tcp-flags FIN,S
YN,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-options --log
-ip-options
-A input_ext -p tcp -m tcp --dport 2003 -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 21 --tcp-flags FIN,SYN
,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-options --log-i
p-options
-A input_ext -p tcp -m tcp --dport 21 -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 22 --tcp-flags FIN,SYN
,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-options --log-i
p-options
-A input_ext -p tcp -m tcp --dport 22 -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 3389 --tcp-flags FIN,S
YN,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-options --log
-ip-options
-A input_ext -p tcp -m tcp --dport 3389 -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 500 --tcp-flags FIN,SY
N,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-options --log-
ip-options
-A input_ext -p tcp -m tcp --dport 500 -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 55000:56000 --tcp-flag
s FIN,SYN,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-option
s --log-ip-options
-A input_ext -p tcp -m tcp --dport 55000:56000 -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 53 --tcp-flags FIN,SYN
,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-options --log-i
p-options
-A input_ext -p tcp -m tcp --dport 53 -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 80 --tcp-flags FIN,SYN
,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-options --log-i
p-options
-A input_ext -p tcp -m tcp --dport 80 -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 443 --tcp-flags FIN,SY
N,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-options --log-
ip-options
-A input_ext -p tcp -m tcp --dport 443 -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 143 --tcp-flags FIN,SY
N,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-options --log-
ip-options
-A input_ext -p tcp -m tcp --dport 143 -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 3306 --tcp-flags FIN,S
YN,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-options --log
-ip-options
-A input_ext -p tcp -m tcp --dport 3306 -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 110 --tcp-flags FIN,SY
N,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-options --log-
ip-options
-A input_ext -p tcp -m tcp --dport 110 -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 995 --tcp-flags FIN,SY
N,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-options --log-
ip-options
-A input_ext -p tcp -m tcp --dport 995 -j ACCEPT
-A input_ext -p tcp -m limit --limit 3/min -m tcp --dport 25 --tcp-flags FIN,SYN
,RST,ACK SYN -j LOG --log-prefix "SFW2-INext-ACC-TCP " --log-tcp-options --log-i
p-options
-A input_ext -p tcp -m tcp --dport 25 -j ACCEPT
-A input_ext -p udp -m udp --dport 53 -j ACCEPT
-A input_ext -p udp -m udp --dport 4500 -j ACCEPT
-A input_ext -p udp -m udp --dport 500 -j ACCEPT
-A input_ext -p tcp -m tcp --dport 500 -m state --state NEW -m limit --limit 3/m in -j LOG --log-prefix "SFW2-INext-ACC " --log-tcp-options --log-ip-options
-A input_ext -p tcp -m tcp --dport 500 -j ACCEPT
-A input_ext -p tcp -m tcp --dport 113 -m state --state NEW -j reject_func
-A input_ext -m limit --limit 3/min -m pkttype --pkt-type multicast -j LOG --log -prefix "SFW2-INext-DROP-DEFLT " --log-tcp-options --log-ip-options
-A input_ext -m pkttype --pkt-type multicast -j DROP
-A input_ext -p tcp -m limit --limit 3/min -m tcp --tcp-flags FIN,SYN,RST,ACK SY N -j LOG --log-prefix "SFW2-INext-DROP-DEFLT " --log-tcp-options --log-ip-option s
-A input_ext -p icmp -m limit --limit 3/min -j LOG --log-prefix "SFW2-INext-DROP -DEFLT " --log-tcp-options --log-ip-options
-A input_ext -p udp -m limit --limit 3/min -j LOG --log-prefix "SFW2-INext-DROP- DEFLT " --log-tcp-options --log-ip-options
-A input_ext -m limit --limit 3/min -m state --state INVALID -j LOG --log-prefix "SFW2-INext-DROP-DEFLT-INV " --log-tcp-options --log-ip-options
-A input_ext -j DROP
-A input_int -j ACCEPT
-A reject_func -p tcp -j REJECT --reject-with tcp-reset
-A reject_func -p udp -j REJECT --reject-with icmp-port-unreachable
-A reject_func -j REJECT --reject-with icmp-proto-unreachable
COMMIT
что-то ни DNAT, ни SNAT в правилах не заметил :).
только таблица фильтра.
>что-то ни DNAT, ни SNAT в правилах не заметил :).
>только таблица фильтра.# iptables -L -t nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DNAT tcp -- anywhere 78.107.33.131 tcp dpt:ms-wbt-server to:192.168.5.252:3389Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE 0 -- anywhere anywhereChain OUTPUT (policy ACCEPT)
target prot opt source destination
1
>[оверквотинг удален]
>target prot opt source
> destination
>
>MASQUERADE 0 -- anywhere
> anywhere
>
>Chain OUTPUT (policy ACCEPT)
>target prot opt source
> destination
>-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
-A FORWARD -i eth1 -j forward_int
-A FORWARD -i eth0 -j forward_ext-A forward_ext -p tcp -m state --state NEW,RELATED,ESTABLISHED -m tcp --dport 500 -j ACCEPT
-A forward_ext -p tcp -m state --state RELATED,ESTABLISHED -m tcp --sport 500 -j ACCEPTустановить соединение получится только если пакет, идущий не на 500 порт, пришел и ушел через eth0
-A forward_ext -o eth0 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
-A forward_ext -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT-A forward_int -p tcp -m state --state NEW,RELATED,ESTABLISHED -m tcp --dport 500 -j ACCEPT
-A forward_int -p tcp -m state --state RELATED,ESTABLISHED -m tcp --sport 500 -j ACCEPTустановить соединение из внутренней сети
-A forward_int -o eth0 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPTэто правило помоему никогда не сработает
-A forward_int -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPTтакое впечатление, что напутано с интерфейсами.
если я не запутался в вашем супер фильтре. :)