@george1421 I have installed fog with DHCP server but DNS doesn’t work at all (no dns server appear on windows client) so I’m stuck.
It’s my first time installing DHCP and DNS on Debian so I think I made mistakes.
DHCP work fine.
edit : It’s fixed. I forgot to add “option domain-name” and “option domain-name-servers” in dhcpd.conf
For the script, I think it must be simple to set FOG as DHCP server at startup if after 10 min no IP is given from a DHCP server then set server to static IP and start DHCP and DNS services.
And then reverse this at shutdown.
Maybe this can be done manually first.
edit : Here is the first script.
I have create files ending with .dhcp for conf for external DHCP/DNS and file ending with .static for conf for local DHCP/DNS.
It looks to work fine.
# Configuration actuelle
echo "Etat DNS local :"
systemctl is-active bind9
echo "Etat DHCP local :"
systemctl is-active isc-dhcp-server
echo ""
loc(){
# Configuration DHCP local
echo "DHCP local"
# Configuration
if [ -e /etc/network/interfaces.static ]
then
echo "Copie interfaces"
cp /etc/network/interfaces.static /etc/network/interfaces
else
echo "interfaces.static not found"
exit 1
fi
echo "Redemarrage service reseau"
systemctl restart networking.service
if [ -e /etc/resolv.conf.static ]
then
echo "Copie resolv.conf"
cp /etc/resolv.conf.static /etc/resolv.conf
else
echo "resolv.conf.static not found"
exit 1
fi
# Services
systemctl start bind9
systemctl start isc-dhcp-server
}
ext(){
# Configuration DHCP externe
echo "DHCP externe"
# Configuration
if [ -e /etc/network/interfaces.dhcp ]
then
echo "Copie interfaces"
cp /etc/network/interfaces.dhcp /etc/network/interfaces
else
echo "interfaces.dhcp not found"
exit 1
fi
echo "Redemarrage service reseau"
systemctl restart networking.service
if [ -e /etc/resolv.conf.dhcp ]
then
echo "Copie resolv.conf"
cp /etc/resolv.conf.dhcp /etc/resolv.conf
else
echo "resolv.conf.dhcp not found"
exit 1
fi
# Services
systemctl stop bind9
systemctl stop isc-dhcp-server
}
# Demande de Configuration
while true; do
read -p "Voulez vous passer en DHCP externe ou en DHCP local? (e:externe l:local) " el
case $el in
[Ee]* ) ext; break;;
[Ll]* ) loc; break;;
* ) echo "Please answer yes or no.";;
esac
done