通过SoftEther搭建dns隧道绕过校园网认证进行免费上网

jupiter
2021-10-06 / 0 评论 / 1,352 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2023年03月01日,已超过414天没有更新,若内容或图片失效,请留言反馈。

原理介绍

工作原理

正常情况下,当我们连上酒店或者其他需要验证才可以使用的网络后,虽然上不了网,但是我们的计算机却分配到了IP地址(不分配IP地址web认证就实现不了),此时若我们进行一些上网的操作,那么计算机的数据包将从TCP443端口上发出,校园网、酒店等网关就会拦截从这个端口上发出的数据包。同理从其它端口上发出的数据包也会遭到拦截。
但是有一个神奇的端口,从这个端口发出的数据包不会遭到网关拦截,它就是UDP53端口(UDP53端口上运行的协议是DNS协议(域名解析协议))。

常见的内网环境中 , 防火墙可能会限制只允许 udp 53 端口出站,这样我们可以利用 DNS 查询流量来封装 TCP 流量 , 达到绕过防火墙的目的。

DNS隧道。从名字上来看就是利用DNS查询过程建立起隧道,传输数据。

相关软件下载地址

搭建步骤

准备工作

  • 一台带宽还可以的云服务器
  • 确保服务器ssh连接正常
  • 关闭服务器防火墙(云服务器有的需要在安全组里进行二次放行)

问题注意:关闭服务器的udp53端口默认运行的程序

  • 查看是否关闭
$ sudo netstat -ltnup | grep 53
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      291/systemd-resolve
udp        0      0 127.0.0.53:53           0.0.0.0:*                           291/systemd-resolve
  • 关闭
sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved

配置1:服务器端完成(ubuntu16.04)

  • 下载并运行服务
# 下载软件
wget https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/download/v4.38-9760-rtm/softether-vpnserver-v4.38-9760-rtm-2021.08.17-linux-x64-64bit.tar.gz

# 解压
tar xzvf softether-vpnserver-v4.38-9760-rtm-2021.08.17-linux-x64-64bit.tar.gz

# 编译
cd vpnserver
make

# 运行
./vpnserver start
  • 初始化工作(除了输入1次1之外,其余均按回车)
 ./vpncmd
vpncmd command - SoftEther VPN Command Line Management Utility
SoftEther VPN Command Line Management Utility (vpncmd command)
Version 4.38 Build 9760   (English)
Compiled 2021/08/17 22:32:49 by buildsan at crosswin
Copyright (c) SoftEther VPN Project. All Rights Reserved.

By using vpncmd program, the following can be achieved.

1. Management of VPN Server or VPN Bridge
2. Management of VPN Client
3. Use of VPN Tools (certificate creation and Network Traffic Speed Test Tool)

Select 1, 2 or 3: 1

Specify the host name or IP address of the computer that the destination VPN Server or VPN Bridge is operating on.
By specifying according to the format 'host name:port number', you can also specify the port number.
(When the port number is unspecified, 443 is used.)
If nothing is input and the Enter key is pressed, the connection will be made to the port number 8888 of localhost (this computer).
Hostname of IP Address of Destination:

If connecting to the server by Virtual Hub Admin Mode, please input the Virtual Hub name.
If connecting by server admin mode, please press Enter without inputting anything.
Specify Virtual Hub Name:
Connection has been established with VPN Server "localhost" (port 443).

You have administrator privileges for the entire VPN Server.

VPN Server>

配置2:客户端完成(win10)

  • 下载SoftEther VPN Server Manager并安装

  • 添加新的连接设置(主机名写服务器的IP或者域名)-第一次连接会让你设置新密码

  • 继续完成配置

  • 添加用户

  • 开启虚拟NAT和虚拟DHCP

    • 开启DNS 53端口监听

连接测试

  • 下载客户端并安装

  • 添加新连接

    • 连接设置名随便填
    • 主机名填服务IP
    • 端口号填53

  • 连接测试,获取到IP则代表搭建无误

参考资料

1.SoftEther下载中心

0

评论 (0)

打卡
取消