Every now then I had to move my raspberry pi 3 between rooms. One of the room had router, therefore the Raspi3 was connected via LAN. The other, however was far away so wireless was required.
I had my DHCP set with mac binding. This assigned same IP to my devices and helped with shortcuts for Remote desktop, PuTTy etc. However because of this movement of Raspi3 between WLAN and ETH, I had to manually disable and enable the other network adapter. Until I found below script.
Create script file as below
sudo nano /etc/NetworkManager/dispatcher.d/99-wlan
Copy below text. Replace eth0 with whatever your eth interface is
#!/bin/bash if [ "$1" = "eth0" ]; then case "$2" in up) nmcli radio wifi off ;; down) nmcli radio wifi on ;; esac fi
chmod +x /etc/NetworkManager/dispatcher.d/99-wlan