由于我校校园网NAT类型为Symmetric NAT,导致一些点对点穿透服务无法直接使用,下面采用腾讯云搭建一个socks5服务器,实现将特定应用的流量进行转发,将网络类型转化为Cone NAT。

首先购买的是最便宜的轻量应用服务器,直接将系统装为ubuntu 20.04

服务器初始化完成后直接使用
sudo apt-get install dante-server
安装dante:
之后对dante进行配置,使用sudo vi /etc/danted.conf
将其改为,此处internal与external为网卡名称,可以使用ifconfig查看,1080为socks5连接的端口号,可以进行更改,记得在服务器的防火墙设置中放开对应端口。

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),即表示服务正常运行。

我们使用
passwd root
重新设置root用户的密码,作为socks5的登录用户,至此,服务端配置完成。然后在本机,我们使用pro5作为代理软件,可以在后面这个连接下载:pro5。
在软件中,首先点击参数设置中的代理列表,添加上面配置的代理服务器:

随后点击参数设置中的规则列表添加需要进行代理的应用,我们这里将NAT类型测试软件添加进规则中:

再次进行NAT测试,就可以看到NAT类型已经变为了RestrictedCone。

同时在pro5中有建立连接的提示与流量消耗的记录:

Comments NOTHING