Losing Network Connectivity Once Disconnected
If your computer loses network connectivity once you disconnect from your VPN connection, it is likely the IP range you are connecting from, and an IP range you access through the VPN network, are the same. You may find the following message in your OpenVPN log when this occurs:
WARNING: potential route subnet conflict between local LAN [x.x.x.x/y.y.y.y] and remote VPN
When you connect, OpenVPN will add the relevant routes to your computer so it knows to access certain addresses over the VPN connection. If one of the routes added happens to be the same as the route for the network from which your computer is connecting from, OpenVPN will overwrite it. When you disconnect, OpenVPN will remove all routes it added, resulting in your computer no longer having a route for the local network. Hence it will appear like your computer has dropped off the network.
Viscosity includes a feature that will reset your network interfaces on disconnect, which will in most cases restore your computer's original routes. You can use this like so:
- Open Viscosity's Preferences window
- Click on the Advanced toolbar icon
- Tick the "Reset network interfaces on disconnect" option
- Close the Preferences window and reconnect your VPN connection
If the above option doesn't appear to work, you can either change the IP range your VPN connection uses (if you are the server administrator), or change the IP range your computer is connecting from. For example, if both your home network and work network (which you are connecting to via VPN) use a range of 10.0.0.x, try changing your home network to 10.1.0.x.
If neither of the above options work, you can write your own "down" script to restore the correct routes. This is for advanced users who are familiar with shell scripting. See Advanced Configuration Commands for more information.
Finally, a quick solution to restore network connectivity (without rebooting) is to toggle your network interface off and back on again. For example, with wireless you can turn Airport off and back on again from the Airport menu. With a wired connection you can manually un-plug and re-plug in the network cable, or disable and re-enable the network interface from the Network area in System Preferences.