You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.4 KiB

#!/usr/bin/env bash
set -eu
DESC="Fixe DHCP sur bigboss pour servir tiny (IP, nom d'hôte)"
HELP="
Bigboss et tiny doivent avoir été configurés par baseConfig.
"
repairDHCP() {
echo
echo "Repair DHCP"
tinyMAC=$(vdn-ssh root@tiny ifconfig eth1 | grep ether)
tinyMAC=$(echo "$tinyMAC" | \
sed -re 's/^.*ether ([[:xdigit:]:]*).*$/\1/')
vdn-ssh root@bigboss "
f=/etc/dhcp3/dhcpd.conf
[ -e /etc/init.d/isc-dhcp-server ] && f=/etc/dhcp/dhcpd.conf
cat <<-EOF > \$f
subnet 192.168.30.0 netmask 255.255.255.0 {
}
host tiny {
hardware ethernet ${tinyMAC};
option host-name tiny;
fixed-address tiny;
}
EOF
f=/etc/default/isc-dhcp-server
cat <<-EOF > \$f
INTERFACESv4=\"eth0\"
INTERFACESv6=\"\"
EOF
set -x
sleep 10
systemctl enable isc-dhcp-server
systemctl stop isc-dhcp-server
systemctl start isc-dhcp-server
#if [ -e /etc/init.d/dhcp3-server ]; then
# /etc/init.d/dhcp3-server stop &> /dev/null
# /etc/init.d/dhcp3-server start
#elif [ -e /etc/init.d/isc-dhcp-server ]; then
# /etc/init.d/isc-dhcp-server stop &> /dev/null
# /etc/init.d/isc-dhcp-server start
#fi
"
}
run() {
setErrorHandler
echoStart
requireSshGuests bigboss tiny
repairDHCP
echoDoneWithTestErrors
}