diff --git a/ct/openthread-br.sh b/ct/openthread-br.sh index 7222e28ad..afff2823b 100644 --- a/ct/openthread-br.sh +++ b/ct/openthread-br.sh @@ -70,7 +70,9 @@ function update_script() { -DOTBR_BACKBONE_ROUTER=ON \ -DOTBR_SYSTEMD_UNIT_DIR=/etc/systemd/system \ -DOT_FIREWALL=ON \ + -DOTBR_NAT64=ON \ -DOT_POSIX_NAT64_CIDR="192.168.255.0/24" \ + -DOTBR_DNS_UPSTREAM_QUERY=ON \ .. $STD ninja $STD ninja install @@ -101,6 +103,31 @@ EOF mv /etc/default/otbr-agent.bak /etc/default/otbr-agent msg_ok "Restored Configuration" + if [[ ! -f /etc/systemd/system/otbr-agent.service.d/10-otbr-post-start.conf ]]; then + msg_info "Configuring OpenThread Border Router post-start service" + cat <<'EOF' >/usr/local/bin/otbr-post-start.sh +#!/bin/sh + +# OpenThread Border Router post-start script +# Run custom commands for runtime configuration options + +# Wait for the otbr-agent service to be initialized +#sleep 3 + +# Configure routing and translation features +#ot-ctl nat64 enable +#ot-ctl dns server upstream enable +EOF + chmod +x /usr/local/bin/otbr-post-start.sh + mkdir -p /etc/systemd/system/otbr-agent.service.d + cat <<'EOF' >/etc/systemd/system/otbr-agent.service.d/10-otbr-post-start.conf +[Service] +ExecStartPost=/usr/local/bin/otbr-post-start.sh +EOF + systemctl daemon-reload + msg_ok "Configured OpenThread Border Router post-start service" + fi + msg_info "Starting Services" systemctl start otbr-agent systemctl start otbr-web diff --git a/install/openthread-br-install.sh b/install/openthread-br-install.sh index a36c5fe1f..fb9dc2d56 100644 --- a/install/openthread-br-install.sh +++ b/install/openthread-br-install.sh @@ -66,7 +66,9 @@ $STD cmake -GNinja \ -DOTBR_BACKBONE_ROUTER=ON \ -DOTBR_SYSTEMD_UNIT_DIR=/etc/systemd/system \ -DOT_FIREWALL=ON \ + -DOTBR_NAT64=ON \ -DOT_POSIX_NAT64_CIDR="192.168.255.0/24" \ + -DOTBR_DNS_UPSTREAM_QUERY=ON \ .. $STD ninja $STD ninja install @@ -103,6 +105,25 @@ EOF cat <<'EOF' >/etc/default/otbr-web OTBR_WEB_OPTS="-I wpan0 -a 0.0.0.0 -p 80" EOF +cat <<'EOF' >/usr/local/bin/otbr-post-start.sh +#!/bin/sh + +# OpenThread Border Router post-start script +# Run custom commands for runtime configuration options + +# Wait for the otbr-agent service to be initialized +#sleep 3 + +# Configure routing and translation features +#ot-ctl nat64 enable +#ot-ctl dns server upstream enable +EOF +chmod +x /usr/local/bin/otbr-post-start.sh +mkdir -p /etc/systemd/system/otbr-agent.service.d +cat <<'EOF' >/etc/systemd/system/otbr-agent.service.d/10-otbr-post-start.conf +[Service] +ExecStartPost=/usr/local/bin/otbr-post-start.sh +EOF systemctl enable -q dbus rsyslog otbr-agent otbr-web systemctl enable -q bind9 2>/dev/null || systemctl enable -q named 2>/dev/null || true systemctl start -q dbus rsyslog bind9