Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sadikaya/e8bc1bdf642e29a83512ffc8659b45f0 to your computer and use it in GitHub Desktop.
Save sadikaya/e8bc1bdf642e29a83512ffc8659b45f0 to your computer and use it in GitHub Desktop.

TL;DR

Launch Terminal and run:

ifconfig | grep -B 6 'status: active' | head -n 1 | cut -d : -f 1

Then run (replace en0 below with the output of the command above):

cd /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources
sudo ./airport en0 prefs DisconnectOnLogout=NO
sudo pmset -a sleep 0

Long version

I am on MacOS Mojave (10.14). For me this helped against automatically disconnecting from Cisco AnyConnect while on WiFi:

Open the Terminal app and paste:

ifconfig | grep -B 6 'status: active' | head -n 1 | cut -d : -f 1

This returned:

en0

Then type (replace en0 on line 2 with the returned value above):

cd /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources
sudo ./airport en0 prefs DisconnectOnLogout=NO

Type your password.

Check if the setting was saved by typing:

sudo ./airport prefs

Which should return this:

AirPort preferences for en0:

DisconnectOnLogout=NO
Unable to retrieve JoinMode
JoinModeFallback=DoNothing
RememberRecentNetworks=YES
RequireAdminIBSS=NO
RequireAdminNetworkChange=NO
RequireAdminPowerToggle=NO
WoWEnabled=YES
DisconnectOnLogout should be set to NO.

Next, prevent the system from going to sleep after locking:

sudo pmset -a sleep 0

That should do the trick, worked for me.


https://apple.stackexchange.com/a/338617

@MuhammadRahman-awin
Copy link

Hi,
with the ifconfig command I see this
options=6463<RXCSUM,TXCSUM,TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
Don't think its correct.

@zyto
Copy link

zyto commented Jul 27, 2022

Hi, with the ifconfig command I see this options=6463<RXCSUM,TXCSUM,TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM> Don't think its correct.

I have the same problem.
Did you solve it?

@YashasviMantha
Copy link

same here.

@rpastijn
Copy link

Change the -B 6 to -B 7 on newer OSses. But the chance is high you will get en0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment