Sign inSign up

aisyun/singbox-mosdns

By aisyun

•Updated about 1 year ago

singbox + mosdns 组合。tun和tproxy两种模式

Image
0

985

aisyun/singbox-mosdns repository overview

⁠功能列表

  • 集成singbox-v1.12.x+mosdns+mihomo (mihomo暂时没有配置)
  • 支持tun和tproxy。默认配置TUN模式
  • supervisor守护进行:进程管理端口9001,用户名admin 密码admin
  • 默认ui主题metacubexd
  • 实时监控所有配置,修改配置,会自动重启对应的服务
  • /watch 下有自动更新脚本,默认不会自动执行

⁠服务端口分配

服务端口描述
supervisor9001进程管理界面
mosdns53DNS 服务入口
mosdns7777解析节点域名
mosdns8888sing-box使用
mosdns2222内部的国内dns服务器
mosdns3333转发国外请求到内部带过期缓存的服务
mosdns4444带过期缓存的内部使用/外部使用的国外dns服务器
mosdns5656主分流服务器
http代理7890singbox/mihomo 端口
socks5代理7891singbox/mihomo 端口
混合端口7892singbox/mihomo 端口
DNS 接口6666singbox/mihomo 与 mosdns 对接
TProxy透明代理7896nftable 策略使用
redirect代理7877nftable 策略使用
Web UI (metacubexd)9090singbox/mihomo Web 界面

⁠服务 Web 访问路径

🌐 Mosdns 统计界面:http://{IP}:9099/graphic

📦 Supervisor 管理界面:http://{IP}:9001

🕸️ Sing-box/Mihomo 面板 UI:http://{IP}:9090/ui

⁠host模式:

host模式时,报错的概率大,因为要开放的端口多,注意不要和本地端口冲突。如53 等

⁠Docker run

docker run -itd --name singbox-mosdns --privileged --restart always --network=host aisyun/singbox-mosdns:latest

⁠Docker-compose

services:
  sing-box:
    image: aisyun/singbox-mosdns:latest
    container_name: singbox-mosdns
    privileged: true
    restart: unless-stopped
    network_mode: host
    volumes:
      #- ./config/sing-box/config.json:/mssb/sing-box/config.json
      - "./config:/mssb:rw"
      - "./logs:/var/log/supervisor:rw"
    cap_add:
      - NET_ADMIN
      - SYS_PTRACE
      - DAC_READ_SEARCH
    devices:
      - /dev/net/tun
        #dns:
        #  - 119.29.29.29

⁠macvlan模式(推荐):

  • 192.168.1.200:为容器IP
  • 192.168.1.253:为路由器网关
  • enpxxx: 为docker host主机主网卡
  • macnet:为macvlan虚拟网卡

⁠1、创建macvlan网络

docker network create --driver macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.253 -o parent=enpxxx macnet
⁠2、部署Singbox+modns容器,分配独立IP
services:
  sing-box:
    image: aisyun/singbox-mosdns:latest
    container_name: singbox-mosdns
    privileged: true
    restart: unless-stopped
    networks:
      macnet:
        ipv4_address: 192.168.1.200
    volumes:
      #- ./config/sing-box/config.json:/mssb/sing-box/config.json
      - "./config:/mssb:rw"
      - "./logs:/var/log/supervisor:rw"
    cap_add:
      - NET_ADMIN
      - SYS_PTRACE
      - DAC_READ_SEARCH
    devices:
      - /dev/net/tun
        #dns:
        #  - 119.29.29.29
networks:
  macnet:
    external: true

⁠3、解决docker宿主机与代理容器通信问题

#!/bin/bash
echo "创建一个macvlan桥接网卡: hostvlan"
ip link add  hostvlan link enp6s18 type macvlan mode bridge

echo "设置hostvlan IP"
ip addr add 192.168.1.120/32 dev hostvlan

echo "启动hostvlan网卡"
ip link set hostvlan up

echo "添加Singbox 容器 IP 路由到hostvlan"
ip route add 192.168.1.200 dev hostvlan

Tag summary

Content type

Image

Digest

sha256:1a890e981…

Size

52.5 MB

Last updated

about 1 year ago

docker pull aisyun/singbox-mosdns