部署sing-box代理服务器绕过付费校园网上网

解决的问题

学校一般会有2个网络,一个是教学区的免费校园网,一个是寝室楼的付费校园网.如何不交钱也能在寝室楼上网是一个问题.

以及,如果校园网在12点之后断网,如果解决断网问题

sing-box

Github 地址:https://github.com/233boy/sing-box

install

docker部署

参考sing-box官方文档关于docker部署的方式

docker镜像托管在<ghcr.io/sagernet/sing-box>,你可以在github仓库的内容中检查

shell 复制代码
docker pull ghcr.io/sagernet/sing-box

使用上述指令拉取镜像

shell 复制代码
docker run -d \
  --network host \
  -v /etc/sing-box:/etc/sing-box/ \
  --name=sing-box \
  --restart=always \
  ghcr.io/sagernet/sing-box \
  -D /var/lib/sing-box \
  -C /etc/sing-box/ run

运行容器

该指令与官方文档不同在于我使用--network host放行了网络端口

脚本安装

需要实现和v3ray一键安装的脚本一样快速安装服务,参考233Boy-最好用的 sing-box 一键安装脚本

config

程序需要配合sing-box.json配置文件使用,缺少配置文件的时候启动容器会出现报错unmarshal merged json,文件位置位于/etc/sing-box/sing-box.json

并且容器会一直重启(因为设置了--restart=always)

配置文件模板可以在官方文档-proxy protocol中获取

我自己的配置文件类似于

json 复制代码
 {
  "inbounds": [
    {
      "type": "<protocol-type>",
      "listen": "::",
      "listen_port": 2025,
      "network": "tcp",
      "method": "2022-blake3-aes-128-gcm",
      "password": "<password>",
      "multiplex": {
        "enabled": true
      }
    }
  ]
}
  • 更新配置之后需要重新启动程序

test

shell 复制代码
sudo apt install net-tools

安装必要的工具,方便展示情况

展示

shell 复制代码
netstat -pan|grep 2025

展示2025端口的使用情况

可以看到正在被监听

相关推荐
Johny_Zhao1 小时前
Docker + CentOS 部署 Zookeeper 集群 + Kubernetes Operator 自动化运维方案
linux·网络安全·docker·信息安全·zookeeper·kubernetes·云计算·系统运维
小毛驴8502 小时前
Linux 后台启动java jar 程序 nohup java -jar
java·linux·jar
好好学习啊天天向上3 小时前
世上最全:ubuntu 上及天河超算上源码编译llvm遇到的坑,cmake,ninja完整过程
linux·运维·ubuntu·自动性能优化
tan180°4 小时前
MySQL表的操作(3)
linux·数据库·c++·vscode·后端·mysql
典学长编程4 小时前
Linux操作系统从入门到精通!第二天(命令行)
linux·运维·chrome
wuk9985 小时前
基于MATLAB编制的锂离子电池伪二维模型
linux·windows·github
独行soc7 小时前
#渗透测试#批量漏洞挖掘#HSC Mailinspector 任意文件读取漏洞(CVE-2024-34470)
linux·科技·安全·网络安全·面试·渗透测试
BD_Marathon7 小时前
Ubuntu下Tomcat的配置
linux·ubuntu·tomcat
饥饿的半导体8 小时前
Linux快速入门
linux·运维
BD_Marathon8 小时前
Ubuntu:Tomcat里面的catalina.sh
linux·ubuntu·tomcat