<p>Both expo laptops Crowley and Aziraphale use DHCP to get an IP4 address and the identity of a DNS nameserver. Neither laptop has any other configuration.
<p>The Gasthof WiFi - which you can use if you are close enough to the main building - is "StaudnGast" and has no WiFi password but there is a login webpage. It allocates IP addresses in the range <samp>192.168.2.x</samp> etc. The antenna is now on the first-floor balcony within sight of the tatty hut window. You can get the password from the Gasthof front desk, or during expo it is usally written on the whiteboard in the potato hut. In the scripts published in this handbook we use the word GASTSECRET instead of the real password.
<p>If you are not actively using the internet, the Gasthof system will close the connection after a few minutes and you will have to re-login again, typing the password into the login page.
<p>The potato hut wiFi has <ahref="https://www.howtogeek.com/334935/what-is-an-ssid-or-service-set-identifier/">SSID</a> "potatohut" with our usual cavey:beery password. Like almost every other wifi anywhere it is running DHCP and allocating IP addresses to your device.
<p>The DHCP system is issuing IP4 addresses of the form <samp>192.168.200.x</samp> or <samp>192.168.250.x</samp> where x is a number between 50 and 199
with a lifetime of 12 hours. (The Netgear router uses <samp>192.168.200.x</samp> and the tp-link WRT41N router iuses <samp>192.168.250.x</samp>.
In 2023 we are using the tp-link router.)
<p>The <em>Expo laptops</em> acquire a dynamic local address of this form,
as does any other laptop or phone connecting to this wifi. (Apart from Crowley, which has a reserved address of <samp>192.168.z.200</samp>.)
<p>The <ahref="https://en.wikipedia.org/wiki/Acer_Aspire_One">Acer Aspire One</a> netbook is running Debian Linux operating system
(<em>Buster</em> oldstable v10.13 in 2023)
with the lightweight <ahref="https://xfce.org/">[xfce]</a> window mananger. It runs a script once every 60s which checks whether it can access the internet. If it can't, it attempts a re-login to the Gasthof wifi system, which takes 5-10 seconds. If it still can't access the internet it deletes nearly all the configuration and reloads everything - which takes about 30s. The mere fact that it accesses the internet every minute is enough for the Gasthof system to keep the connection open - until it times out completely which it does after an hour or so.
<p>The <str>used</str> scripts on the netbook live in <var>/root/fakenet</var> so that the cron job (running as root) can access them and things work even if /home is not mounted. [This is not the usual Linux place to keep such things.] The cron file lives in the usual place in <var>/etc/cron/cron.d/fakenet</var>.
It has an <ahref="https://manualmachine.com/netgear/wndr4000/816208-user-manual/">online manual</a> but it needs no configuration at all during expo. Just turn it on at the beginning of expo and off again at the end.
<p>The webpage control panel (which you should never need or touch) is accessed by connecting a laptop to the wifi or using the <var>expo laptop</var> on the ethernet and bringing up a web browser to <ahref="http://192.168.200.1">http://192.168.200.1</a> with username 'admin' and the usual expo cavey:beery password. The password is also written on the underneath of the box.
<p>In 2023 we have an alternative wifi/router in Austria, a <ahref="https://www.expertreviews.co.uk/tp-link/1401766/tp-link-tl-wr841n-review">TL-WR841N</a> belonging to Wookey which is configured identically to the Netgear device except that the username is 'root' not 'admin'. It would be good to test this so we could give ARM their WNDR4000 back, and the TP-link router can become expo's.
<p>One important difference is that the ethernet cable from the netbook is plugged into the blue socket on the WR841N (it is yellow on the Netgear), and the 4 white sockets on the Netgear are 4 yellow sockets on the WR841N. A word of warning: the WR841N has been flashed with new firmware (openWRT) and so any documentation you may read in online manuals for it will be wrong: notably the reset and wifi on/off buttons don't have any effect, and the lights don't flash in the way the manuals say they do. There is also no USB socket, no 5Ghz, slower ethernet (100Mbps not 1Gbps) and the wifi range out to the tents is probably worse than the Netgear wifi.
<p>Note that this dual-antenna WiFi thing is a <em>high power</em> device: it won't work if plugged in via an unpowered USB hub. It is also fussy about which USB port it is plugged into on the netbook.
<p>While you can use 5Ghz wifi and IP6 to connect within the hut (if the Netgear router is being used),
there is no IP6 connectivity to the external internet. Sorry. We are dependent on the Gasthof system for this. Use a phone and data roaming if you want it.
We bridge the hut wifi with the hut ethernet cable to the <var>expo laptop</var> so they are both <samp>192.168.200.x</samp>, but this is a matter of choice. This is configured inside the wifi/router using the webpage control panel.
<p> DNS is what connects a computer name (such as <var>expo.survex.com</var>) with an internet address (such as <samp>78.129.164.125</samp>). To make the internet work, we need to tell every laptop and phone where to find a DNS nameserver, or what machine to ask in order to get DNS queries forwarded to a DNS nameserver.
<p>The DNS configuration happens in the netbook, using dnsmasq. The router just forwards DNS queries to the netbook, and tells laptops connected to the hut wifi to use that too.
<p>DHCP is what decides what the <samp>x</samp> is when the wifi issues an address that a laptop must use when it connects to the wifi as <samp>192.168.200.x</samp>.
<p>1. The benefit of doing it in the router box is that you get to play with a graphical web interface not text files. But also you can test that the router is working separately from everything else.
<p>2. The benefit of doing it in the netbook is that all the configuration is in the same place, and you only have to learn one way of doing things instead of having to use text files <em>and</em> a web interface. Also, by making the router completely dumb, it is swap-replaceable if it dies with no reconfiguration required.
<p>The DHCP is configured to issue IP addresses with <samp>x</samp> between 50 and 199, i.e. laptops and phones will get IP addresses between <samp>192.168.250.50</samp> and <samp>192.168.250.199</samp>. These may change after 12 hours.
<p>The router itself is <samp>192.168.250.1</samp>
<p>The netbook has two network interfaces: the Alfa wifi antenna (which is 'wlan1' and has an address 192.168.2.x issued by the Gasthof wifi system using DHCP)
plugged into a USB socket, and the netbook's ethernet cable socket (eth0) which is configured to have the address <samp>10.0.1.2</samp>.
<p>The netbook also has a defunct interface 'wlan0' which is the internal wifi which is broken and unused.
However it can cause configuration problems (notably for the first few days of expo 2023). These are the runes to type on the netbook to stop it interfering:
<pre><code>sudo ip addr add 10.0.42.1/24 dev wlan0
sudo ip addr del 10.0.1.1/24 dev wlan0</code></pre>
<p>The router has its WAN (yellow or blue ethernet cable socket) set to the address <samp>10.0.1.1</samp>. The four other ethernet sockets are all on the address range <samp>192.168.250.x</samp> and the wifi network interface is set to <samp>192.168.250.1</samp> also in the network <samp>192.168.250.x</samp>.
<p>So the ethernet cable between the router and the netbook is <samp>10.0.1.1</samp> at the router end and <samp>10.0.1.2</samp> at the netbook end. Nothing else uses any number like <samp>10.0.1.x</samp>.
<p>The next thing is to take a phone out to the road and try to connect directly to the Gasthof wifi. This is to check that the Gasthof is on the internet and that the problem is not between the Gasthof and the rest of the world.
<p>The netbook attempts a reconnection every 60 seconds, so wait at least 2 minutes before doing anything. That is because when the netbook attempts a full reconnection it can take nearly a minute to rebuild everything.
<p>Test whether the netbook is actually running and responding by sitting at the <var>expo laptop</var> and logging into the netbook remotely. Do this in a terminal window:
<p>If you get a login prompt, the netbook is running. It is a slow machine so do not expect this to be instant. (You are logged in as 'expo' on the expo laptop so it automatically logs you in as 'expo' on the netbook.)
<p>If you didn't get a prompt when you attempted to login from the <var>expo laptop</var> then you will need to do the same thing but actually on the netbook keyboard.
[This happens if the netbook has lost its routing config (which is set up by runfakenet) and so there is no communication between the netbook and the router.]
<p>While you are at it, it would be a good idea to re-boot the netbook first by typing this on the netbook keyboard first, and waiting for it to re-boot:
<p>If it keeps failing, then maybe the <var>cron</var> system which re-triggers it every 60s is not working. That is probably a symptom of something more much more serious wrong with the netbook if you have already re-booted it. Try re-booting it again and this time be more patient. <em>Report this</em> to a nerd, <em>write a record of the problem in the expo logbook</em> and <em><ahref="https://app.element.io/#/room/#LoserExpoWebsite:matrix.org">post a request for help</a></em> to the expo Matrix chat system.
<p>The master copy of the scripts in on the expo server in <var>/home/expo/config/netbook</var> which includes the files
<ul>
<li><ahref="netbookfakenet/readme">readme</a>
<li><ahref="netbookfakenet/fakenetcron">fakenetcron</a> - needs to be renamed and copied to <var>/etc/cron.d/fakenet</var>
<li><ahref="netbookfakenet/70-persistent-net.rules">70-persistent-net.rules</a> - needs to be copied into <var>/etc/udev/rules.d/</var>
<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 top-level <ahref="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>The central script is <ahref="netbookfakenet/fakenet2022/keepalive">/root/fakenet/keepalive</a> which is run every 60 seconds:
<pre><code>
#!/bin/sh
# Runs from cron
if ( ping -c 1 -w 5 -q wookware.org ); then
#working
:
else
#rerun login
/root/fakenet/expo/gasthoflogin
sleep 10
if ( ping -c 1 -w 5 -q wookware.org ); then
#working now
:
else
#re-setup full network config
/root/fakenet/runfakenet
fi
fi
</code></pre>
As you can see, it checks if the internet is available by looking for <var>wookware.org</var> and if not, it runs the Gasthof login script. If there is still no joy, it runs the full network reconfiguration script.
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>The network rebuild script is <ahref="netbookfakenet/fakenet2022/runfakenet">/root/fakenet/runfakenet</a> where ${base} is "/root/fakenet" and ${config} is "expo" as set in <ahref="netbookfakenet/fakenet2022/config">/root/fakenet/config</a>. (This config is a relic from the CSG script in 2014, see Historical Notes below.)
<p>The file that configures the wifi, but only when it is not managed by the router and its web control panel, is the file <var>/root/fakent/expo/hostapd.conf</var>
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.
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:
<p>The netconfig file referred to in <var>runfakenet</var> is <ahref="netbookfakenet/fakenet2022/expo/netconfig">/root/fakenet/expo/netconfig</a>.<br/>
The <ahref="https://manpages.debian.org/bullseye/ifupdown/interfaces.5.en.html">interfaces(5)</a> man pages are online. <br/>
The <ahref="https://wiki.debian.org/WiFi/HowToUse">debian Wifi Interface</a> documentation is online. <br/>
The <ahref="https://github.com/ystk/debian-wpasupplicant/blob/master/debian/README.Debian">debian wpasupplicant MODES</a> documentation is online. <br/>See also <ahref="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 <ahref="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.
<p>There is also a historical relic <ahref="netbookfakenet/fakenet2022/keepaliveharder">/root/fakenet/keepaliveharder</a> which is no longer needed as it has been subsumed within <var>keepalive</var>.
<p>There is a utility script which perhaps may be useful when configuring the network
<ahref="netbookfakenet/fakenet2022/stopfakenet">/root/fakenet/stopfakenet</a> which stops everything:
(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.
<p> Note that "Wicd is not available in Debian 11/Bullseye or newer" - <ahref="https://wiki.debian.org/WiFi/HowToUse">debian Wifi Interface</a> documentation.
<p>In 2017 we arrived on expo to discover that our hard-drive in the hut had died (taking the music collection with it) which triggered the general reconfiguration to connect the tattyhut to
the internet continuously and not to have our own local server. This coincided with a much-improved WiFi service at
the Gasthof. We continued with the wifi service in the hut but now it also connects to the external internet instead of to a 'pretend' internet (which is why the system is called 'fakenet').
<p>In 2018 and 2019 we had good Internet access at basecamp, but the high-gain system (old Alfa) was returned to its owner (Sam) during Covid (2020-21). Wookey bought a new one, which proved to not live up to its advertising.
<p>In 2022 Wifi reception from the Gasthof was very poor. The connection script was improved so that dropped connections were restored more quickly. However the basic bandwidth with the new cheap antenna was not enough.
<p>The structure of the system was created by Wookey in 2013 who used the fakenet principle and the netbook to run training sessions in caving huts with no internet connection for the Cave Survey Group in the UK. [This is why the script has an extra level of parameter setting that might seem unnecessary: it has 'csg' and 'expo' options, but the two configurations have diverged so much over the years that this is merely a fossil.]
<p>The part of the script that logs into the Gasthof wifi was written by Mark Shinwell in 2017 and re-edited by Sam Wenham in 2019. Wookey made it more robust on expo in 2022.