more netconfig docs

This commit is contained in:
Philip Sargent 2023-04-05 19:47:20 +01:00
parent cb54ee923b
commit 17bc3aae01
2 changed files with 95 additions and 20 deletions

View File

@ -20,7 +20,7 @@ iface eth0 inet static
#allow-hotplug wlan0
#iface wlan0 inet dhcp
# wpa-ssid potatohut
# wpa-psk 161:gosser
# wpa-psk CAVEYBEERYPASSWORD
# Alfa wifi widget to the Gasthof
# See /usr/share/doc/wpasupplicant/README.modes.gz for config
@ -30,7 +30,7 @@ iface wlan1 inet dhcp
#wook testing config
# wpa-ssid SKYFA4B8
# wpa-psk LBTCCYRMRF
# wpa-psk WOOKSPECIALPASSWORD
#bridge interface between ethernet (router) and wlan (gasthof)

View File

@ -144,7 +144,7 @@ reconnect' checkbox for the "StaudnGast" network.
<li>fakenet2022.tgz - needs to be unpacked into <var>/root</var>
</ul>
<p>The files linked in this documentation are sanitized copies, not the master files. Get the master files by ftp or scp from <var>expo.survex.com/home/expo/config/netbook</var>.
<p>Installation instructions are in the <a href="netbookfakenet/readme">readme</a> file. These are all documented below, but do get an updated copy from <var>expo.survex.com/home/expo/config/netbook</var> before you do anything.
<p>Installation instructions are in the top-level <a href="netbookfakenet/readme">readme</a> file. These are all documented below, but do get an updated copy from <var>expo.survex.com/home/expo/config/netbook</var> before you do anything.
@ -194,7 +194,7 @@ rmdir $tmp
</code></pre>
As you can see, it attempts to get http://wookware.org/index.html but actually gets the gasthof login form, which it then POSTs to with the Gasthof password - which is not actually GASTSECRET. Get this year's Gasthof password from the reception desk and write it on the whiteboard in the hut.
<p>Network rebuild script <a href="netbookfakenet/fakenet2022/runfakenet">/root/fakenet/runfakenet</a> where ${base} is "/root/fakenet" and ${config} is "expo" as set in <a href="netbookfakenet/fakenet2022/config">/root/fakenet/config</a>. (This config is a relic from the CSG script in 2014, see Historical Notes below.)
<p>The network rebuild script is <a href="netbookfakenet/fakenet2022/runfakenet">/root/fakenet/runfakenet</a> where ${base} is "/root/fakenet" and ${config} is "expo" as set in <a href="netbookfakenet/fakenet2022/config">/root/fakenet/config</a>. (This config is a relic from the CSG script in 2014, see Historical Notes below.)
<pre><code>#!/bin/sh -eux
. /root/fakenet/config
@ -232,12 +232,10 @@ ${base}/${config}/gasthoflogin
# Join Acer to potatohut network for admin purposes
#sudo ifup -i ${base}/${config}/netconfig wlan0
</code></pre>
<h4>Other vital configuration bits</h4>
<p>The <var>/root/fakenet/expo/hosts</var> file is just two lines:
<pre><code>10.0.1.2 tclapsire3
10.0.1.1 router
</code></pre>
<p>The file that configures the wifi is the file <var>/root/fakent/expo/hostapd.conf</var>
<p>The file that configures the wifi, if it is not managed by the Netgear box and its web control panel, is the file <var>/root/fakent/expo/hostapd.conf</var>
<pre><code>interface=wlan0
driver=nl80211
ssid=tattyhut
@ -255,10 +253,9 @@ rsn_pairwise=CCMP
where CAVEYBEERYPASSWORD is our usual expo password. In 2022 this capability was configured by the Netgear control panel, not by this file on the netbook.
<p>The file that configures the DNS and DHCP is <var>/root/fakent/expo/dnamasq.conf</var> and it is very long with
most of the lines commented out with an initial '#', so they are not all listed here. (You can read a copy of it <a
href="copy-of-dnsmasq.conf">here</a>). On the netbook 'eth0' is the interface with the antenna (which is actually a
USB socket) and 'wlan0' is the ethernet socket interface to the cable to the Netgear box. Some of the more relevant
lines are:
most of the lines commented out with an initial '#', so they are not all listed here. (You can read a copy of it: <a
href="netbookfakenet/fakenet2022/expo/dnsmasq.conf">/root/fakenet/expo/dnsmasq.conf</a> ). On the netbook 'eth0' is
the interface with the antenna (which is actually a USB socket) and 'wlan0' is the netbook's ethernet socket interface to the cable going to the Netgear box. Some of the more relevant lines are:
<pre><code>interface=wlan0
dhcp-range=192.168.1.10,192.168.1.199,12h
addn-hosts=/root/fakenet/expo/hosts
@ -266,23 +263,101 @@ expand-hosts
domain=potato.hut
no-dhcp-interface=eth0
</code></pre>
Note the line <var>addn-hosts=/root/fakenet/expo/hosts</var> which refers to the first file listed above which defines the names of the machines for the two ends of the cable between the netbook and the Netgear box.
<p>The netconfig file referred to in <var>runfakenet</var> is <a href="netbookfakenet/fakenet2022/expo/netconfig">/root/fakenet/expo/netconfig</a>.<br />
The <a href="https://manpages.debian.org/bullseye/ifupdown/interfaces.5.en.html">interfaces(5)</a> man pages are online. <br />
The <a href="https://wiki.debian.org/WiFi/HowToUse">debian Wifi Interface</a> documentation is online. <br />
The <a href="https://github.com/ystk/debian-wpasupplicant/blob/master/debian/README.Debian">debian wpasupplicant MODES</a> documentation is online. <br />See also <a href="https://manpages.debian.org/buster/wpasupplicant/wpa_supplicant.8.en.html">WPA_SUPPLICANT(8)</a>
<p>
The operative lines of the <var>netconfig</var> file are:</p>
<pre><code># This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
# connection to router
allow-hotplug eth0
iface eth0 inet static
address 10.0.1.2
netmask 255.255.255.0
dns-nameservers 10.0.1.2
# Alfa wifi widget to the Gasthof
# See /usr/share/doc/wpasupplicant/README.modes.gz for config
allow-hotplug wlan1
iface wlan1 inet dhcp
wireless-essid StaudnGast
# Access to the Acer netbook from the potatohut WiFi network
# auto wlan0
#allow-hotplug wlan0
#iface wlan0 inet dhcp
# wpa-ssid potatohut
# wpa-psk CAVEYBEERYPASSWORD
#bridge interface between ethernet (router) and wlan (gasthof)
#not used 2022 (wireless to eth bridgr not allowed?)
#auto br0
#iface br0 inet static
#bridge_ports wlan1 eth0
# address 10.0.1.3
# netmask 255.255.255.0
</code></pre>
<p>The masquerade file referred to in <var>runfakenet</var> is <a href="netbookfakenet/fakenet2022/expo/masquerade">/root/fakenet/expo/masquerade</a>
and the operative lines are</p>
<pre><code>#!/bin/sh -eux
sudo sysctl net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
</code></pre>
Note the line <var>addn-hosts=/root/fakenet/expo/hosts</var> which refers to the first file listed above which defines the names of the machines for the two ends of the cable between the netbook and the Netgear box. This <var>/root/fakenet/expo/hosts</var> file is just two lines. The name of the Netgear box is 'router' even though all routing is actually done by the netbook.
<pre><code>10.0.1.2 tclapsire3
10.0.1.1 router
</code></pre>
<p>The cron job file that configures <var>crontab</var> to run the fakenet script every 60 seconds is
<a href="netbookfakenet/70-persistent-net.rules">70-persistent-net.rules</a>. It is a single line of cron configuraiton:
<a href="netbookfakenet/70-persistent-net.rules">70-persistent-net.rules</a>. It is a single line of cron configuration:
<pre><code>*/1 * * * * root [ -x /root/fakenet/keepalive ] && /root/fakenet/keepalive
</code></pre>
where the initial <samp>*/1 * * * *</samp> means that it runs once a minute, on every hour, day, month and year.
<p> The init script which configures everything when the netbook is booted up is
<pre><code>MISSING
MISSING - need to get this...
</code></pre>
<p>There is also a historical relic <a href="netbookfakenet/fakenet2022/keepaliveharder">/root/fakenet/keepaliveharder</a> which is no longer needed as it has been subsumed within <var>keepalive</var>.
<h2>Buggeration - how it will all go wrong..</h2>
<p>There is a utility script which perhaps may be useful when configuring the network
<a href="netbookfakenet/fakenet2022/stopfakenet">/root/fakenet/stopfakenet</a> which stops everything:
<pre><code>#!/bin/sh
. ./config
sudo ifdown -i ${base}/${config}/netconfig eth0
sudo ifdown -i ${base}/${config}/netconfig wlan0
sudo ifdown -i ${base}/${config}/netconfig wlan1
sudo killall dnsmasq
sudo killall svnserve
#sudo service hostapd stop
sudo service wicd start
</code></pre>
(No, I don't know why killing hostpad is commented out.)
<p> There is no init script which automatically configures everything when the netbook is booted up. The cron job running once a minute will restart everything after a minute or two.
<h2 id="buggeration">Buggeration - how it will all go wrong..</h2>
<p>We are using an old way of configuring network interfaces in debian. Which will all break at some point when
someone does a debian upgrade. The scripts use the <a href="https://wiki.debian.org/NetworkInterfaceNames">
"Predicatable Names" scheme</a> and <a href="https://wiki.debian.org/iptables">iptables</a> which are both earmarked for destruction.
<p> Note that "Wicd is not available in Debian 11/Bullseye or newer" - <a href="https://wiki.debian.org/WiFi/HowToUse">debian Wifi Interface</a> documentation.
<p>This is intentional. As Wookey wrote in
<a href="netbookfakenet/fakenet2022/README-expo">/root/fakenet/README-expo</a>:<br />
<em>"It's quite low-level and old-fashioned so one can understand it :-)"</em>
<p>So all this will need reimplementing for expo 2024.
<h2>Historical Notes</h2>