network config

This commit is contained in:
Philip Sargent 2023-03-27 00:51:28 +01:00 committed by Wookey
parent 5233b0e797
commit cf3b6c23e7
3 changed files with 66 additions and 33 deletions

View File

@ -26,39 +26,59 @@ still upright and have not been knocked sideways.
</figure>
<h2>ALL BEING RE-WRITTEN MARCH 2023</h2>
<h3>Expo laptops</h3>
<p>Both expo laptops Clowley and Aziraphale use DHCP over wifi to get an IP4 address and the identity of a DNS nameserver. Neither laptop has any other configuration.
<p>If you connect your laptop or phone to the Potato hut wifi you will connect in the same way.
<h3>The Gasthof Wifi</h3>
<p>The Gasthof WiFi - which you can use if you are close enough - is "StaudnGast" and has no WiFi password but there is a login webpage. It allocates IP addresses in the range 192.168.2.x 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 and you will have to re-login again, typing the password into the login page.
<h3>The Potato hut Wifi</h3>
<p>The potato hut WiFi has <a href="https://www.howtogeek.com/334935/what-is-an-ssid-or-service-set-identifier/">SSID</a> "tattyhut" 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 192.168.1.x where x is a number between 11 and 199 with a lifetime of 48 hours.
<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.
<h3>How it works - in words</h3>
<p>The <a href="https://en.wikipedia.org/wiki/Acer_Aspire_One">Acer Aspire One</a> netbook is running Debian Linux operating system with the lightweight <a href="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.
<p>Because of a permissions difficulty, the scripts on the netbook live in <var>/root/fakenet</var> so that the cron job (running as root) can access them. [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>.
<p>When the netbook powers up, the script <var>/etc/init.d/fakenet</var> runs which sets everything going for the first time.
<h4>wicd</h4>
<p>The netbook needs to have its persistent networking set up correctly <i>in addition to the other scripts</i>. This
is the <a href="https://launchpad.net/wicd">wicd</a> gui program that has an icon in the top-right of the sceen in the
system panel. (Or search in all applications in the Internet section for the wicd application). Set the checkboxes so
that the netbook does not connect to any network except the StaudnGast wifi network, and also tick the 'automatically
reconnect' checkbox for the "StaudnGast" network.
<h4>Netgear WNDR4000</h4>
<p>The Netgear ethernet/wifi hub holds the radio transceievr that provides the wifi coverage inside the potato hut.
It is configured using its web control panel.
<hr />
<strike>
<p>The potato hut WiFi is running DHCP and allocating IP addresses of the form 192.168.1.x where x is a number between 11 and 99 .
<p>The <em>Expo laptops</em> have a dynamic local address of this form, as does any other laptop connecting to this WiFi.
<p>The Gasthof WiFi - which you can still use - is "StaudnGast" and has no WiFi password but there is a login webpage. It allocates IP addresses in the range
192.168.2.x etc. The antenna is now on the first-floor balcony within
sight of the tatty hut window.
<p>The Acer Aspire One ("tclaspire3") is on a static address <a href="http://192.168.1.100/">192.168.1.100</a> on WiFi but <a href="http://192.168.200.100/">192.168.200.100</a> on the ethernet cable.
This is the address to use for configuring it using ssh when everything else has failed. So to manage the
connection to the Gasthof WiFi you would use
<pre>
ssh expo@192.168.200.100
</pre>
to run Mark Shinwell's script (re-edited by Sam 2019)
<pre>/root/fakenet/runfakenet
</pre>
This used to need running once or twice a day when the internet stops working, but it was radically fettled in 2022 and so should be much more reliable.
Sometimes you may have to walk over to the blue Acer Aspire netbook and run this script directly by typing on its keyboard
as the network has collapsed so badly that <span style="font-family:monospace">ssh</span> doesn't work.
<p>The netbook needs to have its persistent networking set up correctly <i>in addition to the script</i>. This is the
<b>wicd</b> gui program that has an icon in the top-right of the sceen in the system panel. (Or search in all applications in the Internet section
for the wicd application). Set the checkboxes so that the netbook does connect to any network except the Staudingast wifi network,
and also tick the 'automatica;lly reconnect' checkbox for the "StaudnGast" network.
</strike>
<h3>Historical Notes</h3>
<p>Prior to 2018 we used to run an unconnected local network with our own DNS domain
<p>Prior to 2017 we used to run an unconnected local network with our own DNS domain
name "potato.hut", our own server holding all the website and survey data, and published WiFi as SSID "tattyhut".
Updates to the rest of the world were done by taking an up-to-date laptop which had been in
the tatty hut to a real internet connection and
@ -66,16 +86,19 @@ pushing the changes to the distributed version control system on
<span style="font-family:monospace">expo.survex.com</span> to be merged.
</p>
<p>In 2017 the hard-drive on our server died 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.
<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 was returned to its owner during Covid.
<p>In 2022 Wifi reception from the gasthaus was very poor. The connection script was improved so that dropped connections were restored more quickly. However the basic bandwidth with a cheap antenna was not enough.
<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 a cheap antenna was not enough.
<p>In 2023 a new Wifi device (the Alfa) should restore decent connectivity. We hope this will improve everything to how it was in 2019. However this Alfa has proved to be a right bastard to find the right drivers for. Wookey has had to be inventive in using an Ubuntu PPA to make it work with the Acer Aspire 1.
<p>Also during winter 2023/23 Wookey upgraded the operating system on the Acer Aspire 1 netbook from whatever Linpus dubious system it had been running to a decent Debian distribution. This required much coaxing. As of 26 March, it is still a couple of Debian versions behind where we would want it to be.
<p>Also during winter 2023/23 Wookey upgraded the operating system on the Acer Aspire 1 netbook from whatever Linpus ancient Debian it had been running to a decently almost-modern Debian distribution. This required much coaxing. As of 26 March, it is still a couple of Debian versions behind where we would want it to be.
<h4>History of the scripts</h4>
<p>The structure of the system was created by Wookey in 2013 who used the fakenet principle and the netbook to run training sessions for the Cave Survey Group in the UK. [This is why the script has an extra level of parameter setting that might seem necessary: 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.
<hr />
Go back to: <a href="computer.html">Basecamp computers</a><br />

View File

@ -30,12 +30,12 @@
<h3>Note there are FOUR (4) <em>different</em> power supply bricks</h3>
<ol>
<li>Powerbrick for Dell E4200 Crowley
<li>Powerbrick for Acer Aspire 1 tclaspire3
<li>Powerbrick for R61 Thinkpad Aziraphale
<li>Powerbrick for Dell E4200 (Crowley)
<li>Powerbrick for Acer Aspire One (tclaspire3)
<li>Powerbrick for R61 Thinkpad (Aziraphale)
<li>Powerbrick for <a href="../i/wndr4000.jpg">Netgear WNDR4000</a> wifi/ethernet device
</ol>
<p>The Acer Aspire 1 (tclaspire3) and Dell E4200 (Crowley) each have internal, built-in wifi, but we do not use these and they are turned off (with a physical sliding-switch on the case) to reduce confusion.
<p>The Acer Aspire One 1 (tclaspire3) and Dell E4200 (Crowley) each have internal, built-in wifi, but we do not use these and they are turned off (with a physical sliding-switch on the case) to reduce confusion.
<p>Aziraphale also has an ethernet socket and can be connected by ethernet cable to the network if convenient and if within-hut wifi is congested.
<p>The mains power plugs are illustrated with 2 pins for clarity, but they are all 3-pin UK-style pugs in reality.
@ -46,7 +46,7 @@
</figure>
</div>
<ul>
<li>The ethernet cable to the Asus Aspire 1 blue netbook (tclaspire3) goes into the yellow ethernet socket on its own.
<li>The ethernet cable to the Asus Aspire One 1 blue netbook (tclAspire One3) goes into the yellow ethernet socket on its own.
<li>The cable to the expo laptop Crowley (and to Aziraphale and the printer if you want) go into any of the block of 4 ethernet sockets in a row together.
<li>We do not plug anything into the USB socket.
</ul>

View File

@ -10,14 +10,7 @@
<h1>Handbook Troggle - Automated Testing</h1>
<h2>Troggle Automated Testing</h2>
<p>We have a suite of more than 100 <a href="https://en.wikipedia.org/wiki/Smoke_testing_(software)">smoke tests</a>
which are run manually by troggle programmers like this:
<pre><code> troggle$ python3 manage.py test --parallel auto -v 1</code></pre>
or, if someone has made a mistake and the tests interfere with each other:
<pre><code> troggle$ python manage.py test -v 1</code></pre>
<p>Running the tests in parallel works on the server too (without the 'auto' keyword on Django 3.2 though).
<p>We have a suite of more than 100 <a href="https://en.wikipedia.org/wiki/Smoke_testing_(software)">smoke tests</a>.
<p>These are 'end to end' tests which very quickly show whether something is badly broken. The tests are for two purposes only:
<ul>
@ -29,6 +22,23 @@ which allow us to home in on the precise part of the code which has been broken
<p>We do also have a handful of unit tests which just poke data into the database and check that it can be read out again.
<p>
The test code is all in <a href="http://expo.survex.com/repositories/troggle/.git/tree/core/TESTS/"><var>troggle/core/TESTS/</var></a>.
<h4>Running the tests</h4>
The tests are run manually by troggle programmers like this:
<pre><code> troggle$ python3 manage.py test --parallel auto -v 1</code></pre>
or, if someone has made a mistake and the tests interfere with each other:
<pre><code> troggle$ python manage.py test -v 1</code></pre>
<p>Running the tests in parallel should work on the server too (without the 'auto' keyword on Django 3.2 though)
but they fail with the message
<pre>
(1044, "Access denied for user 'expo'@'localhost' to database 'test_troggle_1'")
</pre>
<p> On the server, running them sequentially (not parallel) is still quite quick:
<pre>
Ran 104 tests in 21.944s
</pre>
<h4>Example test</h4>
<p>The test 'test_page_expofile' checks that a particular PDF is being served correctly by the web server
and that the resulting page is the correct length of 2,299,270 bytes: