Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a ubuntu box behind NAT, with a static ip, and I want to redirect any connections coming from my 10.0.0.123 machine to my public ip to redirect back to localhost (my 10.0.0.123 machine).

How can I set up packet routing, so that all traffic from localhost to my external ip is routed back to localhost? (transparent for any application)

share|improve this question

1 Answer 1

up vote 0 down vote accepted

My iptables is a little rusty, so I'm not 100% sure this will work. You could try this:

iptables -t nat -A PREROUTING  -p tcp -d <public ip> -j DNAT --to 127.0.0.1
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.