Ubuntu – Port Forwarding Custom ports using IPTables

squidUbuntu

I have a server that is setup with a squid proxy on ubuntu 9 and handles users browsing the net via squid, this is working perfectly for me.

Now a user on my network wants to use a application to connect to the net but the port the application uses is port 80. Since i dont want to allow them direct access to the internet how can i get the application to use the proxy server. Also will i need to modify the server in anyway.

Best Answer

Does this software need to send traffic inbound or outbound on port 80?

I'd suspect it would require the software to support using proxy servers unless it only requires outbound traffic and can work with transparent proxying with iptables. i.e. running squid on port 3128, then forward all port 80 traffic being routed from your network via the proxy, through 3128 and out to the internet instead.

[ iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128 ]