I need a local wireless LAN for about 100 mobile phones working as message terminals for an info screen projected to a white wall. As I had an old, unused Fritz! Box, I created a WLAN there but disabled DHCP as local domains are not supported by the Fritz! OS due to security constraints.
Then I installed dnsmasq on the Macbook and a packet sniffer to see what is going on.
brew update brew install dnsmasq brew install wireshark --with-qt
while I could use the DNS server already available under Mavericks. But then things became difficult. Here is what finally worked for me. Not sure if this is really the best way to handle it…
# need to be run as root sudo -s # WiFi off networksetup -setairportpower en0 off # set IP address, net mask, and router networksetup -setmanual Wi-Fi 192.168.1.2 255.255.255.0 192.168.1.1 # set nameserver IP address networksetup -setdnsservers Wi-Fi 192.168.1.2 # start nameserver launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist # start DHCP server launchctl load -w /System/Library/LaunchDaemons/bootps.plistapachectl start # WiFi on networksetup -setairportpower en0 on # test local domain dig test.dev
And just for the records here are two configuration files for DHCP and nameserver including their directories.
sudo nano /etc/bootpd.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>bootp_enabled</key> <false/> <key>detect_other_dhcp_server</key> <true/> <key>dhcp_enabled</key> <array> <string>en0</string> </array> <key>reply_threshold_seconds</key> <integer>0</integer> <key>Subnets</key> <array> <dict> <key>allocate</key> <true/> <key>dhcp_domain_name_server</key> <array> <string>192.168.1.2</string> </array> <key>dhcp_router</key> <string>192.168.1.1</string> <key>lease_max</key> <integer>86400</integer> <key>lease_min</key> <integer>86400</integer> <key>name</key> <string>192.168.1</string> <key>net_address</key> <string>192.168.1.0</string> <key>net_mask</key> <string>255.255.255.0</string> <key>net_range</key> <array> <string>192.168.1.3</string> <string>192.168.1.254</string> </array> </dict> </array> </dict> </plist>
sudo nano /usr/local/etc/dnsmasq.conf
address=/.dev/192.168.1.2