Skip to contentSkip to conversation

how do I port forward through loopback?

DISCUSSION Mark 2 participants 3 messages May 18, 2004 – May 19, 2004

lore
Share & tools
lore

Mark

author
#0 lore raw

Hello,
I need to port forward all traffic locally going to port 80 to port 8040. For the external interface eth0 this works, I thought it would work for the internal/loopback as well. Nothing else is turned on , all other settings are open.

/sbin/iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8040

this doesn't work for the internal network, 127.0.0.1 lo, not sure why System info: Redhat7.3, 2.4.20 kernel, iptables-1.2.8-8.72.3 Thanks

#1 lore raw
Quoted 6 lines · Mark

Hello,
I need to port forward all traffic locally going to port 80 to port 8040. For the external interface eth0 this works, I thought it would work for the internal/loopback as well. Nothing else is turned on , all other settings are open.

Quoted 6 lines

/sbin/iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8040

this doesn't work for the internal network, 127.0.0.1 lo, not sure why System info: Redhat7.3, 2.4.20 kernel, iptables-1.2.8-8.72.3 Thanks

To get nat to work on the local interface you have to compile the kernel with local nat support. The catch is that normal nat stops working.

Signature · 7 lines
--
Raymond Leach <[email protected]>
Network Support Specialist
http://www.knowledgefactory.co.za
"lynx -source http://www.rchq.co.za/raymondl.asc | gpg --import"
Key fingerprint = 7209 A695 9EE0 E971 A9AD  00EE 8757 EE47 F06F FB28
--
#2 lore raw
In reply to Mark
Quoted 6 lines · Mark

Hello,
I need to port forward all traffic locally going to port 80 to port 8040. For the external interface eth0 this works, I thought it would work for the internal/loopback as well. Nothing else is turned on , all other settings are open.

Quoted 6 lines

/sbin/iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8040

this doesn't work for the internal network, 127.0.0.1 lo, not sure why System info: Redhat7.3, 2.4.20 kernel, iptables-1.2.8-8.72.3 Thanks

To get nat to work on the local interface you have to compile the kernel with local nat support. The catch is that normal nat stops working.

Signature · 7 lines
--
Raymond Leach <[email protected]>
Network Support Specialist
http://www.knowledgefactory.co.za
"lynx -source http://www.rchq.co.za/raymondl.asc | gpg --import"
Key fingerprint = 7209 A695 9EE0 E971 A9AD  00EE 8757 EE47 F06F FB28
--