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

My PC has two IP addresses. How can I forward incoming requests on port 80 to 8080 from one of my IP using iptables in CentOS ?

For example, I have ip addresses 1.1.1.1 and 2.2.2.2, I want to forward http://1.1.1.1 port 80 to port8080 and just for 1.1.1.1 but not 2.2.2.2.

How do I do this?

share|improve this question

migrated from stackoverflow.com Nov 12 '11 at 14:49

This question came from our site for professional and enthusiast programmers.

1 Answer 1

iptables -t nat -A PREROUTING -d 1.1.1.1 -p tcp --dport 80 -j DNAT --to-destination 1.1.1.1:8080
share|improve this answer

Your Answer

 
discard

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