sing-box tun 问题求教

37 天前
 happydoge

sing-box 目前使用 systemd 管理的,且开启了 tun 模式, 参数如下

    {
      "type": "tun",
      "tag": "tun-in",
      "inet4_address": "198.18.0.1/16",
      "auto_route": true,
      "strict_route": false,
      "endpoint_independent_nat": false,
      "stack": "mixed",
      "sniff": true
    }

同时当前机器还跑了 docker ,使用了桥接网络


services:
  nginx:
  	# 示例
    image: nginx
    ports:
      - "80:80"

networks:
  default:
    driver: bridge
    ipam:
      config:
        - subnet: 192.168.16.0/24

这种情况下,没法直接 curl natip:80(当前服务器内网 ip curl 是正常的)

需要在 tun 配置里 exclude_interface 相关 docker 网卡或者路由,才能通过公网 natip 访问

但是配置这样的参数后,容器内又没办法访问 github 等外网了。

有没有办法共存呢🤔,既可以访问外网又可以公网 nat 访问(另外 docker host 模式没问题,桥接有问题)

1075 次点击
所在节点    程序员
2 条回复
sky96111
37 天前
happydoge
37 天前
@sky96111 我也搜到了,但是我的机器没 ipv6🤔

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1042296

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX