WiFi Pineapple and Mac OS X Internet Sharing
Important: this approach does not seem to work since Mac OS X 10.10 Yosemite.
This one is for you Mac users out there that want to share your Mac’s WiFi internet connection via the LAN cable to the WiFi Pineapple. Using the out of the box Internet sharing option of your Mac doesn’t work with the WiFi Pineapple. I had experienced it again, but never gave it any good look and switched to Linux. Today I it frustrated me and I looked into it.
The problem with the setup is twofold: 1) The Pineapple expects the 172.16.42.0 subnet, while OS X uses 192.168.2.0 when enabling internet sharing, and 2) the Pineapple expects the default gateway on 172.16.42.42 which is not a very logical address for a gateway. Now, we could change all these settings on the Pineapple to match the Mac’s. But sometimes your situation may require different. I couldn’t find any manual on the internet. So here are the steps you need to do:
- Disconnect cables from Mac’s LAN to Pineapple.
- On the Mac go to Internet Sharing and share your WiFi adapter to the LAN interfaces. Once enabled, disable it again and close the System Preference program. We need this step to write a default config file that we can alter.
- The config file that we need to alter is /Library/Preferences/SystemConfiguration/com.apple.nat.plist We need to add an option “SharingNetworkNumberStart 172.16.42.0”. You can manually add this as a dict at the end of the file, or you can use the command “sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkNumberStart 172.16.42.0″. This makes sure that 172.16.42.0/24 is now used as the subnet for the sharing interface, and as such fixes our first problem.
- Use the GUI again to start Internet Sharing.
- Manually change the IP address used by the Mac’s LAN interface with the command “ifconfig bridge100 172.16.42.42 netmask 255.255.255.0 up”.
- Now we need to change some DHCP options, because by default the DHCP server tells the clients to use gateway 172.16.42.1. We do this by altering file /etc/bootpd.plist. There are two mentions of 172.16.42.1 that we need to change into 172.16.42.42. We also need to adjust the pool range. Look for the <key>net_range</key> section. Alter the starting address to 172.16.42.43.
- Find the PID of the bootpd process and give it a kill -HUP to reread its config file.
That’s it. Now you can connect the LAN cable and enjoy internet from your Pineapple.