If you have several active network connections on a Windows machine (especailly VPN connections), Windows will use them in an ordered fashion for accessing hosts and performing DNS lookups.
If you have a host with a public IP accessible from the internet, and a private IP accessible from the VPN and both of them set to the same hostname (IP resoultion being network dependent), if the ordering can be very important. If the network connection to the internet is used first, the hostname will always resolve to the public IP, even when the VPN connection is active. The solution is to ensure your VPN connection has a higher priority than the general internet connection.
- Connect to the VPN
- Open Control Panel
- Open Network and Sharing Center
- Click Change Adapter Settings at the left side
- Press alt to show the menu bar
- Select Advanced, and then Advanced Settings
- Select the Adapters and Bindings tab
- In the Connections field, select your VPN connection
- Use the arrows at the side to move the VPN connection above your general network connection
Don't forget to flush your DNS too