I have a server with multiple IP addresses associated with it. I'm trying to run a node.js web server (which I do not want to run as root), using only one of those ip addresses (it would be very bad if the traffic from all the ip addresses were forwarded).
Through searching superuser, it looked like this could be possible with iptables:
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 --source 212.333.111.222 -j REDIRECT --to-port 9020
However, I do not understand why eth0 is needed.
this could be done with:
iptables -t nat -A PREROUTING -p tcp --dport 2525 -j REDIRECT --to-ports 25
What is the correct way of forwarding traffic from a single ip on port 80, lets say 220.127.116.11:80 to another port on the same server, lets say 18.104.22.168:8765?
thanks for your help!