Automatically Disabling WiFi in macOS Mojave When Connecting to Ethernet

Standard

I don’t know why, but macOS doesn’t seem to have an automatic ability to shut down the WiFi adapter when an Ethernet connection is detected. It’s a simple thing that can cause several problems, especially if you are in an environment where you may need to authenticate to a network or access VPN services.

It may be possible to manage locations and some additional tools, but I didn’t want something that required retooling every time I used my system in a new location, so I decided to write a simple script, using built-in tools for everything except the execution of the script.

This script will check for both an active WiFi connection and also an active Ethernet connection. If it detects both, it will shutdown the WiFi interface and display a notification, via macOS notifications, that it has done this. I haven’t tested this on previous versions of macOS (only Mojave), though if the rest of the commands work, the script might function by simply removing the statement that generates a notification.

Continue reading

Avoiding IP Conflicts When Using Virtual Machines

Standard

I thought I had mentioned this tip in a previous post but since a quick search didn’t turn it up I figured I’d add this as its own entry. Not long after I started using virtual machines on a regular basis at work I encountered an IP conflict with a VM and another machine on the network.

The cause was simple. The last time I had used the VM I chose to suspend its state. It retained the IP and tried to use it the next time I started it up.

The solution is also simple. I’ve used this method with both VMWare Fusion and Parallels Desktop for Mac. Every time I prepare to suspend a virtual machine I simply disconnect the VM’s network connection prior to suspending. This will cause it to release the IP. The next time the state is restored and the network is reconnected it should pull a new IP.

It’s worth mentioning that this really only applies to VMs that have IP addresses assigned via DHCP.