Cài đặt gốc

Xem mã nguồn trên GitHub

Lấy mã OTBR

Trên Raspberry Pi:

  1. Cài đặt git:

    sudo apt install git
    

  2. Sao chép ot-br-posix từ GitHub:

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

Tạo và cài đặt OTBR

OTBR có hai tập lệnh khởi động và thiết lập Bộ định tuyến biên theo giao thức Thread:

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

OTBR hoạt động trên cả giao diện Thread và giao diện mạng hạ tầng (ví dụ: Wi-Fi/Ethernet) được chỉ định bằng INFRA_IF_NAME. Giao diện Luồng do chính OTBR tạo và được đặt tên là wpan0 theo mặc định, còn giao diện cơ sở hạ tầng có giá trị mặc định là wlan0 nếu không chỉ định rõ INFRA_IF_NAME. Nếu Raspberry Pi của bạn được kết nối bằng cáp Ethernet, hãy chỉ định tên giao diện Ethernet (ví dụ: eth0):

INFRA_IF_NAME=eth0 ./script/setup

Xác minh rằng dịch vụ otbr-agent đang hoạt động:

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