MetaCubeX / mihomo

A simple Python Pydantic model for Honkai: Star Rail parsed data from the Mihomo API.
https://wiki.metacubex.one
MIT License
15.14k stars 2.52k forks source link

[Bug] Dokcer 里面运行clashmeta怎么打开tun模式 #688

Closed 2069692020 closed 10 months ago

2069692020 commented 1 year ago

Verify steps

Clash version

clashmet

What OS are you seeing the problem on?

Linux

Clash config

port: 7890
socks-port: 7891
redir-port: 7892
tproxy-port: 7895
mixed-port: 7893
ipv6: false
allow-lan: true
mode: Rule
log-level: info
external-controller: 0.0.0.0:9090
external-ui: /home/yacd
dns:
  enable: true
  ipv6: false
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  listen: 0.0.0.0:7874
  nameserver:
  - 1.1.1.1
  - 114.114.114
  - 223.5.5.5
  - https://doh.pub/dns-query
  - https://223.5.5.5/dns-query
  fallback:
  - https://dns.cloudflare.com/dns-query
  - https://public.dns.iij.jp/dns-query
  - https://jp.tiar.app/dns-query
  - https://jp.tiarap.org/dns-query
tun:
  enable: true
  stack: system # system / lwip
  dns-hijack:
    - 0.0.0.0:53
  auto-detect-interface: true
  auto-route: true
  mtu: 9000
  strict-route: true
  inet4-route-address: 
    - 0.0.0.0/1
    - 128.0.0.0/1

Clash log

ERRO[2023-08-11T04:54:23.493883647Z] Start TUN listening error: configure tun int
erface: no such file or directory                                                
ERRO[2023-08-11T04:54:27.914064364Z] Start TUN listening error: configure tun int
erface: no such file or directory                                                
ERRO[2023-08-11T04:54:29.994180931Z] Start TUN listening error: configure tun int
erface: no such file or directory                                                
ERRO[2023-08-11T04:54:32.374032526Z] Start TUN listening error: configure tun int
erface: no such file or directory

Description

物理机安装ubuntu直接运行clashmeta 可以开启tun模式 在docker里面运行clashmeta有报错 ERRO[2023-08-11T04:54:32.374032526Z] Start TUN listening error: configure tun int erface: no such file or directory

wllnn commented 1 year ago

把”/dev/net/tun”传递给容器

2069692020 commented 1 year ago

主机里面的tun是0kb映射过去也没有用

Magic989 commented 1 year ago

尝试在部署容器的时候加上这两个参数 --device=/dev/net/tun \ --cap-add=NET_ADMIN