Two IP's and forward a port - help.
I'm new with iptables but I would like some pointers.
My linode has two ip addresses (ipA and ipB) and I have two processes that I want to expose using port 80 (internally the process run as processA:80 and processB:8080)
So I would like to do this
ipA:80 -> processA:80 (webserver)
ipB:80 -> processB:8080 (test custom webserver)
Any info is appriciated… be gentle
Thanks
3 Replies
Check the documentation for the webserver daemon you're using. If it's Apache, it's the 'Listen' directive you'll want to read about.
iptables -t nat -A PREROUTING -p tcp -m tcp -d XXX.XXX.XXX.XXX --dport 80 -j REDIRECT --to-ports 8080
Replace XXX.XXX.XXX.XX with your second IP.
I used the example of webserver port 80 becuase i thought somebody had run in to it before. BUT that helped understand what the solution was.
I'm using a piece of code that does not have a way to bind to a specific IP (it will be fixed). But now I have a temp solution using iptables until it's fixed.
Thanks for answering these basic questions which made me realized what the real problem was and the temp solution.