From 722a752459a6e2744100914097e095d0279f9285 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Fri, 31 Jan 2020 10:01:30 -0500 Subject: [PATCH 01/17] Create install.sh --- contrib/LibreMesh/install.sh | 61 ++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 contrib/LibreMesh/install.sh diff --git a/contrib/LibreMesh/install.sh b/contrib/LibreMesh/install.sh new file mode 100644 index 000000000..579fbd043 --- /dev/null +++ b/contrib/LibreMesh/install.sh @@ -0,0 +1,61 @@ + +# Install batman +apt-get install -y batctl + + +# Change to channel 11 and set meshname the LiMe +confset general frequency 2462 /etc/mesh.conf +confset general mesh-name LiMe /etc/mesh.conf + + +# Always load batman on boot +echo batman-adv >> /etc/modules + +# WLAN VLAN for layer 2 BATMAN +echo <<"EOF"> /etc/network/interfaces.d/wlan0.29 +auto wlan0.29 +iface wlan0.29 inet manual +post-up ip link del wlan0.29 +post-up ip link add link wlan0 name wlan0.29 type vlan proto 802.1ad id 29 +post-up batctl if add wlan0.29 +post-up ip link set wlan0.29 up +EOF + +# WLAN VLAN for layer 3 BABELD meshing +echo <<"EOF"> /etc/network/interfaces.d/wlan0.17 +auto wlan0.17 +iface wlan0.17 inet manual + post-up ip link del wlan0.17 + post-up ip link add link wlan0 name wlan0.17 type vlan proto 802.1ad id 17 + post-up ip link set wlan0.17 up + post-up ip addr add 10.13.183.231/16 dev wlan0.17 +EOF + +# BAT0 configuration +echo <<"EOF"> /etc/network/interfaces.d/bat0 +auto bat0 +iface bat0 inet manual + pre-up batctl if add wlan0.29 + post-up ip addr add 10.13.183.231/16 dev bat0 +EOF + +# ETH VLAN for layer 3 BABELD meshing +echo <<"EOF"> /etc/network/interfaces.d/eth0.17 +auto eth0.17 +iface eth0.17 inet manual + post-up ip link del eth0.17 + post-up ip link add link eth0 name eth0.17 type vlan proto 802.1ad id 17 + post-up ip link set eth0.17 up + post-up ip addr add 10.13.183.231/16 dev eth0.17 +EOF + +# Install BABELD +wget http://meshwithme.online/deb/repos/apt/debian/pool/main/b/babeld/babeld_1.9.1-dirty_armhf.deb +dpkg -i babeld_1.9.1-dirty_armhf.deb + +# Configure BABELD +echo <<"EOF"> /etc/babeld.conf +interface wlan0.17 +interface eth0.17 +local-port 30003 +EOF From 75ecebaf81bc82cbfbb71055fce29f3b02871d5e Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sat, 22 Feb 2020 23:25:47 -0500 Subject: [PATCH 02/17] Libre mesh defaults (#476) * Using LibreMesh calculations * Missing HASHBANG * Update install.sh * Update install.sh * removed extra ECHO * migrated babeld.conf * MTU tweak * Update install.sh * Added tomesh hack --- contrib/LibreMesh/install.sh | 127 +++++++++++++++++++++++++---------- 1 file changed, 90 insertions(+), 37 deletions(-) diff --git a/contrib/LibreMesh/install.sh b/contrib/LibreMesh/install.sh index 579fbd043..fdfc8215b 100644 --- a/contrib/LibreMesh/install.sh +++ b/contrib/LibreMesh/install.sh @@ -1,61 +1,114 @@ +#!/bin/bash + +# Static libremesh vlan +# Source: https://github.com/libremesh/lime-packages/blob/master/packages/lime-docs/files/lime-example#L41 +BABELD_VLAN=17 + +# Default SSID for LibreMesh is "LibreMesh.org" +# It is used to define NETWORK related settings +SSID="LibreMesh.org" +# MD5SUM hash for SSID will be used for the calculations (NOTE: ends in \n) +SSIDHASH=$(echo ${SSID} | md5sum) # Hash of the SSID + +# First 4 bytes of the HASHED SSID will be used for differnt network settings +# We convert HEX to DEC +N1=$( printf "%d" "0x${SSIDHASH:0:2}" ) +N2=$( printf "%d" "0x${SSIDHASH:2:2}" ) +N3=$( printf "%d" "0x${SSIDHASH:4:2}" ) +N4=$( printf "%d" "0x${SSIDHASH:6:2}" ) + +# MAC address of ethernet. Used to identify NODE specific settings +MAC=$(cat /sys/class/net/eth0/address ) # Get Mac +# Last 3 bytes of the MAC (make up the node name) +NODEID=$(echo $MAC | cut -f 4 -d \:)$(echo $MAC | cut -f 5 -d \:)$(echo $MAC | cut -f 6 -d \:) +# We convert HEX to DEC +M1=$( printf "%d" "0x${NODEID:0:2}" ) +M2=$( printf "%d" "0x${NODEID:2:2}" ) +M3=$( printf "%d" "0x${NODEID:4:2}" ) + +# BATMAN-ADV VLAN setting +# Each Unique SSID has (we hope) a unique VLANID so the two networks wont mesh together layer2 +# Lots of legacy things in this calculations so its odd +# BATMAN-ADV vlan is 29 + (N1 - 13) % 254 +# Notes (I THINK) +# N1-13 = 0 on Default Setups +# 29 is added to allow for lower VLANS being Layer 3 (i think) +# % 254 makes sure the number is between 0-254 +BATMAN_VLAN=$(( 29 + $(( N1 -13 )) % 254 )) + +NODEIP=10.$N1.$M2.$M3 # Install batman apt-get install -y batctl -# Change to channel 11 and set meshname the LiMe +# Change mesh-point seattings to use channel 11 (Libremesh defailt) and set meshname of LiMe confset general frequency 2462 /etc/mesh.conf confset general mesh-name LiMe /etc/mesh.conf - # Always load batman on boot echo batman-adv >> /etc/modules # WLAN VLAN for layer 2 BATMAN -echo <<"EOF"> /etc/network/interfaces.d/wlan0.29 -auto wlan0.29 -iface wlan0.29 inet manual -post-up ip link del wlan0.29 -post-up ip link add link wlan0 name wlan0.29 type vlan proto 802.1ad id 29 -post-up batctl if add wlan0.29 -post-up ip link set wlan0.29 up -EOF +echo auto wlan0.${BATMAN_VLAN} > /etc/network/interfaces.d/wlan0.${BATMAN_VLAN} +echo iface wlan0.${BATMAN_VLAN} inet manual >> /etc/network/interfaces.d/wlan0.${BATMAN_VLAN} +echo post-up ip link del wlan0.${BATMAN_VLAN} >> /etc/network/interfaces.d/wlan0.${BATMAN_VLAN} +echo post-up ip link add link wlan0 name wlan0.${BATMAN_VLAN} type vlan proto 802.1ad id ${BATMAN_VLAN} >> /etc/network/interfaces.d/wlan0.${BATMAN_VLAN} +echo post-up batctl if add wlan0.${BATMAN_VLAN} >> /etc/network/interfaces.d/wlan0.${BATMAN_VLAN} +echo post-up ip link set wlan0.${BATMAN_VLAN} up >> /etc/network/interfaces.d/wlan0.${BATMAN_VLAN} +echo post-up batctl if add wlan0.${BATMAN_VLAN} >> /etc/network/interfaces.d/wlan0.${BATMAN_VLAN} + + # WLAN VLAN for layer 3 BABELD meshing -echo <<"EOF"> /etc/network/interfaces.d/wlan0.17 -auto wlan0.17 -iface wlan0.17 inet manual - post-up ip link del wlan0.17 - post-up ip link add link wlan0 name wlan0.17 type vlan proto 802.1ad id 17 - post-up ip link set wlan0.17 up - post-up ip addr add 10.13.183.231/16 dev wlan0.17 -EOF + +echo auto wlan0.${BABELD_VLAN} > /etc/network/interfaces.d/wlan0.${BABELD_VLAN} +echo iface wlan0.${BABELD_VLAN} inet manual >> /etc/network/interfaces.d/wlan0.${BABELD_VLAN} +echo post-up ip link del wlan0.${BABELD_VLAN} >> /etc/network/interfaces.d/wlan0.${BABELD_VLAN} +echo post-up ip link add link wlan0 name wlan0.${BABELD_VLAN} type vlan proto 802.1ad id ${BABELD_VLAN} >> /etc/network/interfaces.d/wlan0.${BABELD_VLAN} +echo post-up ip link set wlan0.${BABELD_VLAN} up >> /etc/network/interfaces.d/wlan0.${BABELD_VLAN} +echo post-up ip addr add ${NODEIP}/16 dev wlan0.${BABELD_VLAN} >> /etc/network/interfaces.d/wlan0.${BABELD_VLAN} + # BAT0 configuration -echo <<"EOF"> /etc/network/interfaces.d/bat0 -auto bat0 -iface bat0 inet manual - pre-up batctl if add wlan0.29 - post-up ip addr add 10.13.183.231/16 dev bat0 -EOF + +echo auto bat0 > /etc/network/interfaces.d/bat0 +echo iface bat0 inet manual >> /etc/network/interfaces.d/bat0 +echo pre-up batctl if add wlan0.${BATMAN_VLAN} >> /etc/network/interfaces.d/bat0 +echo post-up ip addr add ${NODEIP}/16 dev bat0 >> /etc/network/interfaces.d/bat0 +echo post-up batctl bridge_loop_avoidance 1 >> /etc/network/interfaces.d/bat0 +echo post-up batctl multicast_mode 0 >> /etc/network/interfaces.d/bat0 +echo post-up batctl distributed_arp_table 0 >> /etc/network/interfaces.d/bat0 +echo post-up batctl gw_mode client >> /etc/network/interfaces.d/bat0 + # ETH VLAN for layer 3 BABELD meshing -echo <<"EOF"> /etc/network/interfaces.d/eth0.17 -auto eth0.17 -iface eth0.17 inet manual - post-up ip link del eth0.17 - post-up ip link add link eth0 name eth0.17 type vlan proto 802.1ad id 17 - post-up ip link set eth0.17 up - post-up ip addr add 10.13.183.231/16 dev eth0.17 -EOF +echo auto eth0.${BABELD_VLAN} > /etc/network/interfaces.d/eth0.${BABELD_VLAN} +echo iface eth0.${BABELD_VLAN} inet manual >> /etc/network/interfaces.d/eth0.${BABELD_VLAN} +echo post-up ip link del eth0.${BABELD_VLAN} >> /etc/network/interfaces.d/eth0.${BABELD_VLAN} +echo post-up ip link add link eth0 name eth0.${BABELD_VLAN} type vlan proto 802.1ad id ${BABELD_VLAN} >> /etc/network/interfaces.d/eth0.${BABELD_VLAN} +echo post-up ip link set eth0.${BABELD_VLAN} up >> /etc/network/interfaces.d/eth0.${BABELD_VLAN} +echo post-up ip addr add ${NODEIP}/16 dev eth0.${BABELD_VLAN} >> /etc/network/interfaces.d/eth0.${BABELD_VLAN} + # Install BABELD wget http://meshwithme.online/deb/repos/apt/debian/pool/main/b/babeld/babeld_1.9.1-dirty_armhf.deb dpkg -i babeld_1.9.1-dirty_armhf.deb # Configure BABELD -echo <<"EOF"> /etc/babeld.conf -interface wlan0.17 -interface eth0.17 -local-port 30003 -EOF +echo local-port 30003 > /etc/babeld.conf +echo interface eth0.17 >> /etc/babeld.conf +echo interface wlan0.17 >> /etc/babeld.conf +echo redistribute ip 2000::0/3 allow >> /etc/babeld.conf +echo redistribute ip 0::0/0 le 0 allow >> /etc/babeld.conf +echo redistribute ip 10.0.0.0/8 allow >> /etc/babeld.conf +echo redistribute ip 172.16.0.0/12 allow >> /etc/babeld.conf +echo redistribute ip 0.0.0.0/0 le 0 allow >> /etc/babeld.conf +echo redistribute local deny >> /etc/babeld.conf +echo redistribute deny >> /etc/babeld.conf + +# Force meshpoint to run at higher mtu (1560) to prevent fragmentation of batman-adv +echo 'ip link set dev $mesh_dev mtu 1560' >> /usr/bin/mesh-point + +# Try to add a second interface to mesh on the tomesh name (channel will still be differnt) +echo 'iw dev $mesh_dev interface add wlan0-tomesh type mesh mesh_id tomesh || true' >> /usr/bin/mesh-point From 56c602c0aba05e68a08b941b664bfa9ae6a08184 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sat, 22 Feb 2020 23:48:33 -0500 Subject: [PATCH 03/17] Create set-defaults.sh --- scripts/libremesh/set-defaults.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 scripts/libremesh/set-defaults.sh diff --git a/scripts/libremesh/set-defaults.sh b/scripts/libremesh/set-defaults.sh new file mode 100644 index 000000000..b70fcf879 --- /dev/null +++ b/scripts/libremesh/set-defaults.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Set Defaults +sudo touch /etc/mesh-libre.conf + +# Static libremesh vlan +# Source: https://github.com/libremesh/lime-packages/blob/master/packages/lime-docs/files/lime-example#L41 +sudo confset libremesh BABELD_VLAN 17 /etc/mesh-libre.conf + +# Default SSID for LibreMesh is "LibreMesh.org" +# It is used to define NETWORK related settings +sudo confset libremesh SSID LibreMesh.org /etc/mesh-libre.conf + +# MAC address of ethernet. Used to identify NODE specific settings +sudo confset libremesh MAC $(cat /sys/class/net/eth0/address ) /etc/mesh-libre.conf # Get Mac From a18826482650373ad0ac3f1f764f73158d203565 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sun, 23 Feb 2020 00:02:47 -0500 Subject: [PATCH 04/17] Create set-config.sh --- scripts/libremesh/set-config.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 scripts/libremesh/set-config.sh diff --git a/scripts/libremesh/set-config.sh b/scripts/libremesh/set-config.sh new file mode 100644 index 000000000..1321c6cab --- /dev/null +++ b/scripts/libremesh/set-config.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Read core paramaters +BABELD_VLAN=$(confget -f /etc/mesh-libre.conf -s libremesh "BABELD_VLAN") +SSID=$(confget -f /etc/mesh-libre.conf -s libremesh "SSID") +MAC=$(confget -f /etc/mesh-libre.conf -s libremesh "MAC") + +# MD5SUM hash for SSID will be used for the calculations (NOTE: ends in \n) +SSIDHASH="$(echo ${SSID} | md5sum | awk '{print $1}')" +sudo confset libremesh SSIDHASH ${SSIDHASH} /etc/mesh-libre.conf + +# First 4 bytes of the HASHED SSID will be used for differnt network settings +# We convert HEX to DEC +N1=$( printf "%d" "0x${SSIDHASH:0:2}" ) +N2=$( printf "%d" "0x${SSIDHASH:2:2}" ) +N3=$( printf "%d" "0x${SSIDHASH:4:2}" ) +N4=$( printf "%d" "0x${SSIDHASH:6:2}" ) + +# Last 3 bytes of the MAC (make up the node name) +NODEID=$(echo $MAC | cut -f 4 -d \:)$(echo $MAC | cut -f 5 -d \:)$(echo $MAC | cut -f 6 -d \:) +sudo confset libremesh NODEID ${NODEID} /etc/mesh-libre.conf + +M1=$( printf "%d" "0x${NODEID:0:2}" ) +M2=$( printf "%d" "0x${NODEID:2:2}" ) +M3=$( printf "%d" "0x${NODEID:4:2}" ) + +BATMAN_VLAN=$(( 29 + $(( N1 - 13 )) % 254 )) +sudo confset libremesh BATMAN_VLAN ${BATMAN_VLAN} /etc/mesh-libre.conf + +NODEIP=10.$N1.$M2.$M3 +sudo confset libremesh NODEIP ${NODEIP} /etc/mesh-libre.conf From 508dc8e9b5170dcf94788f3b744145c796926cc2 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sun, 23 Feb 2020 00:04:29 -0500 Subject: [PATCH 05/17] Rename contrib/LibreMesh/install.sh to contrib/libremesh/install.sh --- contrib/{LibreMesh => libremesh}/install.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename contrib/{LibreMesh => libremesh}/install.sh (100%) diff --git a/contrib/LibreMesh/install.sh b/contrib/libremesh/install.sh similarity index 100% rename from contrib/LibreMesh/install.sh rename to contrib/libremesh/install.sh From 9b72a0bd671590b483c4b600154986284a34a9fa Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sun, 23 Feb 2020 00:15:02 -0500 Subject: [PATCH 06/17] Create LiMe-wlan0-bat --- scripts/libremesh/LiMe-wlan0-bat | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 scripts/libremesh/LiMe-wlan0-bat diff --git a/scripts/libremesh/LiMe-wlan0-bat b/scripts/libremesh/LiMe-wlan0-bat new file mode 100644 index 000000000..404e118de --- /dev/null +++ b/scripts/libremesh/LiMe-wlan0-bat @@ -0,0 +1,7 @@ +auto wlan0.__BATMAN_VLAN__ +iface wlan0.__BATMAN_VLAN__ inet manual +post-up ip link del wlan0.__BATMAN_VLAN__ +post-up ip link add link wlan0 name wlan0.__BATMAN_VLAN__ type vlan proto 802.1ad id $__BATMAN_VLAN__ +post-up batctl if add wlan0.__BATMAN_VLAN__ +post-up ip link set wlan0.__BATMAN_VLAN__ up +post-up batctl if add wlan0.__BATMAN_VLAN__ From f38efe1585e5e908fd802d74f1bedf1d5de8484e Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sun, 23 Feb 2020 00:21:34 -0500 Subject: [PATCH 07/17] Create wlan0-babel --- scripts/libremesh/wlan0-babel | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 scripts/libremesh/wlan0-babel diff --git a/scripts/libremesh/wlan0-babel b/scripts/libremesh/wlan0-babel new file mode 100644 index 000000000..349ae5a3e --- /dev/null +++ b/scripts/libremesh/wlan0-babel @@ -0,0 +1,6 @@ +auto wlan0.__BABELD_VLAN__ +iface wlan0.__BABELD_VLAN__ inet manual + post-up ip link del wlan0.__BABELD_VLAN__ + post-up ip link add link wlan0 name wlan0.__BABELD_VLAN__ type vlan proto 802.1ad id __BABELD_VLAN__ + post-up ip link set wlan0.__BABELD_VLAN__ up + post-up ip addr add __NODEIP__/16 dev wlan0.__BABELD_VLAN__ From 03a922baef62ad390ec251d05301c5e3a66a91b4 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sun, 23 Feb 2020 00:21:51 -0500 Subject: [PATCH 08/17] Rename LiMe-wlan0-bat to wlan0-bat --- scripts/libremesh/{LiMe-wlan0-bat => wlan0-bat} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/libremesh/{LiMe-wlan0-bat => wlan0-bat} (100%) diff --git a/scripts/libremesh/LiMe-wlan0-bat b/scripts/libremesh/wlan0-bat similarity index 100% rename from scripts/libremesh/LiMe-wlan0-bat rename to scripts/libremesh/wlan0-bat From 0948d1efda64bb609f52c7fca9c3a267e1645abd Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sun, 23 Feb 2020 00:24:38 -0500 Subject: [PATCH 09/17] Create bat0 --- scripts/libremesh/bat0 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 scripts/libremesh/bat0 diff --git a/scripts/libremesh/bat0 b/scripts/libremesh/bat0 new file mode 100644 index 000000000..bb9c6ca4a --- /dev/null +++ b/scripts/libremesh/bat0 @@ -0,0 +1,8 @@ +auto bat0 +iface bat0 inet manual + pre-up batctl if add wlan0.__BATMAN_VLAN__ + post-up ip addr add $__NODEIP__/16 dev bat0 + post-up batctl bridge_loop_avoidance 1 + post-up batctl multicast_mode 0 + post-up batctl distributed_arp_table 0 + post-up batctl gw_mode client From 2b41460fdd100b16b47e49e44c43619abc8f8193 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sun, 23 Feb 2020 00:28:26 -0500 Subject: [PATCH 10/17] Create eth0-babeld --- scripts/libremesh/eth0-babeld | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 scripts/libremesh/eth0-babeld diff --git a/scripts/libremesh/eth0-babeld b/scripts/libremesh/eth0-babeld new file mode 100644 index 000000000..f93a2916a --- /dev/null +++ b/scripts/libremesh/eth0-babeld @@ -0,0 +1,7 @@ +# ETH VLAN for layer 3 BABELD meshing +auto eth0.__BABELD_VLAN__ +iface eth0.__BABELD_VLAN__ inet manual + post-up ip link del eth0.__BABELD_VLAN__ + post-up ip link add link eth0 name eth0.__BABELD_VLAN__ type vlan proto 802.1ad id __BABELD_VLAN__ + post-up ip link set eth0.__BABELD_VLAN__ up + post-up ip addr add __NODEIP__/16 dev eth0.__BABELD_VLAN__ From 3dc734dd52ddae80bad7e5f74226710bd32a2872 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sun, 23 Feb 2020 00:38:27 -0500 Subject: [PATCH 11/17] Create babeld.conf --- scripts/libremesh/babeld.conf | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 scripts/libremesh/babeld.conf diff --git a/scripts/libremesh/babeld.conf b/scripts/libremesh/babeld.conf new file mode 100644 index 000000000..7aa483c01 --- /dev/null +++ b/scripts/libremesh/babeld.conf @@ -0,0 +1,10 @@ + local-port 30003 + interface eth0.__BABELD_VLAN__ + interface wlan0.__BABELD_VLAN__ + redistribute ip 2000::0/3 allow + redistribute ip 0::0/0 le 0 allow + redistribute ip 10.0.0.0/8 allow + redistribute ip 172.16.0.0/12 allow + redistribute ip 0.0.0.0/0 le 0 allow + redistribute local deny + redistribute deny From cddb3336b5ef106c3fdb9a096d9074aea01b3f96 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sun, 23 Feb 2020 00:40:39 -0500 Subject: [PATCH 12/17] Create install.sh --- scripts/libremesh/install.sh | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 scripts/libremesh/install.sh diff --git a/scripts/libremesh/install.sh b/scripts/libremesh/install.sh new file mode 100644 index 000000000..e81858088 --- /dev/null +++ b/scripts/libremesh/install.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +ARCH="$(uname -m)" +case "$ARCH" in + x86_64) + ARCH="amd64" + ;; + i386 | i586 | i686 ) + ARCH="386" + ;; + armv7l) + ARCH="armv7"; + ;; + armv6l) + ARCH="armv6"; + ;; + aarch64) + ARCH="arm64"; + ;; + *) + echo "Unknown Arch" + exit 1 + ;; +esac + +# Set default settings for libremesh +./set-defaults.sh + +# Update configs of libremesh +./set-config.sh + +# Install batman +sudo apt-get install -y batctl + +# Change mesh-point settings to use channel 11 (Libremesh default) and set meshname of LiMe +sudo confset general frequency 2462 /etc/mesh.conf +sudo confset general mesh-name LiMe /etc/mesh.conf + +# Always load batman on boot +echo batman-adv >> /etc/modules + +# Install Babled from meshwithme repos +wget http://meshwithme.online/deb/repos/apt/debian/pool/main/c/confset/confset_1_all.deb +sudo dpkg -i confset_1_all.deb +wget http://meshwithme.online/deb/repos/apt/debian/pool/main/b/babeld/babeld_1.9.1-dirty_${ARCH}.deb +sudo dpkg -i babeld_1.9.1-dirty_${ARCH}.deb +wget http://meshwithme.online/deb/repos/apt/debian/pool/main/b/babeld-tomesh/babeld-tomesh_1_all.deb +sudo dpkg -i babeld-tomesh_1_all.deb + +# Force meshpoint to run at higher mtu (1560) to prevent fragmentation of batman-adv +echo 'ip link set dev $mesh_dev mtu 1560' >> /usr/bin/mesh-point + +# Try to add a second interface to mesh on the tomesh name (channel will still be differnt) +echo 'iw dev $mesh_dev interface add wlan0-tomesh type mesh mesh_id tomesh || true' >> /usr/bin/mesh-point + +# Generate network config +sudo ./updateConfig.sh From cdbfcf628b9090059791b1806b494d5cf48d5321 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sun, 23 Feb 2020 00:41:07 -0500 Subject: [PATCH 13/17] Create updateConfig.sh --- scripts/libremesh/updateConfig.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 scripts/libremesh/updateConfig.sh diff --git a/scripts/libremesh/updateConfig.sh b/scripts/libremesh/updateConfig.sh new file mode 100644 index 000000000..4d3c383a9 --- /dev/null +++ b/scripts/libremesh/updateConfig.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +cp wlan0-bat /tmp/wlan0.${BATMAN_VLAN} +sed -i "s/__BATMAN_VLAN__/$BATMAN_VLAN/g" "/tmp/wlan0.${BATMAN_VLAN}" +sudo mv /tmp/wlan0.${BATMAN_VLAN} /etc/network/interfaces.d/wlan0.${BATMAN_VLAN} + +cp bat0 /tmp/bat0 +sed -i "s/__BATMAN_VLAN__/$BATMAN_VLAN/g" "/tmp/bat0" +sed -i "s/__NODEIP__/$NODEIP/g" "/tmp/bat0" +sudo mv /tmp/bat0 /etc/network/interfaces.d/bat0 + +cp wlan0-bat /tmp/wlan0.${BABELD_VLAN} +sed -i "s/__BABELD_VLAN__/$BABELD_VLAN/g" "/tmp/wlan0.${BABELD_VLAN}" +sed -i "s/__NODEIP__/$NODEIP/g" "/tmp/wlan0.${BABELD_VLAN}" +sudo mv /tmp/wlan0.${BABELD_VLAN} /etc/network/interfaces.d/wlan0.${BABELD_VLAN} + +# ETH VLAN for layer 3 BABELD meshing +cp eth0-babeld /tmp/eth0.${BABELD_VLAN} +sed -i "s/__BABELD_VLAN__/$BABELD_VLAN/g" "/tmp/eth0.${BABELD_VLAN}" +sed -i "s/__NODEIP__/$NODEIP/g" "/tmp/eth0.${BABELD_VLAN}" +sudo mv /tmp/eth0.${BABELD_VLAN} /etc/network/interfaces.d/eth0.${BABELD_VLAN} + +# ETH VLAN for layer 3 BABELD meshing +cp babeld.conf /tmp/babeld.conf +sed -i "s/__BABELD_VLAN__/$BABELD_VLAN/g" "/tmp/babeld.conf" +sudo mv /tmp/babeld.conf /etc/babeld.d/libremesh From 6bb8d8164c93bcaa7d8f2b18154ffac19cf5a1b2 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sun, 23 Feb 2020 00:42:50 -0500 Subject: [PATCH 14/17] Flag as executable --- scripts/libremesh/install.sh | 0 scripts/libremesh/set-config.sh | 0 scripts/libremesh/set-defaults.sh | 0 scripts/libremesh/updateConfig.sh | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/libremesh/install.sh mode change 100644 => 100755 scripts/libremesh/set-config.sh mode change 100644 => 100755 scripts/libremesh/set-defaults.sh mode change 100644 => 100755 scripts/libremesh/updateConfig.sh diff --git a/scripts/libremesh/install.sh b/scripts/libremesh/install.sh old mode 100644 new mode 100755 diff --git a/scripts/libremesh/set-config.sh b/scripts/libremesh/set-config.sh old mode 100644 new mode 100755 diff --git a/scripts/libremesh/set-defaults.sh b/scripts/libremesh/set-defaults.sh old mode 100644 new mode 100755 diff --git a/scripts/libremesh/updateConfig.sh b/scripts/libremesh/updateConfig.sh old mode 100644 new mode 100755 From 21054f46c7119a8a2daf2bafc1022a8341388bb3 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sun, 23 Feb 2020 00:51:05 -0500 Subject: [PATCH 15/17] Updated config and tested --- scripts/libremesh/bat0 | 2 +- scripts/libremesh/install.sh | 4 ++-- scripts/libremesh/updateConfig.sh | 7 ++++++- scripts/libremesh/{wlan0-babel => wlan0-babeld} | 0 scripts/libremesh/wlan0-bat | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) rename scripts/libremesh/{wlan0-babel => wlan0-babeld} (100%) diff --git a/scripts/libremesh/bat0 b/scripts/libremesh/bat0 index bb9c6ca4a..943b7b64a 100644 --- a/scripts/libremesh/bat0 +++ b/scripts/libremesh/bat0 @@ -1,7 +1,7 @@ auto bat0 iface bat0 inet manual pre-up batctl if add wlan0.__BATMAN_VLAN__ - post-up ip addr add $__NODEIP__/16 dev bat0 + post-up ip addr add __NODEIP__/16 dev bat0 post-up batctl bridge_loop_avoidance 1 post-up batctl multicast_mode 0 post-up batctl distributed_arp_table 0 diff --git a/scripts/libremesh/install.sh b/scripts/libremesh/install.sh index e81858088..843c61aef 100755 --- a/scripts/libremesh/install.sh +++ b/scripts/libremesh/install.sh @@ -48,10 +48,10 @@ wget http://meshwithme.online/deb/repos/apt/debian/pool/main/b/babeld-tomesh/bab sudo dpkg -i babeld-tomesh_1_all.deb # Force meshpoint to run at higher mtu (1560) to prevent fragmentation of batman-adv -echo 'ip link set dev $mesh_dev mtu 1560' >> /usr/bin/mesh-point +echo 'ip link set dev $mesh_dev mtu 1560' | sudo tee --append /usr/bin/mesh-point # Try to add a second interface to mesh on the tomesh name (channel will still be differnt) -echo 'iw dev $mesh_dev interface add wlan0-tomesh type mesh mesh_id tomesh || true' >> /usr/bin/mesh-point +echo 'iw dev $mesh_dev interface add wlan0-tomesh type mesh mesh_id tomesh || true' | sudo tee --append /usr/bin/mesh-point # Generate network config sudo ./updateConfig.sh diff --git a/scripts/libremesh/updateConfig.sh b/scripts/libremesh/updateConfig.sh index 4d3c383a9..b5c4e4d9f 100755 --- a/scripts/libremesh/updateConfig.sh +++ b/scripts/libremesh/updateConfig.sh @@ -1,5 +1,10 @@ #!/bin/bash +BABELD_VLAN=$(confget -f /etc/mesh-libre.conf -s libremesh "BABELD_VLAN") +BATMAN_VLAN=$(confget -f /etc/mesh-libre.conf -s libremesh "BATMAN_VLAN") +NODEIP=$(confget -f /etc/mesh-libre.conf -s libremesh "NODEIP") + + cp wlan0-bat /tmp/wlan0.${BATMAN_VLAN} sed -i "s/__BATMAN_VLAN__/$BATMAN_VLAN/g" "/tmp/wlan0.${BATMAN_VLAN}" sudo mv /tmp/wlan0.${BATMAN_VLAN} /etc/network/interfaces.d/wlan0.${BATMAN_VLAN} @@ -9,7 +14,7 @@ sed -i "s/__BATMAN_VLAN__/$BATMAN_VLAN/g" "/tmp/bat0" sed -i "s/__NODEIP__/$NODEIP/g" "/tmp/bat0" sudo mv /tmp/bat0 /etc/network/interfaces.d/bat0 -cp wlan0-bat /tmp/wlan0.${BABELD_VLAN} +cp wlan0-babeld /tmp/wlan0.${BABELD_VLAN} sed -i "s/__BABELD_VLAN__/$BABELD_VLAN/g" "/tmp/wlan0.${BABELD_VLAN}" sed -i "s/__NODEIP__/$NODEIP/g" "/tmp/wlan0.${BABELD_VLAN}" sudo mv /tmp/wlan0.${BABELD_VLAN} /etc/network/interfaces.d/wlan0.${BABELD_VLAN} diff --git a/scripts/libremesh/wlan0-babel b/scripts/libremesh/wlan0-babeld similarity index 100% rename from scripts/libremesh/wlan0-babel rename to scripts/libremesh/wlan0-babeld diff --git a/scripts/libremesh/wlan0-bat b/scripts/libremesh/wlan0-bat index 404e118de..baccf431b 100644 --- a/scripts/libremesh/wlan0-bat +++ b/scripts/libremesh/wlan0-bat @@ -1,7 +1,7 @@ auto wlan0.__BATMAN_VLAN__ iface wlan0.__BATMAN_VLAN__ inet manual post-up ip link del wlan0.__BATMAN_VLAN__ -post-up ip link add link wlan0 name wlan0.__BATMAN_VLAN__ type vlan proto 802.1ad id $__BATMAN_VLAN__ +post-up ip link add link wlan0 name wlan0.__BATMAN_VLAN__ type vlan proto 802.1ad id __BATMAN_VLAN__ post-up batctl if add wlan0.__BATMAN_VLAN__ post-up ip link set wlan0.__BATMAN_VLAN__ up post-up batctl if add wlan0.__BATMAN_VLAN__ From 5a0f3e37bc8f7e92f5113b68d1afe6469e4e4f0d Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sun, 23 Feb 2020 01:05:19 -0500 Subject: [PATCH 16/17] updated install --- scripts/install2 | 28 ++++++++++++++++++---------- scripts/shared/hostname/install | 11 ++++++++++- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/scripts/install2 b/scripts/install2 index 717974f4a..45deaf07f 100755 --- a/scripts/install2 +++ b/scripts/install2 @@ -257,6 +257,9 @@ askModule "WITH_MESH_POINT" "Mesh Point Interface" if [ "$WITH_MESH_POINT" == false ]; then askModule "WITH_AD_HOC" "Ad-Hoc Interface" fi +if [ "$WITH_MESH_POINT" == true ] || [ "$WITH_AD_HOC" == true ]; then + askModule "WITH_LIBREMESH" "LibreMesh Compatibility" +fi askModule "WITH_WIFI_AP" "WiFi Access Point" askModule "WITH_FIREWALL" "Basic Firewall" askModule "WITH_IPFS" "IPFS" @@ -287,6 +290,16 @@ sudo apt-get install haveged -y || true # Install nginx source nginx/install +# 802.11s Mesh Point interface +if [ "$(checkModule 'WITH_MESH_POINT')" ]; then + source mesh-point/install +fi + +# IBSS Ad-hoc interface +if [ "$(checkModule 'WITH_AD_HOC')" ]; then + source mesh-adhoc/install +fi + # Install CJDNS if [ "$(checkModule 'WITH_CJDNS')" ]; then source cjdns/install @@ -297,22 +310,17 @@ if [ "$(checkModule 'WITH_YGGDRASIL')" ]; then source yggdrasil/install fi +# Install LibreMesh +if [ "$(checkModule 'WITH_LIBREMESH')" ]; then + source libremesh/install +fi + # Install nodeinfo source shared/nodeinfo/install # Set hostname source shared/hostname/install -# 802.11s Mesh Point interface -if [ "$(checkModule 'WITH_MESH_POINT')" ]; then - source mesh-point/install -fi - -# IBSS Ad-hoc interface -if [ "$(checkModule 'WITH_AD_HOC')" ]; then - source mesh-adhoc/install -fi - # WiFi Access Point on supported boards if [ "$(checkModule 'WITH_WIFI_AP')" ]; then source hostapd/install diff --git a/scripts/shared/hostname/install b/scripts/shared/hostname/install index a9674425c..ea34dcf1c 100644 --- a/scripts/shared/hostname/install +++ b/scripts/shared/hostname/install @@ -2,6 +2,15 @@ MESH_NAME=$(confget -f /etc/mesh.conf -s general "mesh-name") +# Define hostname based off LibreMesh if installed +if [ -f '/etc/mesh-libre.conf' ]; then + # Define new hostname + if [ -z "${NEWHOSTNAME}" ]; then + NEWHOSTNAME="$MESH_NAME-$(confget -f /etc/mesh-libre.conf -s libremesh NODEID)" + fi +fi + +# Define hostname based on CJDNS if installed if [ -f '/etc/cjdroute.conf' ]; then # Define new hostname if [ -z "${NEWHOSTNAME}" ]; then @@ -9,7 +18,7 @@ if [ -f '/etc/cjdroute.conf' ]; then fi fi -# Define hostname based off Yggdrasil if CJDNS isn't installed +# Define hostname based off Yggdrasil if Installed if ! [ -z "$(ifconfig | grep ygg0:)" ]; then # Define new hostname if [ -z "${NEWHOSTNAME}" ]; then From 4f3b5bc6fa0eb8d43a5c83a2a36e7cd7de898e49 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sun, 23 Feb 2020 02:37:45 -0500 Subject: [PATCH 17/17] Remove .sh extension --- scripts/libremesh/{install.sh => install} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/libremesh/{install.sh => install} (100%) diff --git a/scripts/libremesh/install.sh b/scripts/libremesh/install similarity index 100% rename from scripts/libremesh/install.sh rename to scripts/libremesh/install