This title reflects my utter surprise when I tested an iOS application on a connected iPad, turned on Airplane mode to terminate the application’s connection with the MacBook Pro… but it continued to work. The iOS application runs a server, publishes it using Bonjour (aka DNS-SD) and a client on the network (my macbook in this case) connects to it. To test some scenarios, I need to block the connection and the natural way is to enable the Airplane Mode or disable WiFi, but neither worked. This was very bizarre.
I have a cellular iPad and turns out when it’s connected to the Mac via USB, it adds a new network interface (NIC)! In my case it’s en5:
There are no unusual, iPad-related services in the Network settings on OSX. Also nothing about this in the iPad settings, especially because there is no SIM card installed and the cellular is off.
So my application’s connection was actually going through this interface instead of WiFi, and therefore disabling WiFi didn’t do anything to it. The “fix” for this issue is to disable this NIC manually with sudo ifconfig en5 down. It has to be done every time you connect the iPad. I couldn’t find any information online on how to disable this behavior altogether.
A tip: to make this faster, I allowed sudo to run ifconfig without asking for my password. The command sudo visudo opens /etc/sudoers in your text editor and verifies that it’s in the correct format before replacing it. The line to add to /etc/sudoers is:
1
%admin ALL=(ALL) NOPASSWD: /sbin/ifconfig
ps. Airplane mode has also become confusing now (iOS 13). It doesn’t always disable WiFi, but it depends on the setting at the time you last enabled it. Go figure: https://discussions.apple.com/thread/250419822.