diff --git a/auto-complete.sh b/auto-complete.sh index 7ec8990..190d307 100755 --- a/auto-complete.sh +++ b/auto-complete.sh @@ -4,7 +4,7 @@ function libs() { if [ "$1" != "" ]; then - COMPREPLY=($(compgen -W "network-scanning network-adhoc sensor-node ssh-tunneling iptables poc-datacollector help" "${COMP_WORDS[$COMP_CWORD]}")) + COMPREPLY=($(compgen -W "network-scanning network-adhoc raspi-docker sensor-node ssh-tunneling iptables poc-datacollector help" "${COMP_WORDS[$COMP_CWORD]}")) fi } diff --git a/build.sh b/build.sh index fefe6ad..3187e6b 100755 --- a/build.sh +++ b/build.sh @@ -37,6 +37,8 @@ usage () echo "" echo -e " ${txtg}poc-datacollector:${NOCOLOR} This tutorial demonstrates, howto setup data collector & howto use it " echo "" + echo -e " ${txtg}raspi-docker:${NOCOLOR} This tutorial demonstrates, howto setup docker on Raspberry PI & howto use it " + echo "" echo -e " ${txtg}sensor-node:${NOCOLOR} This tutorial demonstrates, howto create a mote with Raspberry Pi and Arduino & howto use it " echo "" echo -e " ${txtg}ssh-tunneling:${NOCOLOR} This tutorial demonstrates, howto create a ssh-tunneling & howto use it " @@ -130,6 +132,15 @@ do docdir="poc-datacollector" ; COMMAND_CREATE=1 ;; + + raspi-docker) + DESC="raspi-docker" ; + build="build.sh" ; + # source adoc directory + docdir="raspi-docker" ; + COMMAND_CREATE=1 + ;; + iptables) DESC="iptables" ; build="build.sh" ; diff --git a/raspi-docker/antora.yml b/raspi-docker/antora.yml new file mode 100644 index 0000000..6bfe534 --- /dev/null +++ b/raspi-docker/antora.yml @@ -0,0 +1,5 @@ + name: swarmlab_network-adhoc + title: swarmlab_network-adhoc + version: docs + nav: + - modules/ROOT/nav.adoc diff --git a/raspi-docker/modules/ROOT/images/adhoc.png b/raspi-docker/modules/ROOT/images/adhoc.png new file mode 100644 index 0000000..6256678 Binary files /dev/null and b/raspi-docker/modules/ROOT/images/adhoc.png differ diff --git a/raspi-docker/modules/ROOT/images/swarmlab.png b/raspi-docker/modules/ROOT/images/swarmlab.png new file mode 100644 index 0000000..d94ea42 Binary files /dev/null and b/raspi-docker/modules/ROOT/images/swarmlab.png differ diff --git a/raspi-docker/modules/ROOT/images/trafic.png b/raspi-docker/modules/ROOT/images/trafic.png new file mode 100644 index 0000000..d7e160a Binary files /dev/null and b/raspi-docker/modules/ROOT/images/trafic.png differ diff --git a/raspi-docker/modules/ROOT/images/vehigle.png b/raspi-docker/modules/ROOT/images/vehigle.png new file mode 100644 index 0000000..46d0c6b Binary files /dev/null and b/raspi-docker/modules/ROOT/images/vehigle.png differ diff --git a/raspi-docker/modules/ROOT/nav.adoc b/raspi-docker/modules/ROOT/nav.adoc new file mode 100644 index 0000000..cf040ad --- /dev/null +++ b/raspi-docker/modules/ROOT/nav.adoc @@ -0,0 +1,2 @@ +* xref:index.adoc[network-adhoc] +* xref:index-setup.adoc[setup] diff --git a/raspi-docker/modules/ROOT/pages/index-setup.adoc b/raspi-docker/modules/ROOT/pages/index-setup.adoc new file mode 100644 index 0000000..9349224 --- /dev/null +++ b/raspi-docker/modules/ROOT/pages/index-setup.adoc @@ -0,0 +1,312 @@ += Setup + +TIP: Tested on a Raspberry Pi with "Buster" + +== Intro + +networkd is a small and lean service to configure network interfaces, designed mostly for server use cases in a world with hotplugged and virtualized networking. Its configuration is similar in spirit and abstraction level to ifupdown, but you don't need any extra packages to configure bridges, bonds, vlan etc. It is not very suitable for managing WLANs yet; NetworkManager is still much more appropriate for such Desktop use cases. + + There are mainly three setups to have a peer to peer network: + +* unprotected ad-hoc interface by configuring the WiFi device +* unprotected ad-hoc interface using wpa_supplicant (Recommended) +* Only with suitable (RSN-IBSS capable) USB dongle: +* protected ad-hoc interface using wpa_supplicant and WPA encryption (best solution if possible) +* ad-hoc interface with additional USB/WiFi dongle for uplink to internet router + + +== Install systemd-networkd + +=== deinstall classic networking and install it! + +* *sudo su* # if not already done + +*deinstall* +[source,sh] +---- +systemctl daemon-reload +systemctl disable --now ifupdown dhcpcd dhcpcd5 isc-dhcp-client isc-dhcp-common rsyslog +apt --autoremove purge -f ifupdown dhcpcd dhcpcd5 isc-dhcp-client isc-dhcp-common rsyslog +rm -r /etc/network /etc/dhcp + +# setup/enable systemd-resolved and systemd-networkd + +systemctl disable --now avahi-daemon libnss-mdns +apt --autoremove -f purge avahi-daemon +apt install -f libnss-resolve +ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf +apt-mark hold avahi-daemon dhcpcd dhcpcd5 ifupdown isc-dhcp-client isc-dhcp-common libnss-mdns openresolv raspberrypi-net-mods rsyslog +systemctl enable systemd-networkd.service systemd-resolved.service +---- + +=== setup wired connection + +*wired connection* +[source,sh] +---- +cat > /etc/systemd/network/04-wired.network < +Gateway=192.168.1.1 // <2> +DNS=8.8.8.8 1.1.1.1 // <3> +MulticastDNS=yes +EOF +---- +<1> use your settings +<2> use your settings +<2> use your settings + + +=== Reboot + +NOTE: reboot + +== Config + + +=== NSS + +*config nss* +[source,sh] +---- +apt --autoremove purge avahi-daemon +apt-mark hold avahi-daemon +apt install -f libnss-resolve + +echo "" +echo "For troubleshooting you may have a look at /etc/nsswitch.conf. It should contain a line like this:" +echo "" +echo "hosts: files resolve [!UNAVAIL=return] dns" +echo "" +echo "" +echo "" +echo "" +---- + + +=== DNS + + +*config dns* +[source,sh] +---- + +echo "" +echo "Configure DNS stub listener interface" +echo "" + +echo "Here we have to symlink /etc/resolv.conf to the stub listener:" +echo "" +echo " exec4you ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf" +ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf +echo "" + +echo "Check name resolution" + + +resolvectl status +---- + +== unprotected ad-hoc interface using wpa_supplicant + +Follow *Install systemd-networkd* + +Then come back here. + +TIP: unprotected + +* *sudo su* # if not already done + +[source,sh] +---- + +cat > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf < /etc/wpa_supplicant/wpa_supplicant-wlan1.conf <