首页 > 编程知识 正文

端口转发 ssh,socks5服务器端口

时间:2023-05-03 05:06:53 阅读:237202 作者:2964

SSH是一种安全的传输协议,用在连接服务器上比较多。不过其实除了这个功能,它的隧道转发功能更是吸引人。

ssh相关选项: -V
显示版本: $ssh -VOpenSSH_6.6.1p1 Ubuntu-2ubuntu2, OpenSSL 1.0.1f 6 Jan 2014

-f
输入密码后进入后台模式
(Requests ssh to go to background just before command execution.)

-N
不执行远程命令,用于端口转发
( Do not execute a remote command. This is useful for just for warding ports (protocol version 2 only).)

-D
socket5代理
(Specifies a local “dynamic” application-level port forwarding.Currently the SOCKS4 and SOCKS5 protocols are supported, and ssh will act as a SOCKS server.)

-L
tcp转发
(Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side.)

-C
使用数据压缩,网速快时会影响速度
(Compression is desirable on modem lines and other slow connections, but will only slow down things on fast networks.The compression algorithm is the same used by gzip)

建立SOCKS5代理: ssh -f -N -D bindaddress:port name@server

bindaddress :指定绑定ip地址
port : 指定侦听端口
name: ssh服务器登录名
server: ssh服务器地址

例如,假设把一个树莓派作为SOCKS5代理服务器,该树莓派的IP地址是192.168.4.160,SOCKS5的端口7070,在树莓派中输入如下命令:

ssh -f -N -D 192.168.4.160:7070 pi@127.0.0.1

这样就建立了SOCKS5代理。

使用SOCKS5代理

firefox浏览器:
打开firefox设置界面,如下设置:

缺点:

只能代理tcp数据,不能代理udp数据。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。