Menu Home


Ubuntu 14.04

先强烈鄙视一下移动的宽带业务,各种不好用,最郁闷的是把VPN给封了。所以只能想别的方法来访问Google和Android developer了,在这里记录一下方法。

ssh -qTfnN -D 7070  [email protected]

这里的的端口号7070是任意(> 1024)你机器上的空闲端口。

然后打开Settings—-> Network控制面板,把SocksHost对接到本机的7070端口,就是在上一步中建立ssh隧道的端口:

在这里设置的proxy是系统级别的,你也可以通过你的浏览器来设置一些更详细的规则,这样会省一些proxy流量。不过我发现Chrome只能使用全局proxy,好在有SwitchySharp插件, firefox是可以设置自己的proxy的。



Argument Comment
-q Quiet mode. Causes all warning and diagnostic messages to be suppressed.
-T Disable pseudo-tty allocation.
-f Requests ssh to go to background just before command execution. This is useful if ssh is going to ask for passwords or passphrases, but the user wants it in the background. This implies -n The recommended way to start X11 programs at a remote site is with something like ssh -f host xterm.
-n Redirects stdin from /dev/null (actually, prevents reading from stdin). This must be used when ssh is run in the background. A common trick is to use this to run X11 programs on a remote machine. For example, ssh -n emacs will start an emacs on, and the X11 connection will be automatically forwarded over an encrypted channel. The ssh program will be put in the background. (This does not work if ssh needs to ask for a password or passphrase; see also the -f option.)
-N Do not execute a remote command. This is useful for just forwarding ports (protocol version 2 only).
-D port Specifies a local “dynamic” application-level port forwarding. This works by allocating a socket to listen to port on the local side, and whenever a connection is made to this port, the connection is forwarded over the secure channel, and the application protocol is then used to determine where to connect to from the remote machine. Currently the SOCKS4 protocol is supported, and ssh will act as a SOCKS4 server. Only root can forward privileged ports. Dynamic port forwardings can also be specified in the configuration file.

Categories: 系统管理

Tagged as:


Leave a Reply

Your email address will not be published.