Skip to content

Instantly share code, notes, and snippets.

@bobvanderlinden
Created November 30, 2018 20:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobvanderlinden/972c3989346d28116b7c9c5bb244ba16 to your computer and use it in GitHub Desktop.
Save bobvanderlinden/972c3989346d28116b7c9c5bb244ba16 to your computer and use it in GitHub Desktop.
Ad-hoc dnsmasq DHCP server

This script is handy for setting up an ad-hoc DHCP server for instance when starting up a Raspberry PI for the first time. dnsmasq will output when it has given a client an address:

dnsmasq-dhcp: DHCPACK(enp0s25) 192.169.1.109 b8:27:eb:86:2f:ed nixos
INTERFACE=enp0s25
sudo ip addr add 192.169.1.1/24 dev $INTERFACE
sudo dnsmasq --no-daemon --listen-address 192.169.1.1 --interface $INTERFACE --dhcp-range=192.169.1.50,192.169.1.150,12h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment