it.comp.os.linux.sys

Re: Iptables e NAT su due reti


On 10/19/2011 06:54 PM, TyLeR_dUrDeN wrote:
> Renaissance ha scritto:
>
>> Guarda il natting c'entra ben poco per cio' che vuoi ottenere: se il
>> routing sulla linux box e' abilitato, ed i pc delle varie reti hanno
>> come gateway l'indirizzo ip dell'interfaccia della linux box che si
>> "affaccia" sulla medesima rete, tutti i pc di tutte le reti collegate
>> alla linux box *devono* comunicare, senza nessun utilizzo di
>> netfilter/iptables.
>
> Uhm...no.
> Forse non mi sono spiegato bene.
Direi proprio di no....
> Io ho una rete 192.168.10.x ed ho bisogno che questa vada per la
....
> Quindi se io da una macchina che si trova sulla 192.168.0.x devo andare su
Ma ? la rete 10 o la rete 0???
Fammi capire:
Prendi il disegno fidocad seguente (per vederlo se non hai fidocad
installato puoi usare http://pot.potorti.it/fidocad/)
------------------------
[FIDOCAD]
RV 155 115 75 105 0
RV 230 155 150 145 0
RV 305 115 225 105 0
RV 205 135 205 135 0
RV 205 130 175 95 0
SA 175 110 0
SA 155 110 0
SA 205 110 0
SA 225 110 0
SA 190 130 0
SA 190 145 0
LI 155 110 175 110 0
LI 205 110 225 110 0
LI 190 130 190 145 0
PV 260 145 255 155 285 155 280 145 280 130 260 130 260 145 270 145 280 145 0
PV 155 185 150 195 180 195 175 185 175 170 155 170 155 185 165 185 175 185 0
TY 228 107 4 3 0 0 0 * 192.168.2.0/24 (rete B)
TY 153 147 4 3 0 0 0 * 192.168.0.0/24 (rete X)
TY 176 104 4 3 0 0 0 * eth1
TY 78 107 4 3 0 0 0 * 192.168.1.0/24 (rete A)
TY 191 109 4 3 0 0 0 * eth2
TY 183 124 4 3 0 0 0 * eth0
EV 105 75 85 55 0
BE 90 56 95 60 95 70 90 74 0
BE 100 56 95 60 95 70 100 74 0
EV 295 75 275 55 0
BE 280 56 285 60 285 70 280 74 0
BE 290 56 285 60 285 70 290 74 0
SA 95 75 0
SA 95 105 0
SA 285 75 0
SA 285 105 0
LI 95 75 95 105 0
LI 185 70 185 70 0
LI 285 75 285 105 0
PV 100 145 95 155 125 155 120 145 120 130 100 130 100 145 110 145 120 145 0
SA 110 130 0
SA 110 115 0
SA 270 130 0
SA 270 115 0
SA 165 170 0
SA 165 155 0
LI 110 130 110 115 0
LI 165 170 165 155 0
LI 270 130 270 115 0
LI 95 55 135 25 0
LI 135 25 130 40 0
LI 130 40 165 10 0
LI 165 10 165 10 0
LI 250 25 285 55 0
LI 250 25 255 40 0
LI 255 40 220 10 0
TY 105 55 4 3 0 0 0 * Router A
TY 250 55 4 3 0 0 0 * Router B
TY 95 155 4 3 0 0 0 * Server A
TY 150 195 4 3 0 0 0 * Server X
TY 255 155 4 3 0 0 0 * Server B
TY 206 104 4 3 0 0 0 * .1
TY 168 110 4 3 0 0 0 * .1
TY 190 130 4 3 0 0 0 * .1
TY 270 125 4 3 0 0 0 * .10
TY 165 165 4 3 0 0 0 * .10
TY 110 125 4 3 0 0 0 * .10
TY 80 75 4 3 0 0 0 * .254
TY 270 75 4 3 0 0 0 * .254
EV 230 195 210 175 0
BE 215 176 220 180 220 190 215 194 0
BE 225 176 220 180 220 190 225 194 0
SA 220 175 0
LI 230 185 255 190 0
LI 220 155 220 175 0
TY 230 175 4 3 0 0 0 * Router X
TY 205 170 4 3 0 0 0 * .254
SA 220 155 0
LI 255 190 240 195 0
LI 240 195 295 205 0
--------------------------------------------
E' corretto il disegno (al netto degli indirizzi IP)?
Esiste il router segnato come Router X oppure no?
> Le maccchine che si trovano sulla rete A hanno un gateway che NON ?
> l'indirizzo di eth1 cos? come le macchine della rete B hanno un gateway
> che NON ? l'indirizzo di eth2.
# sysctl -w net.ipv4.ip_forward=1
# iptables -t nat -I POSTROUTING -o eth2 -j MASQUERADE
# iptables -t nat -I POSTROUTING -o eth1 -j MASQUERADE
# iptables -I FORWARD -i eth0 -o eth2 -j ACCEPT
# iptables -I FORWARD -i eth0 -o eth1 -j ACCEPT
# ip route add 0.0.0.0/0 via [gateway_A] dev eth1
# ip route add [ip_server_via_B]/32 via [gateway_B] dev eth2
L'ultima la ripeti per tutti i server per i quali vuoi transitare dalla
rete B. Se per? il default router della macchina deve essere sulla rete
192.168.0.0/24 (ovvero non pu? essere sulla rete A) allora bisogna
configurare il source routing.
--
Flavio Visentin
Scientists have finally discovered what's wrong with the female brain:
on the
left side, there's nothing right, and on the right side, there's nothing
left.




Written by THe_ZiPMaN 19/10/2011 20.18.09
Check some pics on this site!
24/05/2012 17.25.28