zeus
3 years ago
2 changed files with 122 additions and 281 deletions
@ -1 +1,2 @@ |
|||||
* xref:index.adoc[list] |
* xref:index.adoc[list] |
||||
|
* xref:index-setup.adoc[examples] |
||||
|
@ -1,354 +1,194 @@ |
|||||
= Setup |
= examples |
||||
|
|
||||
TIP: Tested on a Raspberry Pi with "Buster" |
|
||||
|
|
||||
== Intro |
== Bold, italics and underlining |
||||
|
|
||||
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. |
set of examples |
||||
|
|
||||
There are mainly three setups to have a peer to peer network: |
[source,latex] |
||||
|
|
||||
* 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 |
The following example collects the various code fragments contained in this article so that you can open them all together in Overleaf. |
||||
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 |
|
||||
---- |
|
||||
|
|
||||
|
|
||||
== Install optional |
First example, bold, italics and underline: |
||||
|
|
||||
[source,sh] |
Some of the \textbf{greatest} discoveries in \underline{science} were made by \textbf{\emph{accident}}. |
||||
---- |
|
||||
apt-get install raspberrypi-kernel-headers -y |
|
||||
---- |
|
||||
|
|
||||
|
\vspace{1.5cm} |
||||
|
|
||||
|
Example of italicized text: |
||||
|
|
||||
=== setup wired connection |
Some of the greatest discoveries in science were made by \emph{accident}. |
||||
|
|
||||
*wired connection* |
\vspace{1.5cm} |
||||
[source,sh] |
|
||||
---- |
|
||||
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 |
|
||||
Address=192.168.1.18/24 // <1> |
|
||||
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 |
|
||||
|
|
||||
|
Example of boldface text: |
||||
|
|
||||
=== Reboot |
Some of the \textbf{greatest} discoveries in science were made by accident. |
||||
|
|
||||
NOTE: reboot |
\vspace{1.5cm} |
||||
|
|
||||
== Config |
Example of underlined text: |
||||
|
|
||||
|
Some of the greatest discoveries in \underline{science} were made by accident. |
||||
|
|
||||
=== NSS |
\vspace{1.5cm} |
||||
|
|
||||
*config nss* |
Example of emphasized text in different contexts: |
||||
[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 "" |
|
||||
---- |
|
||||
|
|
||||
|
Some of the greatest \emph{discoveries} in science were made by accident. |
||||
|
|
||||
=== DNS |
\textit{Some of the greatest \emph{discoveries} in science were made by accident.} |
||||
|
|
||||
|
\textbf{Some of the greatest \emph{discoveries} in science were made by accident.} |
||||
|
|
||||
*config dns* |
|
||||
[source,sh] |
|
||||
---- |
---- |
||||
|
|
||||
echo "" |
== Font sizes, families, and styles |
||||
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" |
set of examples |
||||
|
[source,latex] |
||||
|
|
||||
resolvectl status |
|
||||
---- |
---- |
||||
|
\documentclass{article} |
||||
|
\begin{document} |
||||
|
%Example of different font sizes and types |
||||
|
This is a simple example, {\tiny this will show different font sizes} and also \textsc{different font styles}. |
||||
|
|
||||
== unprotected ad-hoc interface using wpa_supplicant |
\vspace{1cm} |
||||
|
|
||||
Follow *Install systemd-networkd* |
|
||||
|
|
||||
Then come back here. |
%Example of different font sizes and types |
||||
|
In this example the {\huge huge font size} is set and the {\footnotesize Foot note size also}. There's a fairly large set of font sizes. |
||||
|
|
||||
TIP: unprotected |
\vspace{1cm} |
||||
|
|
||||
* *sudo su* # if not already done |
%Example of different font sizes and types |
||||
|
In this example, a command and a switch are used. \texttt{A command is used to change the style of a sentence}. |
||||
|
|
||||
[source,sh] |
\sffamily |
||||
---- |
A switch changes the style from this point to the end of the document unless another switch is used. |
||||
|
\rmfamily |
||||
|
|
||||
cat > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf <<EOF |
\vspace{1cm} |
||||
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 |
%Example of different font sizes and types |
||||
systemctl enable wpa_supplicant@wlan0.service |
Part of this text is written \textsl{in different font style} to highlight it. |
||||
|
\end{document} |
||||
|
---- |
||||
|
|
||||
echo "" |
== Font typefaces |
||||
echo "enabled4you" |
|
||||
echo "systemctl enable wpa_supplicant@wlan0.service" |
|
||||
echo "" |
|
||||
|
|
||||
|
set of examples |
||||
|
[source,latex] |
||||
---- |
---- |
||||
|
\documentclass{article} |
||||
|
\usepackage[T1]{fontenc} |
||||
|
\usepackage{tgbonum} |
||||
|
|
||||
|
\begin{document} |
||||
|
This document is a sample document to |
||||
|
test font families and font typefaces. |
||||
|
|
||||
=== Reboot |
{\fontfamily{qcr}\selectfont |
||||
|
This text uses a different font typeface |
||||
|
} |
||||
|
\end{document} |
||||
|
---- |
||||
|
|
||||
NOTE: Reboot |
|
||||
|
|
||||
=== Check |
== Paragraph formatting |
||||
|
|
||||
[source,sh] |
set of examples |
||||
|
[source,latex] |
||||
---- |
---- |
||||
|
\documentclass{article} |
||||
|
\usepackage[utf8]{inputenc} |
||||
|
\usepackage[english]{babel} |
||||
|
|
||||
echo "" |
\setlength{\parindent}{4em} |
||||
echo "Check with:" |
\setlength{\parskip}{1em} |
||||
echo "" |
\renewcommand{\baselinestretch}{2.0} |
||||
|
|
||||
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 "" |
|
||||
---- |
|
||||
|
|
||||
== protected ad-hoc interface using wpa_supplicant |
\begin{document} |
||||
|
This is the first paragraph, contains some text to test the paragraph |
||||
|
interlining, paragraph indentation and some other features. Also, is |
||||
|
easy to see how new paragraphs are defined by simply entering a double |
||||
|
blank space. |
||||
|
|
||||
CAUTION: 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: |
Hello, here is some text without a meaning. This text should |
||||
|
show what a printed text will look like at this... |
||||
|
|
||||
|
|
||||
Follow *Install systemd-networkd* |
|
||||
|
|
||||
Then come back here. |
\end{document} |
||||
|
|
||||
*check* |
|
||||
[source,sh] |
|
||||
---- |
|
||||
iw list | grep -P "Wiphy|RSN-IBSS" |
|
||||
---- |
|
||||
|
|
||||
*output* |
|
||||
[source,sh] |
|
||||
---- |
|
||||
Wiphy phy1 |
|
||||
Device supports RSN-IBSS. |
|
||||
Wiphy phy0 |
|
||||
---- |
---- |
||||
|
|
||||
You cannot find this support entry for Wiphy pyh0 that is the on-board WiFi device. |
|
||||
|
|
||||
=== Install driver |
|
||||
|
|
||||
TIP: Example TP-Link |
== Line breaks and blank spaces |
||||
|
|
||||
[source,sh] |
set of examples |
||||
|
[source,latex] |
||||
---- |
---- |
||||
echo "lsusb" |
\begin{document} |
||||
|
Something in this document. This paragraph contains no information and |
||||
echo "" |
its purposes is to provide an example on how to insert white spaces |
||||
echo "Example for TP-Link" |
and lines breaks.\\ |
||||
echo "" |
When a line break is inserted, the text is not indented, there are a |
||||
echo "Bus 001 Device 005: ID 2357:0109 TP-Link TL WN823N RTL8192EU" |
couple of extra commands do line breaks. \newline |
||||
echo "" |
This paragraph provides no information whatsoever. We are exploring |
||||
sudo wget http://downloads.fars-robotics.net/wifi-drivers/install-wifi -O /usr/bin/install-wifi |
line breaks. \hfill \break |
||||
sudo chmod +x /usr/bin/install-wifi |
And combining two commands |
||||
|
... |
||||
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." |
|
||||
---- |
|
||||
|
|
||||
|
|
||||
NOTE: *On message: * |
|
||||
|
|
||||
==== |
\begin{figure} |
||||
|
\centering |
||||
[source,sh] |
\includegraphics[width=3cm]{overleaf-logo} |
||||
---- |
\caption{Overleaf logo} |
||||
Your Pi revision number is a02082 |
\end{figure} |
||||
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. |
|
||||
---- |
---- |
||||
|
|
||||
* Find source for driver e.g. |
== Text alignment |
||||
|
|
||||
[source,sh] |
set of examples |
||||
---- |
[source,latex] |
||||
git clone https://github.com/lwfinger/rtl8188eu.git |
|
||||
cd rtl8188eu |
|
||||
make all |
|
||||
sudo make install |
|
||||
sudo depmod |
|
||||
sudo modprobe 8188eu |
|
||||
lsmod 8188eu |
|
||||
---- |
---- |
||||
|
\begin{document} |
||||
|
\setlength{\hsize}{0.9\hsize}% emphasize effects |
||||
|
|
||||
|
\subsection*{Left-aligned example with |
||||
|
\texttt{\string\raggedright}\\ (standard \LaTeX{} command)} |
||||
|
\raggedright\blindtext[2]\par |
||||
|
|
||||
|
\subsection*{Left-aligned example with \texttt{\string\RaggedRight}\\ (\texttt{ragged2e} command)} |
||||
|
\RaggedRight\blindtext[2]\par |
||||
|
\end{document} |
||||
|
---- |
||||
|
|
||||
==== |
== Multiple columns |
||||
|
|
||||
|
|
||||
|
|
||||
=== setup |
|
||||
|
|
||||
[source,sh] |
set of examples |
||||
|
[source,latex] |
||||
---- |
---- |
||||
sudo systemctl disable --now wpa_supplicant@wlan0.service |
\begin{document} |
||||
|
\maketitle |
||||
echo "sudo -Es # if not already done" |
|
||||
echo "" |
|
||||
cat > /etc/wpa_supplicant/wpa_supplicant-wlan1.conf <<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 |
\begin{multicols}{3} |
||||
systemctl enable wpa_supplicant@wlan1.service |
[ |
||||
|
\section{First Section} |
||||
|
All human things are subject to decay. And when fate summons, Monarchs must obey. |
||||
|
] |
||||
|
\blindtext\blindtext |
||||
|
\end{multicols} |
||||
---- |
---- |
||||
|
|
||||
=== Reboot |
== fonts |
||||
|
|
||||
NOTE: reboot |
|
||||
|
|
||||
[source,sh] |
https://fonts.google.com/[fonts^] |
||||
---- |
|
||||
echo "" |
|
||||
echo "reboot." |
|
||||
echo "" |
|
||||
---- |
|
||||
|
|
||||
=== Check |
|
||||
|
|
||||
[source,sh] |
set of examples |
||||
|
[source,latex] |
||||
---- |
---- |
||||
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 "" |
|
||||
---- |
---- |
||||
|
|
||||
|
|
||||
|
https://www.overleaf.com/learn/latex/XeLaTeX#Further_reading[origin^] |
||||
* https://raspberrypi.stackexchange.com/questions/94047/how-to-setup-an-unprotected-ad-hoc-ibss-network-and-if-possible-with-wpa-encry/94048#94048[origin^] |
|
||||
|
|
||||
|
|
||||
|
Loading…
Reference in new issue