Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | 雲棲社區 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Github | Search | About

43.4. OpenSSH Tunnel

mysql tunnel

$ ssh -L 3306:127.0.0.1:3306 user@example.org
		

testing

$ mysql -h 127.0.0.1 -uroot -p test
		

43.4.1. SOCKS v5 Tunnel

			
ssh -D 1080 <遠程主機地址>
or
ssh -D 7070 <遠程主機地址>
			
			

I prefer 1080 to 7070. the reason is 1080 default for SOCKS port.

ssh neo@www.example.com -D 1080
			
			
ssh -D 1080 -f -C -q -N neo@example.com			
			
			



Explanation of arguments

-D: Tells SSH that we want a SOCKS tunnel on the specified port number (you can choose a number between 1025-65536)
-f: Forks the process to the background
-C: Compresses the data before sending it
-q: Uses quiet mode
-N: Tells SSH that no command will be sent once the tunnel is up