Skip to contentSkip to conversation

is it possible only with iptables

DISCUSSION Petre Bandac 2 participants 2 messages Dec 10, 2003 – Dec 11, 2003

lore
Share & tools
lore
#0 lore raw

I have 2 linux machines - linux_1 and linux_2

linux_1 has behind it a subnet with routable adresses (not private)

I want that all the traffic incoming from the subnet behind linux_1 and going to port 80 to be redirected to linux_2, and from linux_2 go on the internet

I presumed that a -j SNAT --to-source IP_linux_2 should be enough, but apparently it isn't

should I issue a SNAT rule on linux_2 too, or it should run something like squid there ?

thanks in advance,

petre

Signature · 6 lines
Login: petre          			Name: Petre Bandac
Directory: /home/petre              	Shell: /usr/local/bin/zsh
On since Tue Dec  9 10:15 (EET) on ttyv0, idle 1 day 9:08 (messages off)
Last login Wed Dec 10 16:05 (EET) on ttyp3 from ns.rdsbv.ro
No Mail.
No Plan.
#1 lore raw
Quoted 10 lines · Petre Bandac

I have 2 linux machines - linux_1 and linux_2

linux_1 has behind it a subnet with routable adresses (not private)

I want that all the traffic incoming from the subnet behind linux_1 and going to port 80 to be redirected to linux_2, and from linux_2 go on the internet

I presumed that a -j SNAT --to-source IP_linux_2 should be enough, but apparently it isn't

If you want to redirect packets which would normally go somewhere else, so that they go to machine linux_2 instead, this is either DNAT, or a routing table question (using something slightly more sophisticated than usual, such as source-based routing and iproute2).

DNAT will clearly send the packets to linux_2 for you, but then they won't go any further, because they've reached their destination.

Quoted 2 lines

should I issue a SNAT rule on linux_2 too, or it should run something like squid there ?

Maybe you should run something like squid there - tell us why you want the port 80 packets specifically to go via linux_2 rather than any other route from linux_1 to the Internet....

Antony.

Signature · 6 lines
Most people are aware that the Universe is big.

 - Paul Davies, Professor of Theoretical Physics

                                                     Please reply to the list;
                                                           please don't CC me.