TuGai
V2EX  ›  macOS

macos 如何创建虚拟网卡

  •  
  •   TuGai · Apr 3, 2022 · 5036 views
    This topic created in 1678 days ago, the information mentioned may be changed or developed.

    按照这个教程使用 TUN 虚拟网卡实现 ping 请求转发安装 tuntap 后。

    执行 ifconfig tun11 192.168.7.1 192.168.7.2 up

    提示 ifconfig:interface tun11 does not exist

    请问这个是什么原因。

    在 /dev 目录下已经有 tap0 --- tap15 、tun0 --- tun15 文件了

    5 replies  •  2022-04-03 21:49:22 +08:00
    jdjingdian
    jdjingdian
    Apr 3, 2022
    1
    有用 sudo 执行吗?我发现 macOS 下的网络操作权限经常需要 sudo
    TuGai
    TuGai
    OP
    Apr 3, 2022
    2
    @jdjingdian 用了 sudo 也一样
    happyn
    happyn
    Apr 3, 2022
    3
    估计是 brew install tuntap 没有成功;

    因为:

    1. 最新版的 homebrew 已经把 tuntap 这个项目从软件库中移除了;参考:

    https://github.com/Homebrew/homebrew-cask/pull/113283

    2. tuntap 现在不支持 macOS 12 Monterey

    如果是因为原因 1 ,可以用我维护的一个 tuntap 仓库,命令如下:

    ```
    brew tap happynclient/taps
    brew install tuntap --cask
    ```

    安装过程中需要授予安全权限,并且安装完毕后需要重启;

    如果是因为 2 , 目前还没有特别靠谱的办法;有个项目可以供折腾一下(但是折腾起来很麻烦):

    https://github.com/Tunnelblick/Tunnelblick/tree/master/third_party
    happyn
    happyn
    Apr 3, 2022
    4
    刚才试了一下,大概率是因为没有重启;安装 tuntap 需要重启的;
    happyn
    happyn
    Apr 3, 2022
    5
    抱歉,我刚才又试了一下;在虚拟机里面也重现了这个问题;不是上面说的原因;

    希望能有达人解释一下;
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1833 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 06:32 · PVG 14:32 · LAX 22:32 · JFK 01:32
    ♥ Do have faith in what you're doing.