原生安装

在 GitHub 上查看源代码

获取 OTBR 代码

在 Raspberry Pi 上:

  1. 安装 git:

    sudo apt install git
    

  2. 从 GitHub 克隆 ot-br-posix

    git clone --depth=1 https://github.com/openthread/ot-br-posix
    

构建和安装 OTBR

OTBR 有两个脚本用于引导和设置 Thread 边界路由器:

cd ot-br-posix
./script/bootstrap
INFRA_IF_NAME=wlan0 ./script/setup

OTBR 适用于 Thread 接口和使用 INFRA_IF_NAME 指定的基础架构网络接口(例如 Wi-Fi/以太网)。线程接口由 OTBR 本身创建,默认命名为 wpan0,如果未明确指定 INFRA_IF_NAME,基础架构接口的默认值为 wlan0。如果 Raspberry Pi 通过以太网线连接,请指定以太网接口名称(例如 eth0):

INFRA_IF_NAME=eth0 ./script/setup

验证 otbr-agent 服务是否处于活动状态:

sudo service otbr-agent status
● otbr-agent.service - Border Router Agent
   Loaded: loaded (/lib/systemd/system/otbr-agent.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2021-03-01 05:46:26 GMT; 2s ago
 Main PID: 2997 (otbr-agent)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/otbr-agent.service
           └─2997 /usr/sbin/otbr-agent -I wpan0 -B wlan0 spinel+hdlc+uart:///dev/ttyACM0

Mar 01 05:46:26 raspberrypi otbr-agent[2997]: Stop publishing service
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: [adproxy] Stopped
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: PSKc is not initialized
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: Check if PSKc is initialized: OK
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: Initialize OpenThread Border Router Agent: OK
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: Border router agent started.
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: [INFO]-CORE----: Notifier: StateChanged (0x00038200) [NetData PanId NetName ExtPanId]
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: [INFO]-PLAT----: Host netif is down