Techie Hints

A place where to find tech solution

Port Redirection in Ubuntu Machine

If you want redirect the port from 80 to 8080,

Use this:
sudo iptables -t nat -A PREROUTING -p tcp –dport 80 -i eth0 -j REDIRECT –to-port 8080

If you want to delete entry for the redirection use following command line similar to above command line just observe the 3rd parameter for iptables.

Use this:
sudo iptables -t nat -D PREROUTING -p tcp –dport 80 -i eth0 -j REDIRECT –to-port 8080

-A: Refers to add entry to the iptable
-D: Refers to delete entry to the iptable

Remember if you want port redirection for other services in the same machine, just customize the above command line.

%d bloggers like this: