From 7e8f9e8417c0b101e9ad26a810dabce6a45a2585 Mon Sep 17 00:00:00 2001 From: Pranav Jerry Date: Wed, 9 Jun 2021 17:22:20 +0530 Subject: [PATCH] Changed order of files in systemd-networkd The README is now in order, with a few readability fixes. The renaming of files in systemd-networkd/ is only for readability. I don't know if networkd considers the order of files important. --- README.md | 41 +++++++++++-------- systemd-networkd/01-batman.netdev | 1 + systemd-networkd/02-bridge.netdev | 3 +- systemd-networkd/03-wireless-ad-hoc.network | 4 +- systemd-networkd/04-batman.network | 5 ++- ...less-ap.network => 05-wireless-ap.network} | 0 systemd-networkd/06-eth.network | 7 ++++ .../{05-bridge.network => 07-bridge.network} | 4 +- systemd-networkd/07-eth.network | 5 --- 9 files changed, 41 insertions(+), 29 deletions(-) rename systemd-networkd/{06-wireless-ap.network => 05-wireless-ap.network} (100%) create mode 100644 systemd-networkd/06-eth.network rename systemd-networkd/{05-bridge.network => 07-bridge.network} (71%) delete mode 100644 systemd-networkd/07-eth.network diff --git a/README.md b/README.md index 8910a30..5dcae14 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ communicating with each other during an internet shutdown, using existing software and tech as much as possible. Currently you can only communicate with other peers running naxalnet or using the same network as naxalnet. It uses -[B.A.T.M.A.N. Advanced](https://www.open-mesh.org/projects/batman-adv/wiki), +[B.A.T.M.A.N. Advanced][batman-adv], an implementation of the B.A.T.M.A.N. routing protocol to communicate with peers. @@ -26,20 +26,6 @@ advocating the constitutional rights). --> -## How it works - -The program naxalnet copies predefined systemd-networkd configuration -into networkd's runtime configuration directory. It uses iwctl to start -an ad-hoc network named "Hello World". The wireless interface is linked to -`bat0`, the batman interface. A bridge `bridge0` is created so that other -devices such as wired connections and wireless ap can be bridged. `bat0` is -added to the bridge, and the bridge gets an ip address (link-local, or -DHCP if any of the computers have a DHCP server configured). If these -were successful, an intranet is created. You can now use services -like [IPFS](https://ipfs.io), [Jami](https://jami.net), -[Secure Scuttlebutt](https://scuttlebutt.nz) and others which can work -without internet access. - ## Requirements - systemd v248 or more (for batman support) @@ -47,7 +33,7 @@ without internet access. no error then you already have it) - iwd (for starting ad-hoc network) - python3 -- [python-dasbus](https://github.com/rhinstaller/dasbus) +- [python-dasbus][] - wifi adapter with ad-hoc support - two or more computers with wifi adapter @@ -78,7 +64,7 @@ sudo systemctl start naxalnet.service Starting the service will stop `NetworkManager.service` and `wpa_supplicant.service` if it is running. If you start either of these -services after naxalnet is started, naxalnet will be stopped by systemd. +services after naxalnet is started, systemd will stop naxalnet. To run naxalnet at boot, enable the service: @@ -87,6 +73,21 @@ sudo systemctl enable naxalnet.service ``` Now naxalnet will configure a batman interface on every boot. +Disable the service to stop running at boot: + +```sh +sudo systemctl disable naxalnet.service +``` + +## How it works + +The program naxalnet copies predefined systemd-networkd configuration +into networkd's runtime configuration directory. It uses iwd to start +an ad-hoc network named "HelloWorld". See the +[systemd-networkd](systemd-networkd) directory +to see how systemd-networkd configures the network. You can now use +services like [IPFS][], [Jami][], [Secure Scuttlebutt][ssb] +and others which can work without internet access. ## Uninstalling @@ -109,3 +110,9 @@ See [LICENSE](LICENSE) for the complete version of the license. This project is in alpha stage. Documentation is incomplete. + +[batman-adv]: https://www.open-mesh.org/projects/batman-adv/wiki +[ipfs]: https://ipfs.io +[jami]: https://jami.net +[ssb]: https://scuttlebutt.nz +[python-dasbus]: https://github.com/rhinstaller/dasbus diff --git a/systemd-networkd/01-batman.netdev b/systemd-networkd/01-batman.netdev index 73b57f9..34c1e41 100644 --- a/systemd-networkd/01-batman.netdev +++ b/systemd-networkd/01-batman.netdev @@ -1,4 +1,5 @@ # Create the BATMAN interface +# See 04-batman.network for configuration details [NetDev] Name=bat0 Description=BATMAN interface diff --git a/systemd-networkd/02-bridge.netdev b/systemd-networkd/02-bridge.netdev index eded271..b7d5cf6 100644 --- a/systemd-networkd/02-bridge.netdev +++ b/systemd-networkd/02-bridge.netdev @@ -1,5 +1,6 @@ # Create a bridge interface -# The batman interface be will later linked to this bridge +# The batman interface be will later linked to this bridge. +# See 07-bridge.network to see how this bridge is configured [NetDev] Name=bridge0 Description=Bridge diff --git a/systemd-networkd/03-wireless-ad-hoc.network b/systemd-networkd/03-wireless-ad-hoc.network index f40b3e6..8e4906e 100644 --- a/systemd-networkd/03-wireless-ad-hoc.network +++ b/systemd-networkd/03-wireless-ad-hoc.network @@ -6,8 +6,8 @@ WLANInterfaceType=ad-hoc [Network] Description=ad-hoc network connecting to other nodes BatmanAdvanced=bat0 -# this interface should not have any ip addresses assigned -# ip will be given later to the bridge +# This interface should not have any IP addresses assigned. +# IP will be given later to the bridge DHCP=no DHCPServer=no LinkLocalAddressing=no diff --git a/systemd-networkd/04-batman.network b/systemd-networkd/04-batman.network index 4e17c61..9eba2c6 100644 --- a/systemd-networkd/04-batman.network +++ b/systemd-networkd/04-batman.network @@ -5,8 +5,9 @@ Name=bat0 Description=The BATMAN interface Bridge=bridge0 -# like in 03, this interface also shouldn't have ip address -# the address will be assigned to the bridge +# like in 03-wireless-ad-hoc.network, this interface +# also shouldn't have IP address the address will +# be assigned to the bridge DHCP=no DHCPServer=no LinkLocalAddressing=no diff --git a/systemd-networkd/06-wireless-ap.network b/systemd-networkd/05-wireless-ap.network similarity index 100% rename from systemd-networkd/06-wireless-ap.network rename to systemd-networkd/05-wireless-ap.network diff --git a/systemd-networkd/06-eth.network b/systemd-networkd/06-eth.network new file mode 100644 index 0000000..dad405a --- /dev/null +++ b/systemd-networkd/06-eth.network @@ -0,0 +1,7 @@ +# This file bridges any ethernet device found +# to the bridge made in 02-bridge.netdev +[Match] +Name=en* + +[Network] +Bridge=bridge0 diff --git a/systemd-networkd/05-bridge.network b/systemd-networkd/07-bridge.network similarity index 71% rename from systemd-networkd/05-bridge.network rename to systemd-networkd/07-bridge.network index ff1f02f..1c14c70 100644 --- a/systemd-networkd/05-bridge.network +++ b/systemd-networkd/07-bridge.network @@ -1,4 +1,5 @@ -# this is the interface userspace applications will be using to +# Ah! This is where the magic happens! +# This is the interface userspace applications will be using to # communicate with others devices [Match] @@ -12,6 +13,5 @@ DHCP=yes LinkLocalAddressing=yes # LLMNR and MulticastDNS are used for hostname discovery -# on LLMNR=yes MulticastDNS=yes diff --git a/systemd-networkd/07-eth.network b/systemd-networkd/07-eth.network deleted file mode 100644 index 406ab0d..0000000 --- a/systemd-networkd/07-eth.network +++ /dev/null @@ -1,5 +0,0 @@ -[Match] -Name=en* - -[Network] -Bridge=bridge0