she*_*ter 79
为了做你想做的事,我推荐sshuttle。
你像这样使用它:
./sshuttle -r username@sshserver 0.0.0.0/0 -vv
Run Code Online (Sandbox Code Playgroud)
它会自动为您隧道传输所有 TCP 流量。您可以添加--dns
参数以使其也隧道传输您的 DNS 流量。远程服务器只需要安装 Python。
如果您只想隧道特定程序,我会推荐proxychains。
安装完成后,像这样启动你的 ssh 袜子代理:
ssh -fNTD 127.0.0.1:<local port> username@sshserver
Run Code Online (Sandbox Code Playgroud)
这将启动一个“SOCKS”代理监听 <local port>。
然后编辑 /etc/proxychains.conf 以指向与 <local port> 相同的端口:
socks5 127.0.0.1 <localport>
Run Code Online (Sandbox Code Playgroud)
最后启动您想要代理的程序,如下所示:
proxychains <program name>
Run Code Online (Sandbox Code Playgroud)
它应该可以正常工作。但是,一些程序在使用代理链时会遇到问题。还要记住,对于 Firefox,您必须更改 about:config 下的其他项目,以强制它通过代理进行 DNS 查找,而不是绕过它。
作为附加说明,在网络浏览器上。如果他们支持socks代理,你不需要做任何额外的事情来让他们使用上面提到的ssh隧道,只需为SOCKS代理服务器输入127.0.0.1,为代理端口输入<local port>。
编辑 3/29/16
由于这篇文章仍然看到一些赞成票,我想我会更新它。Proxychains 仍然存在于大多数 Linux 存储库中,并且仍然可以在 Linux 上运行。但是,该项目实际上已被放弃并且无法在 OSX 上运行。对于 Linux 或 OSX,我强烈建议升级到仍然维护的分支:proxychains-ng:https : //github.com/rofl0r/proxychains-ng
除了在 Linux 和 OSX 中工作,它很容易编译,并且对 DNS 隧道有更好的支持。
我还应该提到另一种选择,即 redsocks。它的工作原理与 proxychains(-ng) 类似,也可能在您的 dist 存储库中:https : //github.com/darkk/redsocks
编辑 11/27/19 如果你走代理链路线,请使用代理链-ng。旧版本有一些严重的错误修复,例如:https : //github.com/rofl0r/proxychains-ng/issues/292
Pri*_*cey 55
man ssh
给出了一个例子。基于 ssh 的 vpn:
SSH-BASED VIRTUAL PRIVATE NETWORKS
ssh contains support for Virtual Private Network (VPN) tunnelling using
the tun(4) network pseudo-device, allowing two networks to be joined
securely. The sshd_config(5) configuration option PermitTunnel controls
whether the server supports this, and at what level (layer 2 or 3 traf-
fic).
The following example would connect client network 10.0.50.0/24 with
remote network 10.0.99.0/24, provided that the SSH server running on the
gateway to the remote network, at 192.168.1.15, allows it:
# ssh -f -w 0:1 192.168.1.15 true
# ifconfig tun0 10.0.50.1 10.0.99.1 netmask 255.255.255.252
Run Code Online (Sandbox Code Playgroud)
~~剪~~
Since a SSH-based setup entails a fair amount of overhead, it may be more
suited to temporary setups, such as for wireless VPNs. More permanent
VPNs are better provided by tools such as ipsecctl(8) and isakmpd(8).
Run Code Online (Sandbox Code Playgroud)
一旦你有了那个新界面,你只需要把它设为默认路由,这是一个不同的问题。
我开发了软件,允许您通过 SOCKS5 代理在系统范围内转发所有 TCP 和可选的 UDP。
http://code.google.com/p/badvpn/wiki/tun2socks
它甚至可以安装在路由器上以转发 LAN 上计算机的所有连接。
归档时间: |
|
查看次数: |
217067 次 |
最近记录: |