Hi all, I'm not a linux admin..so..here I am stumbling around setting up my first vps..who woulda thunk?
I'm basically just trying to forward 80 ->8080.
I can indeed get it to do this..but to do so I have to also open up port 8080, which I don't really want to do, surely there is a way to actually forward this properly..any pointers greatly appreciated
(As a side note: I'm not sure why..but even when running tomcat as root directly on port 80...it wouldn't let me., well it worked as root, until I rebooted the box..after that if I fire it up on port 80 tomcat/shell just exit when I attempt to start it.)
My Rules are shown below.
iptables -P INPUT ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
# OPEN PORT 80
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
# I DON'T WANT TO OPEN UP PORT 8080. #iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
#ACCEPT PACKETS ON EXISTING CONNECTIONS
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# REROUTE PORT 80 TO 8080
iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
# SET DEFAULT FORS INPUT/FORWARD/OUTPUT RULES
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT