46 lines
1.6 KiB
Bash
Executable File
46 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
||
dpkg-reconfigure openssh-server
|
||
|
||
# the "northbound" interface connecting the gateway to the "real" server/clab hypervisor (NOT management-interface!)
|
||
ip addr replace dev eth1 10.192.40.2/29
|
||
|
||
# the "southbound" interface towards all the clients that we are DHCP server for
|
||
ip addr replace dev eth2 192.168.0.1/24
|
||
|
||
# "eastbound" gw<->jumphost1 eth3 and 172.16.200/23 behind jumphost1
|
||
ip addr replace dev eth3 172.16.202.32/31
|
||
# ip route replace 172.16.200/23 via 172.16.202.33
|
||
|
||
echo "nameserver 192.168.0.1" > /etc/resolv.conf
|
||
|
||
|
||
# ----------------------------------------------------------------------
|
||
# Run the long pipeline in the background, but start it only after 60 s.
|
||
# The rest of the script continues immediately.
|
||
# ----------------------------------------------------------------------
|
||
|
||
(
|
||
# wait 60 seconds first
|
||
sleep 60
|
||
# cat /var/lib/misc/dnsmasq.leases | while read line; do loctet=$(echo $line | cut -f 4 -d . | cut -f 1 -d " "); printf "${line}\t"; sed -n "$loctet{p;q}" < <(tr ":" "," < /etc/workshopnames.yml | cut -f 1,3 -d, | tr , "\t") ; done | cut -b 30- | sort -b -k 2,2V | column -t
|
||
cat /var/lib/misc/dnsmasq.leases | cut -d' ' -f3-4 |
|
||
while read -r line; do
|
||
loctet=$(echo "$line" | cut -d'.' -f4 | cut -d' ' -f1)
|
||
printf '%s\t' "$line"
|
||
sed -n "${loctet}{p;q}" < <(
|
||
tr ':' ',' < /etc/workshopnames.yml |
|
||
cut -d',' -f1,3 |
|
||
tr ',' '\t'
|
||
)
|
||
done |
|
||
# cut -b30- |
|
||
sort -b -k2,2V |
|
||
column -t
|
||
) > /online-users.txt & # ← background the whole subshell
|
||
|
||
|
||
# launch dnsmasq (automatically backgrounds)
|
||
dnsmasq --no-daemon
|
||
|
||
# /usr/sbin/sshd -D
|