I'm using a MacBook Pro with OS X Mavericks 10.9.2. It connects to the internet via a USB 3G dongle, and I want to share that internet connection via wifi. However, on devices that connect to the created wifi access point, DNS lookup will not work (though I can ping 18.104.22.168 just fine). If I statically configure the devices to use 22.214.171.124, everything works, but not every device supports that (or only if you're also willing to configure a static IP and gateway).
The problem seems to be that OS X configures bootp (the DHCP server) to hand out a DNS server address of the MacBook itself:
$ cat /etc/bootp.list ... <key>dhcp_domain_name_server</key> <array> <string>192.168.2.1</string> </array> ...
This is indeed the IP address of the machine itself:
$ ifconfig ... bridge100: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=3<RXCSUM,TXCSUM> ether 02:26:bb:66:19:64 inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255 ...
And it's what clients are receiving in the DHCP response:
$ sudo tcpdump -vv 15:26:07.265635 IP (tos 0x0, ttl 255, id 9846, offset 0, flags [none], proto UDP (17), length 328) 192.168.2.1.bootps > 192.168.2.2.bootpc: [udp sum ok] BOOTP/DHCP, Reply, length 300, xid 0x4e0988af, Flags [none] (0x0000) Your-IP 192.168.2.2 Server-IP 192.168.2.1 Client-Ethernet-Address 10:bf:48:cc:49:7d (oui Unknown) sname "ip-77-24-232-37.web.vodafone.de" Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: ACK Server-ID Option 54, length 4: 192.168.2.1 Lease-Time Option 51, length 4: 85536 Subnet-Mask Option 1, length 4: 255.255.255.0 Default-Gateway Option 3, length 4: 192.168.2.1 Domain-Name-Server Option 6, length 4: 192.168.2.1
Now, that would be fine if it actually worked as written here, i.e. OS X runs a bind (
named) server itself, that just forwards DNS requests and responses to the ISP's servers.
tcpdump I can see that the client is getting an error response from its DNS lookups:
$ sudo tcpdump 15:23:33.181447 IP 192.168.2.2.57291 > 192.168.2.1.domain: 32713+ A? google.com. (28) 15:23:33.181528 IP 192.168.2.1 > 192.168.2.2: ICMP 192.168.2.1 udp port domain unreachable, length 36
named server is running, and it doesn't even seem to be installed:
$ ps aux | grep named thomas 2175 0.0 0.0 2423368 188 s000 R+ 3:14pm 0:00.00 grep named $ which named $
Nothing else is listening on UDP port 53 either, though there is a thing called mDNSResponder on 5353:
$ sudo lsof -i -P | grep 53 mDNSRespo 47 _mdnsresponder 8u IPv4 0x4dcb7c0f075daa1d 0t0 UDP *:5353 mDNSRespo 47 _mdnsresponder 9u IPv6 0x4dcb7c0f075da835 0t0 UDP *:5353 natpmpd 1664 root 4u IPv4 0x4dcb7c0f064b6f15 0t0 UDP 192.168.2.1:5351
Now I can think of two ways to fix this, neither very practical:
- Run some DNS server on UDP port 53. Unfortunately, none is installed.
- Tell DHCP to hand out a DNS server address that actually works, like 126.96.36.199. Unfortunately, the
/etc/bootp.plisteach time internet sharing is turned on, so even if I added an IP address there and even if it would work, it wouldn't work forever.
But something tells me that this should (and usually does) work correctly out of the box... what am I missing?