Some weeks ago I wrote the first part about Internet Sharing. There we changed the network configuration on the Wifi Pineapple itself. This time we tweak the network configuration (NAT subnet configurations) so that we can use internet sharing on macOS inside “172.16.42.x” network.
Configure Internet Sharing without changing the default settings on Wifi Pineapple (but change defaults on macOS).
Step 1: Prepare for next steps
If you have “Internet Sharing” enabled, now you must switch it off!
Turn on the Wifi Pineapple device and connect via USB (A plug for NANO, ETH plug for TETRA) to your Mac. If everything works fine, following commands should run successful.
# ping device (optional) $ ping -c 1 172.16.42.1 # show wifi pineapple network settings (optional) $ ssh email@example.com -C 'uci show network' # start browser session (optional) $ open http://172.16.42.1:1471
Step 2: Configure default subnet
The property list (com.apple.nat.plist) is like a contract between the “Sharing preferences pane” and “InternetSharing”. One important property to set there is “SharingNetworkNumberStart” (all other properties, which follow in this tutorial, are optional). This property controls the behavior of InternetSharing when it configures IP addresses for the local interfaces. I choose value 172.16.42.10.
# read the property list (optional) $ defaults read /Library/Preferences/SystemConfiguration/com.apple.nat.plist # create backup of the property list file (optional) $ sudo cp /Library/Preferences/SystemConfiguration/com.apple.nat.plist /Library/Preferences/SystemConfiguration/com.apple.nat.plist.bak # add start IP $ sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkNumberStart 172.16.42.10 # add end IP (optional) $ sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkNumberEnd 172.16.42.100 # add network mask (optional) $ sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkMask 255.255.255.0
Step 3: Network configuration
We will deal with 2 interfaces locally (enX and bridge100). Now we configure the “enX” IP first. We do this simply via “Network preferences”. Depending to your Wifi Pineapple device you should see following services:
- NANO: AX88x72A
- TETRA: USB 10/100 LAN
Select the service and configure like in picture.
Now change the network service order.
After saving, we quickly check everything.
# check interface (in my case it's en5) $ ifconfig en5 ... inet 172.16.42.10 netmask 0xffffff00 broadcast 172.16.42.255 # ping from wifi pineapple (should not work yet) $ ssh firstname.lastname@example.org -C 'ping -c 1 google.com' ... ping: sendto: Network unreachable # check for interface (should not exist) $ ifconfig bridge100 ... ifconfig: interface bridge100 does not exist
Step 4: Start Internet Sharing
Inside “System Preferences”, click “Sharing”, then select “Internet Sharing”. Configure as in picture.
Step 5: Set bridge100 interface IP
Back to the terminal, here the interface “bridge100” should be visible now. This interface we assign the IP 172.16.42.42.
# show interface information (optional) $ ifconfig bridge100 # add IP to bridge100 interface $ sudo ifconfig bridge100 172.16.42.42 netmask 255.255.255.0 up
That’s it already! Via “Bulletins” you can verify.
BTW … Take a look at the following local files, with and without Internet sharing!
# read config file for DHCP $ defaults read /etc/bootpd.plist # read internet share config (optional) $ defaults read /System/Library/LaunchDaemons/com.apple.NetworkSharing.plist