Re: ip route + nat

2006-10-01 bef zés Hegedüs Ervin
hello,

> > SNAT helyett MASQUERADE volt - gondolom relevans kulonbseg nincs
> > ebben a kontextusban, de ugy sem mukodott.
> > (Akkor a cimforditas mukodott, de a def. routing tabla
> > ervenyesult, es elment a masik GW fele)
> 
> konfig szempontbol az SNAT az ip-re bindel (azaz kimeno csomagba a megadott 
> IP-t teszi)
> a MASQ pedig interfeszre bindel (azaz adott interfeszen levo ip-re)
> utobbit eppen ezert javasoljak dinamikus ipvel rendelkezo interfeszre 
> (adsl,dialup)
> 
> ez szamithat jelenleg?
statikus IP van minden IF-en, de imho mindegy, hogy IP-re vagy
IF-re csereli a fejlecben az IP-t.

Nemreg 'fedeztem' fel az iproute2-t, de ugy veszem eszre,
hogy ami szabaly ervenyesul az iptables-ben, es modosito hatasa
van, az nem kerul bele az iproute2 altal definialt/hasznalt
tablakba. Ez lehetseges?


a.


-- 
Minden baj forrása az 1/x függvény.
_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: ip route + nat

2006-10-01 bef zés Woodoo People .pGa!
> > > ps: iptables-ben ennyi van, ami relevans:
> > > 
> > > *nat
> > > :PREROUTING ACCEPT [0:0]
> > > :POSTROUTING ACCEPT [0:0]
> > > :OUTPUT ACCEPT [0:0]
> > > :teszt - [0:0]
> > > -A POSTROUTING -s 10.2.1.228 -j teszt
> > > -A teszt -j ACCEPT 
> > Majdnem jó, csak nem accept kéne, hanem SNAT, és --to-source arra az ip-re,
> > amihez csináltad a másik rt-t...
> 
> SNAT helyett MASQUERADE volt - gondolom relevans kulonbseg nincs
> ebben a kontextusban, de ugy sem mukodott.
> (Akkor a cimforditas mukodott, de a def. routing tabla
> ervenyesult, es elment a masik GW fele)

konfig szempontbol az SNAT az ip-re bindel (azaz kimeno csomagba a megadott 
IP-t teszi)
a MASQ pedig interfeszre bindel (azaz adott interfeszen levo ip-re)
utobbit eppen ezert javasoljak dinamikus ipvel rendelkezo interfeszre 
(adsl,dialup)

ez szamithat jelenleg?

-- 
WoodOO-[P]an[G]alaktikan[A]gent-People <][> http://shadow.pganet.com
[EMAIL PROTECTED]@RedHat.users
_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: ip route + nat

2006-10-01 bef zés Andras HORVATH

Hegedüs Ervin <[EMAIL PROTECTED]> wrote:

> a main es a local miert jatszik? az elso levelben leirt -

csupan amiatt volt erdekes, hogy eltala-e a csomag a nat-os tablaig.

> amiben (szinten) szepen latszik, hogy arra megy, amerre kell, es
> ott meg latszik a 'masq' opcio is, de a 'kinti' router
> interfeszen futtatott tcpdump-ban a forras cime 10.2.1.228.

hm. debug otlet: ha a forras-natolos szabaly _helyere_ azt rakod, hogy
ip rule add blackhole from 10.2.1.228, akkor is kimegy a csomag? :)

raas
-- 
Those who say it cannot be done should not interrupt the person doing it.
   -- Chinese proverb

_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: ip route + nat

2006-09-30 bef zés Hegedüs Ervin
hello,

> jaes...
> 
> ip route flush cache
> 
> ugye volt? :)

konkretan nem, de ahogy a masik levelben irtam

ip route show cache volt, es ott feltunt, hogy ha bizonyos
iranybol/iranyba nincs forgalom, akkor urul a routing cache, azaz
nem latszik a show cache kimeneteben.
Aztan elmegy egy ping, es mar szerepel is.

Ezert nem hasznaltam, bar olvastam ezt is a doksiban.


a.
 

-- 
Minden baj forrása az 1/x függvény.
_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: ip route + nat

2006-09-30 bef zés Hegedüs Ervin
hello,
 
> > itt: http://linux-ip.net/html/nat-stateless.html olvastam ezt:
> > 'ip rule add nat 205.254.211.17 from 192.168.100.17'
> > 
> > ...This rule will cause the kernel rewrite any packet from
> > 192.168.100.17 with the specified source address
> 
> hopp, neked van igazad, felreolvastam.
:)
 
> akkor viszont jo kerdes, hogy miert nem mukodik. Ezekbol nem derul ki
> valami (miert kellett egy kulon tabla? beletalalnak a csomagok?)

- azert kellett kulon tabla, mert a gepben levo 3 fizikai interfeszen
  6 v 7 IP cim van, ugyanennyi halozattal :), de a 6 v 7 halobol
  ketto ket (egy-egy) szolgaltatoe, es megvan, hogy honnan hova kell
  routolni a csomagokat (policy routing)
- ez mukodik is, tehat beletalalnak a csomagok a tablaba, ahonnan
  a routing alapjan amugy kimegy a megfelelo iranyba, az ott
  beallitott GW mefelelo IF-re iranyitott csomagok latszodnak a
  tcpdump-ban.

> ip ru li
> ip ro li table main
> ip ro li table local

(ezek kimenetet hetfon tudom elkuldeni, ha kell)
a main es a local miert jatszik? az elso levelben leirt -
relevans - tabla es rule konfig alapjan sem a main, sem a local
nem erintett ennel a csomagnal. Amugy van olyan is, hogy

ip route show cache

amiben (szinten) szepen latszik, hogy arra megy, amerre kell, es
ott meg latszik a 'masq' opcio is, de a 'kinti' router
interfeszen futtatott tcpdump-ban a forras cime 10.2.1.228.


imho vagy bazira nem latok valamit (apro betus, csillaggal jelolt
leirast...), vagy az iproute/iptables paros vmiert osszeakad
(szvsz, de ez csak okoskodas)


koszi:
a.


-- 
Minden baj forrása az 1/x függvény.
_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: ip route + nat

2006-09-30 bef zés Andras HORVATH

Andras HORVATH <[EMAIL PROTECTED]> wrote:

jaes...

ip route flush cache

ugye volt? :)

raas
-- 
Those who say it cannot be done should not interrupt the person doing it.
   -- Chinese proverb

_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: ip route + nat

2006-09-30 bef zés Andras HORVATH

Hegedüs Ervin <[EMAIL PROTECTED]> wrote:

> itt: http://linux-ip.net/html/nat-stateless.html olvastam ezt:
> 'ip rule add nat 205.254.211.17 from 192.168.100.17'
> 
> ...This rule will cause the kernel rewrite any packet from
> 192.168.100.17 with the specified source address

hopp, neked van igazad, felreolvastam.

akkor viszont jo kerdes, hogy miert nem mukodik. Ezekbol nem derul ki
valami (miert kellett egy kulon tabla? beletalalnak a csomagok?)

ip ru li
ip ro li table main
ip ro li table local

raas

(akik iptablest javasoltak: az iproute-os NAT-nak semmi koze az
iptables/netfilterhez. Az egy masik NAT implementacio, ugy is lehetne
csinalni, de elvileg ez kevesebb eroforrast fogyaszt, viszont butabb,
leven allapotmentes)

-- 
Those who say it cannot be done should not interrupt the person doing it.
   -- Chinese proverb

_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: ip route + nat

2006-09-30 bef zés Hegedüs Ervin
hello,
 
> > ps: iptables-ben ennyi van, ami relevans:
> > 
> > *nat
> > :PREROUTING ACCEPT [0:0]
> > :POSTROUTING ACCEPT [0:0]
> > :OUTPUT ACCEPT [0:0]
> > :teszt - [0:0]
> > -A POSTROUTING -s 10.2.1.228 -j teszt
> > -A teszt -j ACCEPT 
> Majdnem jó, csak nem accept kéne, hanem SNAT, és --to-source arra az ip-re,
> amihez csináltad a másik rt-t...

SNAT helyett MASQUERADE volt - gondolom relevans kulonbseg nincs
ebben a kontextusban, de ugy sem mukodott.
(Akkor a cimforditas mukodott, de a def. routing tabla
ervenyesult, es elment a masik GW fele)


Koszi:

a.
 

-- 
Minden baj forrása az 1/x függvény.
_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: ip route + nat

2006-09-30 bef zés PÁSZTOR György
Hi!

"Hegedüs Ervin" <[EMAIL PROTECTED]> írta 2006-09-29 13:38-kor:
> Mit benazok?
> ps: iptables-ben ennyi van, ami relevans:
> 
> *nat
> :PREROUTING ACCEPT [0:0]
> :POSTROUTING ACCEPT [0:0]
> :OUTPUT ACCEPT [0:0]
> :teszt - [0:0]
> -A POSTROUTING -s 10.2.1.228 -j teszt
> -A teszt -j ACCEPT 
Majdnem jó, csak nem accept kéne, hanem SNAT, és --to-source arra az ip-re,
amihez csináltad a másik rt-t...

Üdv:Gyur!
-- ---[ Free Software ISOs - http://www.fsn.hu/?f=download ]--- --
PÁSZTOR György e-mail: [EMAIL PROTECTED]
Free Software Network (FSN.HU)  cell.: +3620 512 3335
_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: ip route + nat

2006-09-29 bef zés Hegedüs Ervin
hello,

> > ip rule add nat 1.2.3.4 from 10.2.1.228 table T2
> 
> ...majd ezutan panaszkodsz hogy a 10.2.1.228-rol megy tovabb a csomag.
> Hat ha egyszer direkt erre kerted szegenyt? Oda azt a cimet ird, amire
> szeretned, hogy (s)natoljon.

itt: http://linux-ip.net/html/nat-stateless.html olvastam ezt:
'ip rule add nat 205.254.211.17 from 192.168.100.17'

...This rule will cause the kernel rewrite any packet from
192.168.100.17 with the specified source address
(205.254.211.17). Any packet originating from 192.168.100.17
which passes through this router will trigger this rule. In
short, this command rewrites the source address of outbound
packets so that they appear to originate from the NAT IP.

ebbol gondolom azt, hogy eloszor a NAT-olt cimet kell megadni,
majd azt, _amit_ szeretnek cserlni.

Ha jol ertelek, te azt irod, hogy forditva van, tehat helyesen
igy lenne:

ip rule add nat 10.2.1.228 from 1.2.3.4 table T2?


Koszi:

a.


-- 
Minden baj forrása az 1/x függvény.
_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: ip route + nat

2006-09-29 bef zés Andras HORVATH

Hegedüs Ervin <[EMAIL PROTECTED]> wrote:

>> ip rule add nat akarmi FROM 99.88.77.66
> 
> na akko' megecce' az eredeti level:
> 
> ip rule add nat 1.2.3.4 from 10.2.1.228 table T2

...majd ezutan panaszkodsz hogy a 10.2.1.228-rol megy tovabb a csomag.
Hat ha egyszer direkt erre kerted szegenyt? Oda azt a cimet ird, amire
szeretned, hogy (s)natoljon.

raas
-- 
Those who say it cannot be done should not interrupt the person doing it.
   -- Chinese proverb

_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: ip route + nat

2006-09-29 bef zés Hegedüs Ervin
hello,

> > Mit benazok?
> 
> Nem talán a PREROUTING chain-ben kellene lennie a NAT szabálynak?
milyen szabalynak kellene ott lennie szerinted?

(ugy tudom, a PREROUTING-ban DNAT-ot lehet megvalositani, nekem
pedig SNAT kell!!!)


a.
 

-- 
Minden baj forrása az 1/x függvény.
_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: ip route + nat

2006-09-29 bef zés Hegedüs Ervin
hello,
 
> > ez alapjan a 10.2.1.228-rol indulo csomag kimegy a megadott
> > router fele, de az eredeti forras cimmel.
> 
> miert, mondtad neki valahol, hogy mas cimmel menjen ki? :)
> 
> ip rule add nat akarmi FROM 99.88.77.66

na akko' megecce' az eredeti level:

===
Igy probalkozom:

ip rule add nat 1.2.3.4 from 10.2.1.228 table T2
ip route add nat 1.2.3.4 via 10.2.1.228 table T2
ip route add 10.2.1.228/32 dev eth0.10 table T2
ip route add 1.2.3.0/27 dev eth2.997 table T2
ip route add default via 1.2.3.1 dev eth2.996 table T2
===

es az elso sor megint:
ip rule add nat 1.2.3.4 from 10.2.1.228 table T2

:)) 

vagy table-be ilyet nem lehet? vagy lehet, csak nincs hatasa?
vagy felreertem az metodusat. :)


a.


-- 
Minden baj forrása az 1/x függvény.
_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: ip route + nat

2006-09-29 bef zés Andras HORVATH

Hegedüs Ervin <[EMAIL PROTECTED]> wrote:

> ez alapjan a 10.2.1.228-rol indulo csomag kimegy a megadott
> router fele, de az eredeti forras cimmel.

miert, mondtad neki valahol, hogy mas cimmel menjen ki? :)

ip rule add nat akarmi FROM 99.88.77.66

raas
_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf2.linux.rulez.org/mailman/listinfo/linux


Re: ip route + nat

2006-09-29 bef zés feri


Hegedüs Ervin wrote:
> hello,
>
>
>
> Mit benazok?

Nem talán a PREROUTING chain-ben kellene lennie a NAT szabálynak?


>
>
> Koszi:
>
> a.
>
>
> ps: iptables-ben ennyi van, ami relevans:
>
> *nat
> :PREROUTING ACCEPT [0:0]
> :POSTROUTING ACCEPT [0:0]
> :OUTPUT ACCEPT [0:0]
> :teszt - [0:0]
> -A POSTROUTING -s 10.2.1.228 -j teszt
> -A teszt -j ACCEPT
>
> _
> 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