Re: route port valasztas
PÁSZTOR György wrote: > Hi! > > "Gabor HALASZ" írta 2008-12-16 12:38-kor: >> PÁSZTOR György wrote: >>> Kerestem is most olyan szervert, ahol OUTPUT-ban DNAT-olok, és megy: >>> >>> # iptables-save -c |grep OUTPUT |grep DNAT >>> [7771:553506] -A OUTPUT -d 127.0.0.1 -p udp -m udp --dport 53 -j DNAT >>> --to-destination 192.168.0.1:1053 >>> [0:0] -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 53 -j DNAT >>> --to-destination 192.168.0.1:1053 >>> [1030408:61824480] -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 25 -j DNAT >>> --to-destination 192.168.4.1 >>> [1:60] -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 2401 -j DNAT >>> --to-destination 192.168.0.1 >>> >> A 192.168.0.1 lokalis ezen a gepen? > Igen, de másik RSBAC jail. > (A 192.168... címek rsbac jailek) > Nem tudom, az rsbac jail mennyibe szeparalja az interfaceket, de ha dumpolod a lo forgalmat, akkor meglepo dolgokat fogsz latni -- Gabor HALASZ _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
Hi! "Gabor HALASZ" írta 2008-12-16 12:38-kor: > PÁSZTOR György wrote: > > > > Kerestem is most olyan szervert, ahol OUTPUT-ban DNAT-olok, és megy: > > > > # iptables-save -c |grep OUTPUT |grep DNAT > > [7771:553506] -A OUTPUT -d 127.0.0.1 -p udp -m udp --dport 53 -j DNAT > > --to-destination 192.168.0.1:1053 > > [0:0] -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 53 -j DNAT > > --to-destination 192.168.0.1:1053 > > [1030408:61824480] -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 25 -j DNAT > > --to-destination 192.168.4.1 > > [1:60] -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 2401 -j DNAT > > --to-destination 192.168.0.1 > > > A 192.168.0.1 lokalis ezen a gepen? Igen, de másik RSBAC jail. (A 192.168... címek rsbac jailek) Üdv:Gyur! _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
PÁSZTOR György writes: > "Ferenc Wagner" írta 2008-12-16 11:47-kor: > >> Lásd http://ebtables.sourceforge.net/br_fw_ia/br_fw_ia.html 3b ábra alatt: >> >> Note that the iptables nat OUTPUT chain is situated after the >> routing decision. As commented in the previous section [...], this >> is too late for DNAT. This is solved by rerouting the IP packet if >> it has been DNAT'ed, before continuing. > > Ez az ábra is készülhetett azon hibás howto alapján, amit HG beírt. Az ábrát csak tájékozódásnak írtam. Alatta az idézett szöveg pont arról szól, hogy nem egészen úgy vannak a dolgok, ahogy az ábra mutatja. -- Feri. _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
PÁSZTOR György wrote: > > Kerestem is most olyan szervert, ahol OUTPUT-ban DNAT-olok, és megy: > > # iptables-save -c |grep OUTPUT |grep DNAT > [7771:553506] -A OUTPUT -d 127.0.0.1 -p udp -m udp --dport 53 -j DNAT > --to-destination 192.168.0.1:1053 > [0:0] -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 53 -j DNAT > --to-destination 192.168.0.1:1053 > [1030408:61824480] -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 25 -j DNAT > --to-destination 192.168.4.1 > [1:60] -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 2401 -j DNAT > --to-destination 192.168.0.1 > A 192.168.0.1 lokalis ezen a gepen? -- Gabor HALASZ _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
Hi! "Ferenc Wagner" írta 2008-12-16 11:47-kor: > Lásd http://ebtables.sourceforge.net/br_fw_ia/br_fw_ia.html 3b ábra alatt: > > Note that the iptables nat OUTPUT chain is situated after the > routing decision. As commented in the previous section [...], this > is too late for DNAT. This is solved by rerouting the IP packet if > it has been DNAT'ed, before continuing. Ez az ábra is készülhetett azon hibás howto alapján, amit HG beírt. Kerestem is most olyan szervert, ahol OUTPUT-ban DNAT-olok, és megy: # iptables-save -c |grep OUTPUT |grep DNAT [7771:553506] -A OUTPUT -d 127.0.0.1 -p udp -m udp --dport 53 -j DNAT --to-destination 192.168.0.1:1053 [0:0] -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 53 -j DNAT --to-destination 192.168.0.1:1053 [1030408:61824480] -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 25 -j DNAT --to-destination 192.168.4.1 [1:60] -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 2401 -j DNAT --to-destination 192.168.0.1 Üdv:Gyur! _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
Gabor HALASZ writes: > PÁSZTOR György wrote: > >> "Gabor HALASZ" írta 2008-12-16 09:13-kor: >> >>> PÁSZTOR György wrote: >>> Igen, de az OUTPUT chain a routing decision előtt van mind a nat, mind a mangle táblában. >>> >>> Eszerint nem: >>> >>> http://www.netfilter.org/documentation/HOWTO//packet-filtering-HOWTO-6.html >> >> Ez a doksi hibás. Ha már felfedezted küldj nekik bugreport! ;-) > > A masik ok a mar emlegetett network internals konyv. Mondjuk harmadiknak > a mar emlegetett traversingoftables faq, amit most ide is masolom > vonatkozo reszet (csak a sorrend miatt, a table/chain specifikacio > nelkul is eleg): > > 3.2 Source local host > > 1. Local process/application (i.e., server/client program) > 2. Routing decision. What source address to use, what outgoing interface >to use, and other necessary information that needs to be gathered. > 3. This is where we mangle packets, it is suggested that you do not > filter in this chain since it can have side effects. > 4 Lásd http://ebtables.sourceforge.net/br_fw_ia/br_fw_ia.html 3b ábra alatt: Note that the iptables nat OUTPUT chain is situated after the routing decision. As commented in the previous section [...], this is too late for DNAT. This is solved by rerouting the IP packet if it has been DNAT'ed, before continuing. -- Feri. _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
PÁSZTOR György wrote: > Hi! > > "Gabor HALASZ" írta 2008-12-16 09:13-kor: >> PÁSZTOR György wrote: >>> Igen, de az OUTPUT chain a routing decision előtt van mind a nat, mind a >>> mangle táblában. >>> >> Eszerint nem: >> >> http://www.netfilter.org/documentation/HOWTO//packet-filtering-HOWTO-6.html > Ez a doksi hibás. Ha már felfedezted küldj nekik bugreport! ;-) Ezzel a lehetoseggel tobb okbol sem elnek, az egyik a fenti howto 4. pontja: 4. Who the hell are you, and why are you playing with my kernel? I'm Rusty Russell; the Linux IP Firewall maintainer and just another working coder who happened to be in the right place at the right time. A masik ok a mar emlegetett network internals konyv. Mondjuk harmadiknak a mar emlegetett traversingoftables faq, amit most ide is masolom vonatkozo reszet (csak a sorrend miatt, a table/chain specifikacio nelkul is eleg): 3.2 Source local host 1. Local process/application (i.e., server/client program) 2. Routing decision. What source address to use, what outgoing interface to use, and other necessary information that needs to be gathered. 3. This is where we mangle packets, it is suggested that you do not filter in this chain since it can have side effects. 4 3.3 Forwarded packets 1. On the wire (i.e., Internet) 2. Comes in on the interface (i.e., eth0) 3. This chain is normally used for mangling packets, i.e., changing TOS and so on. 4. This chain is used for DNAT mainly. SNAT is done further on. Avoid filtering in this chain since it will be bypassed in certain cases. 5. Routing decision, i.e., is the packet destined for our local host or to be forwarded and where. -- Gabor HALASZ _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
Hi! "Gabor HALASZ" írta 2008-12-16 09:13-kor: > PÁSZTOR György wrote: > > Igen, de az OUTPUT chain a routing decision előtt van mind a nat, mind a > > mangle táblában. > > > > Eszerint nem: > > http://www.netfilter.org/documentation/HOWTO//packet-filtering-HOWTO-6.html Ez a doksi hibás. Ha már felfedezted küldj nekik bugreport! ;-) > > Szal ennek működnie kell: > > > > iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 80 -j MARK --set-mark 123 > > ip rule add fwmark 123 tablad > > iptables -t nat -A OUTPUT -p tcp -m tcp --dport 80 -s masikifipje -j > > MASQUERADE > > > > Ha mégsem, akkor pebkac. > > Ennel az is jobb magyarazat, amit irtam; ismetelni nem akarom, legyen > eleg ennyi: > > MASQUERADE >This target is only valid in the nat table, in the > POSTROUTING chain. Bocs, ezt elírtam, a MASQ-ost POSTROUTING-ba akartam írni. Üdv:Gyur! _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
PÁSZTOR György wrote: > Igen, de az OUTPUT chain a routing decision előtt van mind a nat, mind a > mangle táblában. > Eszerint nem: http://www.netfilter.org/documentation/HOWTO//packet-filtering-HOWTO-6.html > Szal ennek működnie kell: > > iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 80 -j MARK --set-mark 123 > ip rule add fwmark 123 tablad > iptables -t nat -A OUTPUT -p tcp -m tcp --dport 80 -s masikifipje -j > MASQUERADE > > Ha mégsem, akkor pebkac. Ennel az is jobb magyarazat, amit irtam; ismetelni nem akarom, legyen eleg ennyi: MASQUERADE This target is only valid in the nat table, in the POSTROUTING chain. -- Gabor HALASZ _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
Hi! "Gabor HALASZ" írta 2008-12-15 20:24-kor: > Nem, tobb rendbeli problema van, azt hiszem, csak interface-re Ahogyan az elméleteddel is. > bindelessel oldhato meg. Az alapeveto problema az, hogy routing az > ~layer3, a tcp meg ~layer4, igy a routingnak mindegy, hogy http vagy Mindegy lenne, ha ilyen buta lenne az ip rule parancs. De ahogyan írtad ott az fwmark alpaján is lehet döntést hozni. Az fwmarkot meg akármi alapján rá lehet aggatni a netfilter/iptables segítségével. > smtp. A lartc-s peldak, ha figyelmesen nezegeted, mindit prerouting > chainel es nat tablaval operal, az neked meg nincs, es ugy altalaban, Igen, de az OUTPUT chain a routing decision előtt van mind a nat, mind a mangle táblában. Szal ennek működnie kell: iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 80 -j MARK --set-mark 123 ip rule add fwmark 123 tablad iptables -t nat -A OUTPUT -p tcp -m tcp --dport 80 -s masikifipje -j MASQUERADE Ha mégsem, akkor pebkac. > mire az iptables input/output sorra kerul, addigra mar az interface Az INPUT-nál igen, de ott csak bejövő interfész van. Olvasd el a manuált! Idézem: mangle: This table is used for specialized packet alteration. Until kernel 2.4.17 it had two built-in chains: PREROUTING (for altering incoming packets before routing) and OUTPUT (for ~~~ altering locally-generated packets before routing). Since ~~~ kernel 2.4.18, three other built-in chains are also sup? ported: INPUT (for packets coming into the box itself), FOR? WARD (for altering packets being routed through the box), and POSTROUTING (for altering packets as they are about to go out). Ha nem megy, akkor a ~-vel aláhúzott résznek fuss még neki néhányszor! Üdv:Gyur! _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
Gabor HALASZ wrote: > Nem, tobb rendbeli problema van, azt hiszem, csak interface-re... Ha nem, hát nem ;-( Köszönöm a segítséget, útmutatást. Üdv: Kanyó Miklós _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
linux wrote: > Gabor HALASZ wrote: > >Nem is fog.Mire az output chainben a mangle table sorra kerul, mar tul > >van a routing decision-on, es onnan meg par lepes a nat table, plane az > > postrouting chain. > > Értem én amit mondasz. > Meg lehet ezt a problémát oldani ip/iptables segítségével? > Nem, tobb rendbeli problema van, azt hiszem, csak interface-re bindelessel oldhato meg. Az alapeveto problema az, hogy routing az ~layer3, a tcp meg ~layer4, igy a routingnak mindegy, hogy http vagy smtp. A lartc-s peldak, ha figyelmesen nezegeted, mindit prerouting chainel es nat tablaval operal, az neked meg nincs, es ugy altalaban, mire az iptables input/output sorra kerul, addigra mar az interface adott (forward-nal a prerouting-gal bele tudsz avatkozni), pl hiaba mondod, hogy IPTABLES -A INPUT -i eth0 -j DROP, attol meg a tcpdump -i eth0 szepen dumpolja a bejovo syn csomagokat. Ha konkretabban akarod, tekintsd meg a O'Really fele Understanding Linux Network Internals-ban a 38.5 Output Routing fejezet elejen levo szep nagy diagramot (pl a konyv.kinaunix.halozat linken a kugli talalatok kozul ;), abbol kiderul, hogy csak multipath routing tud beleavatkozni a kimeno interface meghatarozasaba, de ott meg lasd amit a layerekrol irtam. _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
Gabor HALASZ wrote: >Nem is fog.Mire az output chainben a mangle table sorra kerul, mar tul >van a routing decision-on, es onnan meg par lepes a nat table, plane az > postrouting chain. Értem én amit mondasz. Meg lehet ezt a problémát oldani ip/iptables segítségével? _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
PÁSZTOR György wrote: > Hi! > > "Gabor HALASZ" írta 2008-12-15 16:58-kor: >>> > iptables -t nat -A POSTROUTING -p tcp -m tcp --dport akarmelyik -j >>> MASQUERADE >>>Sajnos ez sem működik. >> Nem is fog. Mire az output chainben a mangle table sorra kerul, mar tul >> van a routing decision-on, es onnan meg par lepes a nat table, plane az >> postrouting chain. > Ok. De abból indultunk ki, hogy előtte már ip rule-al az adott forgalmat > beletette explicit az adott táblába. Azt a reszet ertem a legkevesbe, marmint azt, hogy mit akart vele. > > Szóval nem értem hol a probléma, mert ennek már kellene működnie. > Mire az output chainbe kerul a csomag, mar eldontotte az (iptables)router, hogy melyik interface-en at fog tavozni. iptables faq, traversingoftables. -- Gabor HALASZ _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
Hi! "Gabor HALASZ" írta 2008-12-15 16:58-kor: > > > iptables -t nat -A POSTROUTING -p tcp -m tcp --dport akarmelyik -j > > MASQUERADE > >Sajnos ez sem működik. > > Nem is fog. Mire az output chainben a mangle table sorra kerul, mar tul > van a routing decision-on, es onnan meg par lepes a nat table, plane az > postrouting chain. Ok. De abból indultunk ki, hogy előtte már ip rule-al az adott forgalmat beletette explicit az adott táblába. Szóval nem értem hol a probléma, mert ennek már kellene működnie. Üdv:Gyur! _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
linux wrote: > Kedves Gyur! > > > iptables -t nat -A POSTROUTING -p tcp -m tcp --dport akarmelyik -j > MASQUERADE >Sajnos ez sem működik. Nem is fog. Mire az output chainben a mangle table sorra kerul, mar tul van a routing decision-on, es onnan meg par lepes a nat table, plane az postrouting chain. -- Gabor HALASZ _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
linux wrote: > Kedves Gyur! > > > A postfix-nek emlékeim szerint meg lehet mondani, mely interfészekre >qmail-em van. > http://rno-consultores.com/mail/qmail/qmail-1.03_outgoingips.patch -- Gabor HALASZ _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
Kedves Gyur! > iptables -t nat -A POSTROUTING -p tcp -m tcp --dport akarmelyik -j MASQUERADE Sajnos ez sem működik. > Egyébként squid-nek is... Igen: tcp_outgoing_address; qmil: qmail-remote-outgoingip.diff.gz Se a qmail-t, se a squid-et nem nagyon szeretném konfigurálgatni, mert remélem, hogy ez a route-olási probléma az ip/iptables segedelmével csak megoldható; hátha. Köszi: --miklos _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
Hi! "linux" írta 2008-12-14 20:05-kor: > > A postfix-nek emlékeim szerint meg lehet mondani, mely interfészekre >qmail-em van. Az majdnem olyan jó. Szerintem azt is lehet konfigurálni, bár tény, hogy macerásabb lehet. > > postrouting-ban még elsimítod egy masq-al. >// van másom is: a 80, 443 portokat az upc-n kívánom. >Ehhez buta vagyok; hogyan? Noss, ha ip rule-al explicit odatetted, _és_ ennyitől még nem működött, akkor: iptables -t nat -A POSTROUTING -p tcp -m tcp --dport akarmelyik -j MASQUERADE Egyébként squid-nek is meg lehet mondani melyik interfészről indítsa a kifelé menő kapcsolatokat, így amiatt nem fog kelleni MASQ. Üdv:Gyur! _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
Kedves Gyur! > A postfix-nek emlékeim szerint meg lehet mondani, mely interfészekre qmail-em van. > postrouting-ban még elsimítod egy masq-al. // van másom is: a 80, 443 portokat az upc-n kívánom. Ehhez buta vagyok; hogyan? Kösz: --miklos PÁSZTOR György wrote: > Hi! > > "li...@avia.kfkipark.hu" írta 2008-12-14 19:21-kor: >> A multi-route-olassal nics semmi gond. >> >> Viszont egyes cel-portokat a megadott szolgaltaton keresztul >> szeretnem elerni. Pl.: a 25-os porot a tcom-on keresztul szeretnem elerni. >> >> // A gateway-en mail server, squid cache van, tehat nincs nat-olas. > A postfix-nek emlékeim szerint meg lehet mondani, mely interfészekre > bind-oljon, ill. mely interfészre bindolva kézbesítsen. > >> Amit tettem: >> o ket route tablat hoztam letre: tcom, upc >> o ip rule add from ip_tcom table tcom >> ip route add default via ip_tcom_gw dev ppp0 src ip_tcom table tcom >> ip rule add from all fwmark 23 table tcom >> >> iptables -A POSTROUTING -t mangle -p tcp --dport 25 -j MARK --set-mark 23 >> >> Ez viszont nem mukodik. > Ha postfixen kívül van másod is, akkor még olyat lehet, hogy ip rule-al > explicit az adott portra kimenőt beletolod a megfelelő route táblába, és ha > az kevés neki (mert mégis a default interfész IP-jét adja src IP-nek), akkor > postrouting-ban még elsimítod egy masq-al. > > Üdv:Gyur! > _ > linux lista - linux@mlf.linux.rulez.org > http://mlf2.linux.rulez.org/mailman/listinfo/linux > > > _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux
Re: route port valasztas
Hi! "li...@avia.kfkipark.hu" írta 2008-12-14 19:21-kor: > A multi-route-olassal nics semmi gond. > > Viszont egyes cel-portokat a megadott szolgaltaton keresztul > szeretnem elerni. Pl.: a 25-os porot a tcom-on keresztul szeretnem elerni. > > // A gateway-en mail server, squid cache van, tehat nincs nat-olas. A postfix-nek emlékeim szerint meg lehet mondani, mely interfészekre bind-oljon, ill. mely interfészre bindolva kézbesítsen. > Amit tettem: > o ket route tablat hoztam letre: tcom, upc > o ip rule add from ip_tcom table tcom > ip route add default via ip_tcom_gw dev ppp0 src ip_tcom table tcom > ip rule add from all fwmark 23 table tcom > > iptables -A POSTROUTING -t mangle -p tcp --dport 25 -j MARK --set-mark 23 > > Ez viszont nem mukodik. Ha postfixen kívül van másod is, akkor még olyat lehet, hogy ip rule-al explicit az adott portra kimenőt beletolod a megfelelő route táblába, és ha az kevés neki (mert mégis a default interfész IP-jét adja src IP-nek), akkor postrouting-ban még elsimítod egy masq-al. Üdv:Gyur! _ linux lista - linux@mlf.linux.rulez.org http://mlf2.linux.rulez.org/mailman/listinfo/linux