iptables forward port 8080 to port 80
Hi, I'm trying to port forward for my custom server. I'm using Apache for a test cos my custom built server is slightly alpha at the moment and I know apache is a stable server. I'm port forwarding port 8080 to port 80 with Apache and Iptables.
On the Loopback interface, I can connect to port 8080 which I've forwarded to port 80, so everything works on Loopback.
However, I have a computer in the loungeroom which is on a different ISP, and ive tried connecting to port 8080 on the server machine, it does not work. It can only connect to port 80 (and 50000 if my custom server is running).
So it works for Loopback, but not remotely.
Which is a bit strange because ive set up the same rules for both the lo and eth0 interfaces.
Here are my rules -
#!/bin/bash
/sbin/iptables --flush
/sbin/iptables -t nat --flush
/sbin/iptables -t mangle --flush
/sbin/iptables -t nat --policy OUTPUT ACCEPT
/sbin/iptables -t nat --policy PREROUTING ACCEPT
/sbin/iptables -t nat --policy POSTROUTING ACCEPT
iptables -A INPUT -p tcp --dport 50000 -j ACCEPT
iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
#apache eth0
iptables -t nat -A OUTPUT -o eth0 -p tcp --dport 8080 -j REDIRECT --to-port 80
#apache loopback
iptables -t nat -A OUTPUT -o lo -p tcp --dport 8080 -j REDIRECT --to-port 80
#######my custom server stuff#########
iptables -t nat -A OUTPUT -o lo -p tcp --dport 50001 -j REDIRECT --to-port 50000
#9 more similar port forwards to port 50000
iptables -t nat -A OUTPUT -o eth0 -p tcp --dport 50001 -j REDIRECT --to-port 50000
#9 more similar port forwards to port 50000
Any help would be appreciated.