expoweb/handbook/computing/netbookfakenet/fakenet2022/runfakenet

39 lines
1010 B
Bash

#!/bin/sh -eux
. /root/fakenet/config
#Close down running interfaces and services
sudo ifdown -i ${base}/${config}/netconfig eth0
sudo ifdown -i ${base}/${config}/netconfig wlan0
sudo ifdown -i ${base}/${config}/netconfig wlan1
sudo service wicd stop
sudo iptables -F
sudo killall dhclient || true
sudo /etc/init.d/dnsmasq stop
sudo killall dnsmasq || true
#Now bring up desired networking
#ethernet to router
sudo ifup -i ${base}/${config}/netconfig eth0
#wlan1 long-range wireless to gasthof
sudo ifup -i ${base}/${config}/netconfig wlan1
#Set up hostapd for local wireless - not currently (2022) used
#sudo service hostapd restart
#Make this machine do DNS for potatohut
#And forward external requests to the real net
sudo dnsmasq -q -C ${base}/${config}/dnsmasq.conf
#bridge/masquerade from gasthof to router
${base}/${config}/masquerade
# Log in to Gasthof wifi!
${base}/${config}/gasthoflogin
# Join Acer to potatohut network for admin purposes
#sudo ifup -i ${base}/${config}/netconfig wlan0