From 17bc3aae01fec76c1050d3ea5399bdd92d8783c8 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Wed, 5 Apr 2023 19:47:20 +0100 Subject: [PATCH] more netconfig docs --- .../netbookfakenet/fakenet2022/expo/netconfig | 4 +- handbook/computing/netconfig.html | 111 +++++++++++++++--- 2 files changed, 95 insertions(+), 20 deletions(-) diff --git a/handbook/computing/netbookfakenet/fakenet2022/expo/netconfig b/handbook/computing/netbookfakenet/fakenet2022/expo/netconfig index dce8eee1d..24ddb3a3c 100644 --- a/handbook/computing/netbookfakenet/fakenet2022/expo/netconfig +++ b/handbook/computing/netbookfakenet/fakenet2022/expo/netconfig @@ -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) diff --git a/handbook/computing/netconfig.html b/handbook/computing/netconfig.html index ea6414a05..b272d5b6e 100644 --- a/handbook/computing/netconfig.html +++ b/handbook/computing/netconfig.html @@ -144,7 +144,7 @@ reconnect' checkbox for the "StaudnGast" network.
  • fakenet2022.tgz - needs to be unpacked into /root

    The files linked in this documentation are sanitized copies, not the master files. Get the master files by ftp or scp from expo.survex.com/home/expo/config/netbook. -

    Installation instructions are in the readme file. These are all documented below, but do get an updated copy from expo.survex.com/home/expo/config/netbook before you do anything. +

    Installation instructions are in the top-level readme file. These are all documented below, but do get an updated copy from expo.survex.com/home/expo/config/netbook before you do anything. @@ -194,7 +194,7 @@ rmdir $tmp 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. -

    Network rebuild script /root/fakenet/runfakenet where ${base} is "/root/fakenet" and ${config} is "expo" as set in /root/fakenet/config. (This config is a relic from the CSG script in 2014, see Historical Notes below.) +

    The network rebuild script is /root/fakenet/runfakenet where ${base} is "/root/fakenet" and ${config} is "expo" as set in /root/fakenet/config. (This config is a relic from the CSG script in 2014, see Historical Notes below.)

    #!/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
     
    +

    Other vital configuration bits

    -

    The /root/fakenet/expo/hosts file is just two lines: -

    10.0.1.2 tclapsire3
    -10.0.1.1 router
    -
    -

    The file that configures the wifi is the file /root/fakent/expo/hostapd.conf + +

    The file that configures the wifi, if it is not managed by the Netgear box and its web control panel, is the file /root/fakent/expo/hostapd.conf

    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.
     
     

    The file that configures the DNS and DHCP is /root/fakent/expo/dnamasq.conf 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 here). 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: /root/fakenet/expo/dnsmasq.conf ). 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:

    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
     
    -Note the line addn-hosts=/root/fakenet/expo/hosts 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. + +

    The netconfig file referred to in runfakenet is /root/fakenet/expo/netconfig.
    +The interfaces(5) man pages are online.
    +The debian Wifi Interface documentation is online.
    +The debian wpasupplicant MODES documentation is online.
    See also WPA_SUPPLICANT(8) +

    +The operative lines of the netconfig file are:

    +
    # 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  
    +
    +

    The masquerade file referred to in runfakenet is /root/fakenet/expo/masquerade + +and the operative lines are

    +
    #!/bin/sh -eux
    +sudo sysctl net.ipv4.ip_forward=1
    +sudo iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE  
    +
    + +Note the line addn-hosts=/root/fakenet/expo/hosts 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 /root/fakenet/expo/hosts file is just two lines. The name of the Netgear box is 'router' even though all routing is actually done by the netbook. +
    10.0.1.2 tclapsire3
    +10.0.1.1 router
    +
    +

    The cron job file that configures crontab to run the fakenet script every 60 seconds is -70-persistent-net.rules. It is a single line of cron configuraiton: +70-persistent-net.rules. It is a single line of cron configuration:

    */1 *  * * *     root   [ -x /root/fakenet/keepalive ] && /root/fakenet/keepalive
     
    where the initial */1 * * * * means that it runs once a minute, on every hour, day, month and year. -

    The init script which configures everything when the netbook is booted up is -

    MISSING
    -MISSING - need to get this...
    -
    +

    There is also a historical relic /root/fakenet/keepaliveharder which is no longer needed as it has been subsumed within keepalive. -

    Buggeration - how it will all go wrong..

    +

    There is a utility script which perhaps may be useful when configuring the network +/root/fakenet/stopfakenet which stops everything: +

    #!/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
    +
    +(No, I don't know why killing hostpad is commented out.) + +

    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. + + +

    Buggeration - how it will all go wrong..

    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 "Predicatable Names" scheme and iptables which are both earmarked for destruction. +

    Note that "Wicd is not available in Debian 11/Bullseye or newer" - debian Wifi Interface documentation. + +

    This is intentional. As Wookey wrote in +/root/fakenet/README-expo:
    +"It's quite low-level and old-fashioned so one can understand it :-)" + +

    So all this will need reimplementing for expo 2024.

    Historical Notes