From c5c65d56c9a9ea49bb44b98ee695d611fad570fa Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Mon, 17 Aug 2026 14:08:22 +0200 Subject: [PATCH 1/3] Notify readiness to systemd --- lnxrouter | 1 + 1 file changed, 1 insertion(+) diff --git a/lnxrouter b/lnxrouter index ac84036..eb335ad 100755 --- a/lnxrouter +++ b/lnxrouter @@ -2520,6 +2520,7 @@ fi echo "" is_firewalld_running && firewalld_addto_tmptrustedzone +systemd-notify --ready --status="Active on WiFi network ${SSID}" || true echo echo "== Setting up completed, now linux-router should be working ==" From c8241d19eca2d8d609cea1b3a665536a442c54bd Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Tue, 18 Aug 2026 13:50:26 +0200 Subject: [PATCH 2/3] Sample systemd unit and configuration file --- linux-router.example.conf | 11 +++++++++++ linux-router.example.service | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 linux-router.example.conf create mode 100644 linux-router.example.service diff --git a/linux-router.example.conf b/linux-router.example.conf new file mode 100644 index 0000000..1529883 --- /dev/null +++ b/linux-router.example.conf @@ -0,0 +1,11 @@ +# copy this file to /etc/linux-router.conf and modify it for your specific setup +PRIVATE_NETWORK_IPV4=192.168.0.0/24 +AP_NETWORK=192.168.100.0/24 +AP_DNS_ADDRESS=192.168.0.1 +AP_NET_GATEWAY=192.168.100.1 +AP_WIFI_COUNTRY=US +AP_WIFI_CHANNEL=11 +AP_WIFI_INTERFACE=wlan0 +AP_WIFI_ESSID=MyHotspot +AP_WIFI_PSK=MyPskKey +AP_WIFI_GW_INTERFACE=eth0 diff --git a/linux-router.example.service b/linux-router.example.service new file mode 100644 index 0000000..f5730f0 --- /dev/null +++ b/linux-router.example.service @@ -0,0 +1,22 @@ +[Unit] +Description=Linux Router +After=network.target + +[Service] +Type=notify +NotifyAccess=all +User=root +EnvironmentFile=/etc/linux-router.conf +ExecStart=/usr/local/bin/lnxrouter \ + --country "$AP_WIFI_COUNTRY" \ + -n --no-virt \ + --dns "$AP_DNS_ADDRESS" \ + -g "$AP_NET_GATEWAY" \ + -c "$AP_WIFI_CHANNEL" --wifi4 --ht-capab "" \ + --ap "$AP_WIFI_INTERFACE" "$AP_WIFI_ESSID" \ + -p "$AP_WIFI_PSK" +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target From acaec39ff4d5740a8ddde6716c886be3c5df4233 Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Tue, 18 Aug 2026 13:58:31 +0200 Subject: [PATCH 3/3] Document systemd integration --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 5491277..0d48246 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Basic features: - Detect and prevent interference from following Linux system daemons: - NetworkManager (handle interface (un)managed status) - firewalld (use temporary `trusted` zone) +- Integration with systemd - Instances managing. You can run multiple instances, to create different sub-networks. **For many other features, see below [CLI usage](#cli-usage-and-other-features)** @@ -466,6 +467,18 @@ On exit of a linux-router instance, script **will do cleanup**, i.e. undo most c 5. The wifi device which is used to create hotspot is `rfkill unblock`ed 6. WiFi country code, if user assigns +### Integration with systemd + +A sample systemd service unit file is available and can be used to run this program as a service. +The service unit can be designed and written in a number of ways, but the important thing to make +systemd readiness notification work, is these specific lines: + +``` +[Service] +Type=notify +NotifyAccess=all +``` + ## Meet contributor(s) and become one of them Visit [**my homepage** 🏡](https://garywill.github.io) to see **more tools and projects** 🛠️.