Hi,
I try to disable any usb, usb-c, or other ways of ethernet and temperately disable it. let wifi run. and then reactive when I finish my script.
any way to find out active ethernet adapter and disable it?
thanks!
Hi,
I try to disable any usb, usb-c, or other ways of ethernet and temperately disable it. let wifi run. and then reactive when I finish my script.
any way to find out active ethernet adapter and disable it?
thanks!
I think this is going to be rather tricky. Primarily because it seems that each new adapter creates a new service.
Do you need to actually disable it? Can you just change the service order?
Regards
TJ
However, if you need to do it.
What you're probably looking for is:sudo networksetup -listallnetworkservices
sudo networksetup -setnetworkserviceenabled
example: sudo networksetup -setnetworkservice "Belkin USB-C LAN" off
but even just change the service order, you need to know the name for the adapter?
actually I just found out how to do it:
a=$(networksetup -listnetworkserviceorder |grep 'Hardware Port' |grep '10/100' |grep -o '....$' |cut -c 1-3)
sudo ifconfig $a down
and later when I want it back, I use
sudo ifconfig $a up
maybe this long command can be simplify :)
@tthurman we are thinking on the same route! haha
With the newer version of macOS, you might have to change '10/100' to 'Ethernet' to have the script work.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.