This post will show how to browse internet from your VPS using your local browser over SSH Tunneling. This is helpful to access some local IP restricted resource or to enjoy a personal VPN. Installing Graphical User Interface (Like XServer and VNC) and Internet browser into VPS is one option which creates huge unnecessary overloads and badly slow down the server. So, better alternate is using SSH based tunnel to pass local browser traffic via VPS over encrypted connection.
Difficulty: Easy, Â Â Time Require: 5 minutes (when prerequisites are fulfilled)
- openssh-server is installed in VPS (In this tutorial we’ve used a CentOS VPS)
- Local computer is in Windows platform
- Putty installed in local computer. (Download Putty: Select Putty.exe in download page)
- Local ISP is not blocking traffic with destination port 22.
Step 1: Login to VPS using your existing settings and allow necessary connection to and from VPS via IPTABLES using the following commands. “RELATED, ESTABLISHED” will allow INPUT packet into VPS over already established tcp connections.
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT iptables -A OUTPUT -p tcp -m tcp --sport 22 -j ACCEPT iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A INPUT -m state --state NEW -p tcp --dport 22 -j ACCEPT service iptables save service iptables restart
Step 2: Download “Putty” from putty.org using this link and install. Enter IP address or host name and host port then click on SSH option.
Step 3: Check “Enable Compression“, to reduce data usage. Then expand “SSH” Option and click “Tunnel“. Enter a “Source Port” say 9090, Select “Dynamic” click “add” and “Open” the connection. This will let any application to exchange packet over SSH Tunnel, while pointed towards localhost:9090 via socks proxy
Step 4: Point local Browser, Say Firefox to localhost:9090 via SOCKS proxy. In Firefox Click
Menu–> Options–> Advanced–> Networks–> Settings and select “Manual Proxy Configuration”. Select “SOCKS” proxy. Use “localhost” as SOCKS Host and port 9090. You’ll be browsing using your VPS’s IP now. (Read here for details guide of step 4)
Check yourIP address at iplocation.net.
NOTE: Use SOCKS proxy only. Read here to use socks proxy for the whole system instead browser only.