Poor man's VPN / SSH SOCKS proxy config / Dynamic port forwarding

Scenario :  LAN1 = 192.168.0.0/24
#Machine1 doesnt have access to internet & LAN1

#Machine2 RHEL6 SSH srv has access to internet and LAN1

Task :
browse internet securely through ssh connection/SOCKS proxy/Dynamic port forwarding
--------------------------In server-----------------------
enable packet forwarding/ Masquerading 
<for temporary>
@SRV #echo 1 > proc/sys/net/ipv4/ip_forward

<for permanent>
@SRV #vim /etc/sysctl.conf
net.ipv4.ip_forward = 1

@SRV #iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE

@SRV #service iptables save

 ------------------------In client --machine 1------------------------

 #ssh  -D  9001  user@192.168.0.100      
9001 is machine1 local port (you can put any free/un-used port)


In firefox(chrome or other browsers ) go to settings, network,manual proxy settings --> 
socks host = Localhost
port = 9001  (defined above)
socksv5

see below for working screen shot + configuration is same if you are connecting to internet from unsecure connections ..(your ssh server need to have public ip address) --this method is also known as poor mans VPN








 






No comments:

Post a Comment