DEV Community

Gavin Wang
Gavin Wang

Posted on • Edited on

Ubuntu搭建梯子

所需工具

SSH工具

Termius

开始搭建

部署脚本

1. SSH连接到Ubuntu

使用Termius连接到Ubuntu服务器,点击NEW HOST,新建连接

新建连接

输入服务器IP地址,用户名和密码,点击Connect

配置连接

2. 切换root用户

sudo su
Enter fullscreen mode Exit fullscreen mode

输入密码,切换到root用户

切换到root用户

3. 更新APT源(可选)

更新源不是必需的,可不执行,但它可以确保系统从最新的软件源获取软件包,从而避免因旧版本或依赖问题导致的安装失败。

apt update
Enter fullscreen mode Exit fullscreen mode

等待源更新完成

更新APT源

4. 运行3x-ui搭建脚本

这个是3x-ui脚本项目地址: https://github.com/MHSanaei/3x-ui

运行以下脚本:

bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)
Enter fullscreen mode Exit fullscreen mode

等待脚本安装完成

梯子安装脚本

至此3x-ui已安装完成

配置

配置3x-ui

3x-ui的配置命令为x-ui,运行此命令行

x-ui
Enter fullscreen mode Exit fullscreen mode

x-ui

输入6,更新管理界面的用户名和密码,根据提示往下走

更新用户名和密码

输入10,查看当前的配置

当前配置

可以看到Access URL就是管理页面的地址。可能由于没有公网IP,所以Access URL缺失了HOST部分,我们可以将HOST补上

比如我的地址: http://192.168.2.128:8088/DWOrEJrA0C/

进入管理页面

访问3x-ui管理页面的地址

登录页面

输入用户名和密码,即可登录进管理页面

进入管理页面

端口转发

需要在路由器上设置端口转发,转发公网IP的端口到内网Ubuntu的端口上,其目的是保证外部用户可以通过访问公网 IP 的指定端口,成功连接到内网 Ubuntu 服务器上的梯子服务

在端口转发前,需要确保目标 Ubuntu 系统的防火墙不会阻止端口访问。

可开放以下端口

  • 管理页面端口

公网IP:8088 -> Ubuntu IP:8088

  • 梯子端口

在梯子设置中,会设置梯子的端口,需要将这些端口转发暴露到公网上

公网IP:xxxx -> Ubuntu IP:xxxx

设置代理

1. 添加入站

点击入站列表菜单,点击添加入站按钮

点击入站列表菜单,点击添加入站按钮

设置代理

设置代理

其他的默认设置就可以了,后续可以再改进更安全的设置

设置完成后,可以看到在入站列表中新增了一条代理,点击展开可以看到使用这个代理的用户

入站列表

2.添加用户

点击添加用户

添加用户

添加第二个用户

添加第二个用户

添加成功

3. 查看代理

点击下图按钮,弹出详细信息,下方的URL就是代理的地址,可直接复制到客户端使用

代理详情

点击下图按钮,弹出二维码,可直接用客户端扫描添加

Image description

以下是各平台可使用的客户端

  1. IOS: ShadowRocket (APP Store下载)

  2. Android: v2rayNG (Google Play下载)

  3. Windows: WinXray (GitHub下载,下载链接)

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay