Re: Debian - port forward


To "Debian CZ/SK project discussion list" <czdebian-l zavinac debian bod cz>
From "Zemek - Centrum" <zdenek bod zemek zavinac centrum bod cz>
Date Mon, 6 Nov 2006 18:55:06 +0100

takře teď mám vše snad správně a stejně to nejde. Čeho se pokouším dosáhnout
jsem popsal výše a nastavení poslední je následující:

iptables -t nat  -L -v
--------------
Chain PREROUTING (policy ACCEPT 161K packets, 14M bytes)
pkts bytes target     prot opt in     out     source
destination
  82  4272 DNAT       tcp  --  eth0   any     anywhere             anywhere
tcp dpt:ssh to:10.0.0.3:22
  647 32592 DNAT       tcp  --  eth0   any     anywhere             anywhere
tcp dpt:5899 to:192.168.1.43:5899
42125 7680K DNAT       udp  --  eth0   any     anywhere             anywhere
udp dpt:5899 to:192.168.1.43:5899

Chain POSTROUTING (policy ACCEPT 1392 packets, 74667 bytes)
pkts bytes target     prot opt in     out     source
destination
2304  125K MASQUERADE  all  --  any    eth0    localnet/24          anywhere

Chain OUTPUT (policy ACCEPT 1392 packets, 74667 bytes)
pkts bytes target     prot opt in     out     source
destination
--------------------

iptables --list
------------------
Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
LOG        all  --  127.0.0.0/8          anywhere            LOG level
warning
DROP       all  --  127.0.0.0/8          anywhere
ACCEPT     all  --  anywhere             255.255.255.255
ACCEPT     all  --  localnet/24          anywhere
ACCEPT    !tcp  --  anywhere             BASE-ADDRESS.MCAST.NET/4
LOG        all  --  localnet/24          anywhere            LOG level
warning
DROP       all  --  localnet/24          anywhere
ACCEPT     all  --  anywhere             255.255.255.255
ACCEPT     all  --  anywhere             62.40.78.242
ACCEPT     all  --  anywhere             192.168.1.255
LOG        all  --  anywhere             anywhere            LOG level
warning
DROP       all  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp
dpt:5899
ACCEPT     udp  --  anywhere             anywhere            state NEW udp
dpt:5899
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp
dpt:5902
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp
dpt:21000

Chain FORWARD (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  localnet/24          anywhere
ACCEPT     all  --  anywhere             anywhere            state
RELATED,ESTABLISHED
LOG        all  --  anywhere             localnet/24         LOG level
warning
DROP       all  --  anywhere             localnet/24
LOG        all  --  anywhere             anywhere            LOG level
warning
DROP       all  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             192.168.1.43        state NEW tcp
dpt:5899
ACCEPT     udp  --  anywhere             192.168.1.43        state NEW udp
dpt:5899

Chain OUTPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             255.255.255.255
ACCEPT     all  --  anywhere             localnet/24
ACCEPT    !tcp  --  anywhere             BASE-ADDRESS.MCAST.NET/4
LOG        all  --  anywhere             localnet/24         LOG level
warning
DROP       all  --  anywhere             localnet/24
ACCEPT     all  --  anywhere             255.255.255.255
ACCEPT     all  --  62.40.78.242         anywhere
ACCEPT     all  --  192.168.1.255        anywhere
LOG        all  --  anywhere             anywhere            LOG level
warning
DROP       all  --  anywhere             anywhere
-------------------------------------------------


----- Original Message -----
From: "d.petr" <d bod petr zavinac post bod cz>
To: "Debian CZ/SK project discussion list" <czdebian-l zavinac debian bod cz>
Sent: Friday, November 03, 2006 7:21 PM
Subject: Re: Debian - port forward


Zdenek Zemek Centrum wrote:
> Chain PREROUTING (policy ACCEPT 14149 packets, 1581K bytes)
> pkts bytes target     prot opt in     out     source
> destination
>     24  1212 DNAT       tcp  --  eth0   any     anywhere
> anywhere            tcp dpt:5899 to:192.168.1.43:5889
>    421 77458 DNAT       udp  --  eth0   any     anywhere
> anywhere            udp dpt:5899 to:192.168.1.43:5889

Port 58<9>9 přesměrováváte na 58<8>9. Tak to chcete?


>      9   444 DNAT       tcp  --  eth0   any     anywhere
> anywhere            tcp dpt:5902 to:192.168.1.43:5902
>      0     0 DNAT       tcp  --  eth0   any     anywhere
> anywhere            tcp dpt:5902 to:192.168.1.43:21000

Myslím, že to druhé přesměrování stejného portu 5902 už se nijak neuplatní.


Ze zápisů předpokládám, že chcete přesměrovat např. zvenčí přicházející
spojení do portu 5889 (nebo 5899, to nevím) na jiný stroj. PREROUTING
tomu změní cíl, dobře, pak paket prochází přes FORWARD. Ve Vašem FORWARD
nevidím žádný zápis, který by propustil nový příchozí paket z eth0. Leda
byste měl nějaký speciální iptables-modul a příchozí spojení vznikalo
jako reakce na komunikaci probíhající a ten speciální modul by tomu
rozumněl. Pak by to snad prošlo podmínkou RELATED. jinak ne.

Takže buď plácám, nebo vidím dva důvody, proč Vám to nejede.

Petr
________________________________________________
CZdebian-l maillist  -  CZdebian-l zavinac debian bod cz
http://www.debian.cz/mailman/listinfo/czdebian-l
E-mail (un)subscriptions: czdebian-l-request zavinac debian bod cz






Partial thread listing: