Obtenir le code OTBR
Sur Raspberry Pi :
Installez Git :
sudo apt install gitClonez
ot-br-posixà partir de GitHub :git clone --depth=1 https://github.com/openthread/ot-br-posix
Compiler et installer OTBR
OTBR dispose de deux scripts qui amorcent et configurent le routeur de bordure Thread :
cd ot-br-posix./script/bootstrapINFRA_IF_NAME=wlan0 ./script/setup
OTBR fonctionne à la fois sur une interface Thread et sur une interface réseau d'infrastructure (par exemple, Wi-Fi/Ethernet) spécifiée avec INFRA_IF_NAME. L'interface Thread est créée par OTBR lui-même et nommée wpan0 par défaut. L'interface d'infrastructure a une valeur par défaut de wlan0 si INFRA_IF_NAME n'est pas spécifié explicitement. Si votre Raspberry Pi est connecté par un câble Ethernet, spécifiez le nom de l'interface Ethernet (par exemple, eth0) :
INFRA_IF_NAME=eth0 ./script/setup
Le service otbr-agent est désormais activé et démarre au redémarrage. Pour démarrer le service immédiatement sans redémarrer, utilisez le script server :
./script/server
Vérifiez que le service otbr-agent est actif :
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
Modifier le chemin d'accès à l'URL radio
L'agent OTBR utilise le fichier de configuration /etc/default/otbr-agent pour ses paramètres de démarrage. Ce fichier contient la variable OTBR_AGENT_OPTS, qui définit des paramètres tels que l'URL radio. Par exemple, spinel+hdlc+uart:///dev/ttyACM0.
Ce fichier de configuration est généré par CMake à partir du
otbr-agent.default.in
fichier source. Il est ensuite transmis au service système en tant que les
paramètres de démarrage du service.
Pour modifier le chemin d'accès à l'URL radio sur votre système cible :
Ouvrez le fichier de configuration de l'agent OTBR dans un éditeur de texte :
sudoedit /etc/default/otbr-agentRecherchez la variable
OTBR_AGENT_OPTS.Recherchez la partie de la chaîne correspondant à l'URL radio. Par exemple,
spinel+hdlc+uart:///dev/ttyACM0.Remplacez cette chaîne par votre nouveau chemin d'accès.
Enregistrez le fichier et quittez l'éditeur.
Redémarrez le service
otbr-agentpour appliquer les modifications :sudo systemctl restart otbr-agent