* Routing HTTP Through Another Link
@ 2009-08-31 18:30 Diogo Sperb Schneider
2009-09-01 5:55 ` Marek Kierdelewicz
0 siblings, 1 reply; 6+ messages in thread
From: Diogo Sperb Schneider @ 2009-08-31 18:30 UTC (permalink / raw)
To: netfilter
Greetings!
I'd like to route my HTTP traffic (ports 80 and 443) through a separate link, but I'm not sure if I must use the ROUTE target or even how to use it.
My main link has it's own static IP address, so I have SNAT doing the address translation. (working)
My second link is a dynamic-IP DSL, so I believe NAT rules will need MASQUERADE instead.
Could somebody please post a sample ruleset that does the trick?
Many thanks in advance.
Best regards,
Diogo
_________________________________________________________________
Acesse seu Hotmail de onde quer que esteja através do celular. Clique aqui.
http://www.windowslive.com.br/celular/home.asp?utm_source=MSN_Hotmail&utm_medium=Tagline&utm_campaign=MobileServices200908
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Routing HTTP Through Another Link
2009-08-31 18:30 Routing HTTP Through Another Link Diogo Sperb Schneider
@ 2009-09-01 5:55 ` Marek Kierdelewicz
[not found] ` <BLU116-W61B4883A90045AEF7BDB6A2F10@phx.gbl>
0 siblings, 1 reply; 6+ messages in thread
From: Marek Kierdelewicz @ 2009-09-01 5:55 UTC (permalink / raw)
To: Diogo Sperb Schneider, netfilter
>Greetings!
Hello Diogo!
>I'd like to route my HTTP traffic (ports 80 and 443) through a separate
>link, but I'm not sure if I must use the ROUTE target or even how to
You can use policy routing with MARK:
iptables -t nat -A PREROUTING -i LAN_INTERFACE -m multiport --dport
80,443 -j MARK --set-mark 0x10
iptables -t nat -A POSTROUTING -o WWW_ONLY_LINK -j MASQUERADE
ip ru add fwmark 0x10 table 100 prio 100
ip ro add default via WWW_LINK_GW table 100
assumption: WWW_LINK_GW (gateway address of www-onlu link) is always
the same
Be sure to place MASQ rule before SNAT rule you've written about or
specify an output interface in SNAT rule.
You can find "ip" in "iproute2" package in any distro I think.
Best regards,
Marek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Routing HTTP Through Another Link
@ 2009-09-11 14:30 Diogo Sperb Schneider
2009-09-11 18:19 ` Diogo Sperb Schneider
2009-09-13 6:49 ` Marek Kierdelewicz
0 siblings, 2 replies; 6+ messages in thread
From: Diogo Sperb Schneider @ 2009-09-11 14:30 UTC (permalink / raw)
To: netfilter
Greetings!
I gave up on that old web-based firewall and now I'm running plain
CentOS 4.8 with 3 ethernet adapters:
eth0 = LAN
eth1 = WAN
eth2 = ADSL
So I tried the following:
ip route add default via 189.30.16.65 dev eth1 table WAN # < 1 in
/etc/iproute2/rt_tables
ip route add default via 192.168.2.1 dev eth2 table ADSL # < 2 in
/etc/iproute2/rt_tables
ip rule add from all fwmark 1 table WAN
ip rule add from all fwmark 2 table ADSL
iptables -t mangle -I PREROUTING -i eth0 -p tcp --dport 80 -j MARK
--set-mark 2 # Tried with -I and -A with same effect
(Got those from the Linux Advanced Routing mini HOWTO)
Still, when I browse IP detection websites I get my WAN IP address.
Just for the record; My other relevant netfilter rules are:
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source
189.30.16.66 # <- my adapter's IP address
iptables -t nat -A POSTROUTING -o eth2 -j SNAT --to-source
192.168.2.254 # <- my adapter's IP address
iptables -A FORWARD -i eth0 -p tcp --dport 80 -j ACCEPT # HTTP
Many thanks for reading!
Diogo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-09-13 6:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-31 18:30 Routing HTTP Through Another Link Diogo Sperb Schneider
2009-09-01 5:55 ` Marek Kierdelewicz
[not found] ` <BLU116-W61B4883A90045AEF7BDB6A2F10@phx.gbl>
[not found] ` <20090901135848.793936a7@catlap>
2009-09-01 16:42 ` Diogo Sperb Schneider
-- strict thread matches above, loose matches on Subject: below --
2009-09-11 14:30 Diogo Sperb Schneider
2009-09-11 18:19 ` Diogo Sperb Schneider
2009-09-13 6:49 ` Marek Kierdelewicz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.