= Setup


== Intro

[.float-group]
--
[.right]
image::ROOT:swarm-poc.png[float=right]

:hardbreaks:

{empty} +
{empty} 

:!hardbreaks:

.From -> To

* [*] monolithic -> networking architecture
* [*] static -> Dynamic
* [*] host based -> Service based 
* [*] linear -> agile
--

TIP: You will learn to code, coordinate and orchestrate a swarm of self-acting nodes.

== Install systemd-networkd


.systemd-networkd
[source,sh]
----

# deinstall classic networking

#sudo -Es   # if not already done
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
#exit

cat > /etc/systemd/network/04-wired.network <<EOF
[Match]
Name=e*

[Network]
## Uncomment only one option block
# Option: using a DHCP server and multicast DNS
LLMNR=no
LinkLocalAddressing=no
MulticastDNS=yes
DHCP=ipv4

# Option: using link-local ip addresses and multicast DNS
#LLMNR=no
#LinkLocalAddressing=yes
#MulticastDNS=yes

# Option: using static ip address and multicast DNS
# (example, use your settings)
Address=192.168.1.18/24
Gateway=192.168.1.1
DNS=8.8.8.8 1.1.1.1
MulticastDNS=yes
EOF

echo "reboot"
----








