由于我校校园网NAT类型为Symmetric NAT,导致一些点对点穿透服务无法直接使用,下面采用腾讯云搭建一个socks5服务器,实现将特定应用的流量进行转发,将网络类型转化为Cone NAT。
![](https://lzusaaa.com/wp-content/uploads/2023/07/wp_editor_md_7d2d14776d3d15be0319ac5459ee7bc7.jpg)
首先购买的是最便宜的轻量应用服务器,直接将系统装为ubuntu 20.04
![](https://lzusaaa.com/wp-content/uploads/2023/07/wp_editor_md_deaf2e762bf7fa93ab673b3a4df82455.jpg)
服务器初始化完成后直接使用
sudo apt-get install dante-server
安装dante:![](https://lzusaaa.com/wp-content/uploads/2023/07/wp_editor_md_9c1cf5e78b5807a0c0c45e44157a6c20.jpg)
之后对dante进行配置,使用sudo vi /etc/danted.conf
将其改为,此处internal与external为网卡名称,可以使用ifconfig查看,1080为socks5连接的端口号,可以进行更改,记得在服务器的防火墙设置中放开对应端口。
![](https://lzusaaa.com/wp-content/uploads/2023/07/wp_editor_md_7e1fb92eaa92898b6a505d2690d14012.jpg)
logoutput: syslog
user.privileged: root
user.unprivileged: nobody
# The listening network interface or address.
internal: eth0 port=1080
# The proxying network interface or address.
external: eth0
# socks-rules determine what is proxied through the external interface.
socksmethod: username
# client-rules determine who can connect to the internal interface.
clientmethod: none
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
}
socks pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
}
配置完成后使用systemctl restart danted.service
重启服务,之后使用systemctl status danted.service
查看服务状态,若提示active (running),即表示服务正常运行。
![](https://lzusaaa.com/wp-content/uploads/2023/07/wp_editor_md_c4b2efad31c42ea2d97650cbab85a280.jpg)
我们使用
passwd root
重新设置root用户的密码,作为socks5的登录用户,至此,服务端配置完成。然后在本机,我们使用pro5作为代理软件,可以在后面这个连接下载:pro5。
在软件中,首先点击参数设置中的代理列表,添加上面配置的代理服务器:
![](https://lzusaaa.com/wp-content/uploads/2023/07/wp_editor_md_460d3496a43d54a66221924cc3c0f026.jpg)
随后点击参数设置中的规则列表添加需要进行代理的应用,我们这里将NAT类型测试软件添加进规则中:
![](https://lzusaaa.com/wp-content/uploads/2023/07/wp_editor_md_1e0e4ae13c0ae66dcd0f65d612801218.jpg)
再次进行NAT测试,就可以看到NAT类型已经变为了RestrictedCone。
![](https://lzusaaa.com/wp-content/uploads/2023/07/wp_editor_md_be2eda4c695d08e0910f9a4d5a469a34.jpg)
同时在pro5中有建立连接的提示与流量消耗的记录:
![](https://lzusaaa.com/wp-content/uploads/2023/07/wp_editor_md_b2c09c5885d4264262e2bc237d41bc08.jpg)
Comments NOTHING