So, I have been curious about how express VPN blocks all internet traffic if the connection drops. Since, the amount of data in 0s and 1s is probably in billion bits per second. How does, expressVPN know when to block the internet if the connection drops? I understand it is called network lock in expressVPN https://www.expressvpn.com/features/network-lock but there isn't much information about how it works behind the scenes or the code behind it.

There are two things I think it could be working as:

  1. it uses some code, to check if the IP address is expressVPN and only sends out data packets or receives data packets which have the Express VPN IP it its headers?
  2. As this page says, it might be using some kind of for loop for its own code.


For loop seems little wonky. It can be ok for everything you are doing, but if you do not want your traffic to go out with your real IP under any case. It must be 100% functional. The code given on askubuntu


dbus-monitor --session "type='signal',interface='com.ubuntu.Upstart0_6'" | \
  while true; do
    read X
    if echo $X | grep "desktop-lock" &> /dev/null; then
      nmcli nm enable false;
    elif echo $X | grep "desktop-unlock" &> /dev/null; then
      nmcli nm enable true;

how often will the while true check the condition. For example: what if my express VPN drops and between the two runs when CPU checks the "while true" condition some traffic with my real IP in its headers slips by?

Edit: I have changed my question title. My bad. I am more interested in knowing how does expressVPN ensure the network switch. It may or may not be using the "for loop". If someone knows, how it works, would be helpful. I think a for loop is an acceptable guess at how it may be doing that. But it has a flaw as per my understanding as I tried to explain in point 2.


1 Answer 1


In a shell, while true runs immediately again after its do ... done body has finished.

For the new title How does expressVPN ensure privacy?, please ask the respective provider.

  • I have edited my question. My bad. Please see the edited section. Thanks
    – User167234
    Commented Apr 17, 2021 at 1:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .