You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

723 lines
21 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Setup :: Swarmlab faq</title>
<link rel="canonical" href="http://docs.swarmlab.io/SwarmLab-HowTos/swarmlab/docs/swarmlab_tech-list/docs/index-setup.html">
<meta name="generator" content="Antora 2.3.4">
<link rel="stylesheet" href="../../_/css/site.css">
<link rel="stylesheet" href="../../_/css/search.css">
<script>var uiRootPath = '../../_'</script>
</head>
<body class="article">
<header class="header">
<nav class="navbar">
<div class="navbar-brand">
<a class="navbar-item" href="http://docs.swarmlab.io/SwarmLab-HowTos/swarmlab/docs">Swarmlab faq</a>
<button class="navbar-burger" data-target="topbar-nav">
<span></span>
<span></span>
<span></span>
</button>
</div>
<div id="topbar-nav" class="navbar-menu">
<div class="navbar-end">
<a class="navbar-item" href="#">Home</a>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link" href="#">Products</a>
<div class="navbar-dropdown">
<a class="navbar-item" target ="hybridgit" href="https://git.swarmlab.io:3000/zeus/swarmlab-hybrid">Hybrid</a>
<a class="navbar-item" target ="venusgit" href="https://git.swarmlab.io:3000/swarmlab/venus-client">Venus</a>
</div>
</div>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link" href="#">Services</a>
<div class="navbar-dropdown">
<a class="navbar-item" target ="hybrid" href="https://api-client.swarmlab.io:8088/">Hybrid</a>
<a class="navbar-item" target ="venus" href="https://api-client.swarmlab.io:8088/">Venus</a>
</div>
</div>
<div class="navbar-item">
<input id="search-input" type="text" placeholder="Search docs">
</div>
</div>
</div>
</nav>
</header>
<div class="body">
<div class="nav-container" data-component="swarmlab_tech-list" data-version="docs">
<aside class="nav">
<div class="panels">
<div class="nav-panel-menu is-active" data-panel="menu">
<nav class="nav-menu">
<h3 class="title"><a href="index.html">swarmlab_tech-list</a></h3>
<ul class="nav-list">
<li class="nav-item" data-depth="0">
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<a class="nav-link" href="index.html">list</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="nav-panel-explore" data-panel="explore">
<div class="context">
<span class="title">swarmlab_tech-list</span>
<span class="version">docs</span>
</div>
<ul class="components">
<li class="component">
<a class="title" href="../../swarmlab_faq/docs/index.html">swarmlab_faq</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_faq/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_how-to-build-a-Swarmlab-service/docs/index.html">swarmlab_how-to-build-a-Swarmlab-service</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_how-to-build-a-Swarmlab-service/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_infrastructure-as-code/docs/index.html">swarmlab_infrastructure-as-code</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_infrastructure-as-code/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_iot-sensor-node/docs/index.html">swarmlab_iot-sensor-node</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_iot-sensor-node/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_network-adhoc/docs/index.html">swarmlab_network-adhoc</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_network-adhoc/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_poc-datacollector/docs/index.html">swarmlab_poc-datacollector</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_poc-datacollector/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_raspi-docker/docs/index.html">swarmlab_raspi-docker</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_raspi-docker/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_sec-intro/docs/index.html">swarmlab_sec-intro</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_sec-intro/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_sec-iptables/docs/index.html">swarmlab_sec-iptables</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_sec-iptables/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_sec-ssh-tunneling/docs/index.html">swarmlab_sec-ssh-tunneling</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_sec-ssh-tunneling/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_sidecar-firefox/docs/index.html">swarmlab_sidecar-firefox</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_sidecar-firefox/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component is-current">
<a class="title" href="index.html">swarmlab_tech-list</a>
<ul class="versions">
<li class="version is-current is-latest">
<a href="index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_xelatex-thesis/docs/index.html">swarmlab_xelatex-thesis</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_xelatex-thesis/docs/index.html">docs</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
</aside>
</div>
<main class="article">
<div class="toolbar" role="navigation">
<button class="nav-toggle"></button>
<a href="../../swarmlab_faq/docs/index.html" class="home-link"></a>
<nav class="breadcrumbs" aria-label="breadcrumbs">
<ul>
<li><a href="index.html">swarmlab_tech-list</a></li>
<li><a href="index-setup.html">Setup</a></li>
</ul>
</nav>
</div>
<div class="content">
<aside class="toc sidebar" data-title="Contents" data-levels="2">
<div class="toc-menu"></div>
</aside>
<article class="doc">
<h1 class="page">Setup</h1>
<div id="preamble">
<div class="sectionbody">
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
Tested on a Raspberry Pi with "Buster"
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_intro"><a class="anchor" href="#_intro"></a>Intro</h2>
<div class="sectionbody">
<div class="paragraph">
<p>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&#8217;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.</p>
</div>
<div class="literalblock">
<div class="content">
<pre>There are mainly three setups to have a peer to peer network:</pre>
</div>
</div>
<div class="ulist">
<ul>
<li>
<p>unprotected ad-hoc interface by configuring the WiFi device</p>
</li>
<li>
<p>unprotected ad-hoc interface using wpa_supplicant (Recommended)</p>
</li>
<li>
<p>Only with suitable (RSN-IBSS capable) USB dongle:</p>
</li>
<li>
<p>protected ad-hoc interface using wpa_supplicant and WPA encryption (best solution if possible)</p>
</li>
<li>
<p>ad-hoc interface with additional USB/WiFi dongle for uplink to internet router</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_install_systemd_networkd"><a class="anchor" href="#_install_systemd_networkd"></a>Install systemd-networkd</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_deinstall_classic_networking_and_install_it"><a class="anchor" href="#_deinstall_classic_networking_and_install_it"></a>deinstall classic networking and install it!</h3>
<div class="ulist">
<ul>
<li>
<p><strong>sudo su</strong> # if not already done</p>
</li>
</ul>
</div>
<div class="paragraph">
<p><strong>deinstall</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="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</code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_install_optional"><a class="anchor" href="#_install_optional"></a>Install optional</h2>
<div class="sectionbody">
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="sh">apt-get install raspberrypi-kernel-headers -y</code></pre>
</div>
</div>
<div class="sect2">
<h3 id="_setup_wired_connection"><a class="anchor" href="#_setup_wired_connection"></a>setup wired connection</h3>
<div class="paragraph">
<p><strong>wired connection</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="sh">cat &gt; /etc/systemd/network/04-wired.network &lt;&lt;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
Address=192.168.1.18/24 <i class="conum" data-value="1"></i><b>(1)</b>
Gateway=192.168.1.1 <i class="conum" data-value="2"></i><b>(2)</b>
DNS=8.8.8.8 1.1.1.1 <i class="conum" data-value="3"></i><b>(3)</b>
MulticastDNS=yes
EOF</code></pre>
</div>
</div>
<div class="colist arabic">
<table>
<tr>
<td><i class="conum" data-value="1"></i><b>1</b></td>
<td>use your settings</td>
</tr>
<tr>
<td><i class="conum" data-value="2"></i><b>2</b></td>
<td>use your settings</td>
</tr>
<tr>
<td><i class="conum" data-value="3"></i><b>3</b></td>
<td>use your settings</td>
</tr>
</table>
</div>
</div>
<div class="sect2">
<h3 id="_reboot"><a class="anchor" href="#_reboot"></a>Reboot</h3>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
reboot
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_config"><a class="anchor" href="#_config"></a>Config</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_nss"><a class="anchor" href="#_nss"></a>NSS</h3>
<div class="paragraph">
<p><strong>config nss</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="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 ""</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_dns"><a class="anchor" href="#_dns"></a>DNS</h3>
<div class="paragraph">
<p><strong>config dns</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="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</code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_unprotected_ad_hoc_interface_using_wpa_supplicant"><a class="anchor" href="#_unprotected_ad_hoc_interface_using_wpa_supplicant"></a>unprotected ad-hoc interface using wpa_supplicant</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Follow <strong>Install systemd-networkd</strong></p>
</div>
<div class="paragraph">
<p>Then come back here.</p>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
unprotected
</td>
</tr>
</table>
</div>
<div class="ulist">
<ul>
<li>
<p><strong>sudo su</strong> # if not already done</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="sh">cat &gt; /etc/wpa_supplicant/wpa_supplicant-wlan0.conf &lt;&lt;EOF
ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
update_config=1
p2p_disabled=1
country=GR
network={
ssid="IBSS-RPiNet"
frequency=2412 # channel 1
mode=1 # IBSS (ad-hoc, peer-to-peer)
key_mgmt=NONE
}
EOF
chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
systemctl enable wpa_supplicant@wlan0.service
echo ""
echo "enabled4you"
echo "systemctl enable wpa_supplicant@wlan0.service"
echo ""</code></pre>
</div>
</div>
<div class="sect2">
<h3 id="_reboot_2"><a class="anchor" href="#_reboot_2"></a>Reboot</h3>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
Reboot
</td>
</tr>
</table>
</div>
</div>
<div class="sect2">
<h3 id="_check"><a class="anchor" href="#_check"></a>Check</h3>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="sh">echo ""
echo "Check with:"
echo ""
echo "iw dev"
echo ""
echo "iw dev wlan0 link"
echo ""
echo "ip addr"
echo ""
echo "sudo iw dev wlan0 scan | grep -B8 -A3 "IBSS-RPiNet""
echo ""
# From another ad hoc connected device you should be able to
echo "From another ad hoc connected device you should be able to"
echo ""
echo "ping -c3 raspberrypi.local"
echo ""</code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_protected_ad_hoc_interface_using_wpa_supplicant"><a class="anchor" href="#_protected_ad_hoc_interface_using_wpa_supplicant"></a>protected ad-hoc interface using wpa_supplicant</h2>
<div class="sectionbody">
<div class="admonitionblock caution">
<table>
<tr>
<td class="icon">
<i class="fa icon-caution" title="Caution"></i>
</td>
<td class="content">
Raspberry Pi does not support encrypted IBSS connections!. You have to use an additional USB WiFi dongle that usually registers an interface wlan1. My setup shows:
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>Follow <strong>Install systemd-networkd</strong></p>
</div>
<div class="paragraph">
<p>Then come back here.</p>
</div>
<div class="paragraph">
<p><strong>check</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="sh">iw list | grep -P "Wiphy|RSN-IBSS"</code></pre>
</div>
</div>
<div class="paragraph">
<p><strong>output</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="sh">Wiphy phy1
Device supports RSN-IBSS.
Wiphy phy0</code></pre>
</div>
</div>
<div class="literalblock">
<div class="content">
<pre>You cannot find this support entry for Wiphy pyh0 that is the on-board WiFi device.</pre>
</div>
</div>
<div class="sect2">
<h3 id="_install_driver"><a class="anchor" href="#_install_driver"></a>Install driver</h3>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
Example TP-Link
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="sh">echo "lsusb"
echo ""
echo "Example for TP-Link"
echo ""
echo "Bus 001 Device 005: ID 2357:0109 TP-Link TL WN823N RTL8192EU"
echo ""
sudo wget http://downloads.fars-robotics.net/wifi-drivers/install-wifi -O /usr/bin/install-wifi
sudo chmod +x /usr/bin/install-wifi
echo ""
echo "sudo install-wifi -h"
echo ""
echo "will give details on how to use the script."
echo ""
echo "To download the driver for your current kernel use command"
sudo install-wifi
echo "sudo install-wifi 8192eu"
echo ""
sudo install-wifi 8192eu
echo ""
echo "If you update your kernel version you will need to re-run the script to update the driver version."</code></pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
*On message: *
</td>
</tr>
</table>
</div>
<div class="exampleblock">
<div class="content">
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="sh">Your Pi revision number is a02082
You have a Pi 3B v1.2
Checking for a 8188eu wifi driver module for your current kernel.
A driver does not exist for this update.</code></pre>
</div>
</div>
<div class="ulist">
<ul>
<li>
<p>Find source for driver e.g.</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="sh">git clone https://github.com/lwfinger/rtl8188eu.git
cd rtl8188eu
make all
sudo make install
sudo depmod
sudo modprobe 8188eu
lsmod 8188eu</code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_setup"><a class="anchor" href="#_setup"></a>setup</h3>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="sh">sudo systemctl disable --now wpa_supplicant@wlan0.service
echo "sudo -Es # if not already done"
echo ""
cat &gt; /etc/wpa_supplicant/wpa_supplicant-wlan1.conf &lt;&lt;EOF
ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
update_config=1
p2p_disabled=1
country=GR
network={
ssid="IBSS-RPiNet"
key_mgmt=WPA-PSK
proto=RSN
psk="verySecretPasswordi123"
mode=1
frequency=2412
}
EOF
chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan1.conf
systemctl enable wpa_supplicant@wlan1.service</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_reboot_3"><a class="anchor" href="#_reboot_3"></a>Reboot</h3>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
reboot
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="sh">echo ""
echo "reboot."
echo ""</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_check_2"><a class="anchor" href="#_check_2"></a>Check</h3>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-sh hljs" data-lang="sh">echo "iw dev"
echo ""
echo "iw dev wlan1 link"
echo ""
echo "ip addr"
echo ""
echo "sudo iw dev wlan1 scan | grep -B8 -A3 "IBSS-RPiNet""
echo ""
echo "From another ad hoc connected device you should be able to"
echo ""
echo "ping -c3 raspberrypi.local"
echo ""</code></pre>
</div>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="https://raspberrypi.stackexchange.com/questions/94047/how-to-setup-an-unprotected-ad-hoc-ibss-network-and-if-possible-with-wpa-encry/94048#94048" target="_blank" rel="noopener">origin</a></p>
</li>
</ul>
</div>
</div>
</div>
</div>
</article>
</div>
</main>
</div>
<footer class="footer">
<p>This page was built using the Antora <a href="https://gitlab.com/antora/antora-ui-default" target="antora">default UI</a> </p>
</footer>
<script src="../../_/js/site.js"></script>
<script src="../../_/js/vendor/lunr.js"></script>
<script src="../../_/js/vendor/search.js" id="search-script" data-base-path="../.." data-page-path="/swarmlab_tech-list/docs/index-setup.html"></script>
<script async src="../../_/../search-index.js"></script>
<script async src="../../_/js/vendor/highlight.js"></script>
</body>
</html>