Add OpenThread Border Router (OTBR) script
- Build from source via git clone + cmake/ninja - Privileged container for network admin (iptables/ipset/tun) - Web GUI on port 80, REST API, mDNS service discovery - Configurable RCP device path in /etc/default/otbr-agent - Git-based update with shallow fetch + rebuild
This commit is contained in:
86
ct/openthread-br.sh
Normal file
86
ct/openthread-br.sh
Normal file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
# Source: https://openthread.io/guides/border-router
|
||||
|
||||
APP="OpenThread Border Router"
|
||||
var_tags="${var_tags:-thread;iot;border-router;matter}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-2048}"
|
||||
var_disk="${var_disk:-4}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
var_unprivileged="${var_unprivileged:-0}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -d /opt/ot-br-posix ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
cd /opt/ot-br-posix
|
||||
LOCAL_COMMIT=$(git rev-parse HEAD)
|
||||
$STD git fetch --depth 1 origin main
|
||||
REMOTE_COMMIT=$(git rev-parse origin/main)
|
||||
|
||||
if [[ "${LOCAL_COMMIT}" == "${REMOTE_COMMIT}" ]]; then
|
||||
msg_ok "Already up to date (${LOCAL_COMMIT:0:7})"
|
||||
exit
|
||||
fi
|
||||
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop otbr-web
|
||||
systemctl stop otbr-agent
|
||||
msg_ok "Stopped Services"
|
||||
|
||||
msg_info "Updating Source"
|
||||
$STD git reset --hard origin/main
|
||||
$STD git submodule update --depth 1 --init --recursive
|
||||
msg_ok "Updated Source"
|
||||
|
||||
msg_info "Rebuilding OpenThread Border Router (Patience)"
|
||||
cd /opt/ot-br-posix/build
|
||||
$STD cmake -GNinja \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DOTBR_DBUS=ON \
|
||||
-DOTBR_MDNS=openthread \
|
||||
-DOTBR_REST=ON \
|
||||
-DOTBR_WEB=ON \
|
||||
-DOTBR_BORDER_ROUTING=ON \
|
||||
-DOTBR_BACKBONE_ROUTER=ON \
|
||||
-DOT_FIREWALL=ON \
|
||||
-DOT_POSIX_NAT64_CIDR="192.168.255.0/24" \
|
||||
..
|
||||
$STD ninja
|
||||
$STD ninja install
|
||||
msg_ok "Rebuilt OpenThread Border Router"
|
||||
|
||||
msg_info "Starting Services"
|
||||
systemctl start otbr-agent
|
||||
systemctl start otbr-web
|
||||
msg_ok "Started Services"
|
||||
msg_ok "Updated successfully!"
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
|
||||
83
install/openthread-br-install.sh
Normal file
83
install/openthread-br-install.sh
Normal file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
# Source: https://openthread.io/guides/border-router
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
git \
|
||||
iproute2 \
|
||||
libreadline-dev \
|
||||
libncurses-dev \
|
||||
rsyslog \
|
||||
dbus \
|
||||
libdbus-1-dev \
|
||||
libjsoncpp-dev \
|
||||
iptables \
|
||||
ipset \
|
||||
bind9 \
|
||||
libnetfilter-queue1 \
|
||||
libnetfilter-queue-dev \
|
||||
libprotobuf-dev \
|
||||
protobuf-compiler
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
NODE_VERSION="20" setup_nodejs
|
||||
|
||||
msg_info "Cloning OpenThread Border Router"
|
||||
$STD git clone --depth 1 https://github.com/openthread/ot-br-posix /opt/ot-br-posix
|
||||
cd /opt/ot-br-posix
|
||||
$STD git submodule update --depth 1 --init --recursive
|
||||
msg_ok "Cloned OpenThread Border Router"
|
||||
|
||||
msg_info "Building OpenThread Border Router (Patience)"
|
||||
mkdir -p build && cd build
|
||||
$STD cmake -GNinja \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DOTBR_DBUS=ON \
|
||||
-DOTBR_MDNS=openthread \
|
||||
-DOTBR_REST=ON \
|
||||
-DOTBR_WEB=ON \
|
||||
-DOTBR_BORDER_ROUTING=ON \
|
||||
-DOTBR_BACKBONE_ROUTER=ON \
|
||||
-DOT_FIREWALL=ON \
|
||||
-DOT_POSIX_NAT64_CIDR="192.168.255.0/24" \
|
||||
..
|
||||
$STD ninja
|
||||
$STD ninja install
|
||||
msg_ok "Built OpenThread Border Router"
|
||||
|
||||
msg_info "Configuring Network"
|
||||
cat <<EOF >/etc/sysctl.d/99-otbr.conf
|
||||
net.ipv6.conf.all.forwarding=1
|
||||
net.ipv4.ip_forward=1
|
||||
EOF
|
||||
$STD sysctl -p /etc/sysctl.d/99-otbr.conf
|
||||
msg_ok "Configured Network"
|
||||
|
||||
msg_info "Configuring Services"
|
||||
cat <<EOF >/etc/default/otbr-agent
|
||||
OTBR_AGENT_OPTS="-I wpan0 -B eth0 spinel+hdlc+uart:///dev/ttyACM0"
|
||||
EOF
|
||||
systemctl enable -q --now otbr-agent
|
||||
systemctl enable -q otbr-web
|
||||
msg_ok "Configured Services"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
48
json/openthread-br.json
Normal file
48
json/openthread-br.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "OpenThread Border Router",
|
||||
"slug": "openthread-br",
|
||||
"categories": [
|
||||
17
|
||||
],
|
||||
"date_created": "2026-03-30",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": true,
|
||||
"interface_port": 80,
|
||||
"documentation": "https://openthread.io/guides/border-router",
|
||||
"website": "https://openthread.io/",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/openthread.webp",
|
||||
"config_path": "/etc/default/otbr-agent",
|
||||
"description": "OpenThread Border Router (OTBR) connects a Thread network to other IP-based networks such as Wi-Fi or Ethernet, providing bidirectional connectivity, mDNS/SRP service discovery, NAT64, and external Thread commissioning.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/openthread-br.sh",
|
||||
"resources": {
|
||||
"cpu": 2,
|
||||
"ram": 2048,
|
||||
"hdd": 4,
|
||||
"os": "Debian",
|
||||
"version": "13"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": [
|
||||
{
|
||||
"text": "Requires a Thread Radio Co-Processor (RCP) USB device passed through to the LXC container (e.g. /dev/ttyACM0). Edit /etc/default/otbr-agent to configure the RCP device path.",
|
||||
"type": "warning"
|
||||
},
|
||||
{
|
||||
"text": "This container runs in privileged mode for network administration (iptables, ipset, tun device access).",
|
||||
"type": "info"
|
||||
},
|
||||
{
|
||||
"text": "Services are not started automatically on first boot. Connect your RCP device, configure /etc/default/otbr-agent, then run: systemctl start otbr-agent && systemctl start otbr-web",
|
||||
"type": "info"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user