How Does a VPN Manage Local IP Addresses
Solution 1:
To answer your question, Yes, you're "lucky" it's working.
When you connect to your VPN, your tunnel interface is assigned an IP by that remote DHCP server. So you're technically routing from the VPN server to your remote devices. You're probably connecting to your servers via their DNS names or something, which is resolved by your DNS servers locally. In which case if it couldn't find it, it'll search in your remote office.
So technically yes, this'll work. But it is not very efficient.
EDIT**
So for eg. your VPN client is assigned an address by the SSL VPN. Which could be a different network address range. (eg. 172.16.32.0/16) While your remote network is working in the 192.168.1.0/24 range. The VPN server can be configured to bridge the two networks together.
The IP that your VPN client gets is not from the remote site's system/router's DHCP server, but rather the VPN server's DHCP server.
About the DNS, I don't really know how to explain properly. It uses a mix of DNS, ARP and RARP requests to determine the correct device. Hopefully this is enough to understand.
Solution 2:
How Does a VPN Manage Local IP Addresses and how does a VPN keep them straight?
I had this exact same question!
The thing is, it depends entirely on the VPN Technology, and there's well over ten different VPN Technologies. I'll discuss three popular ones.
- VTIs (new, somewhat similar effect to DMVPN)
DMVPN = GRE Tunnels (which allows OSPF/EIGRP routing protocols) inside of IPSec Tunnels (Which do the encryption). Here's a diagram:
In this VPN Scenario you keep your IP address from your local DHCP server, but your router now has a route to the remote Private LAN, through the tunnel, and you can ping the private IP addresses of the Remote LAN. (The tunnel is able to bypass NAT and Firewall, Tunnel = a virtual interface on your local router that connects to a virtual interface on the remote router, via a virtual ethernet cable.)OpenVPN (Which I think works similarly to your Sonicwall): You install client software on your PC that creates a virtual adapter. So now your PC has a physical Ethernet Port with an IP address on your local LAN, that allows you to ping to static servers on your local LAN. When you connect to the Remote VPN your virtual network adapter will get a virtual IP address. Where does it get this virtual IP address? You won't get it from your Local DHCP Server, and you won't get it from the DHCP server on the remote network either. The VPN Server has it's own pool of IP Addresses just for VPN clients, and the VPN Server has a spot to configure the DNS info given to remote VPN clients. I think OpenVPN uses 10.8.0.0/16. Your Virtual Interface will get a Virtual IP address from the range reserved for remote VPN clients. Note that the Virtual IP address is an IP address that exists on the remote Private LAN, and that's how you can ping the static IP address of servers on the remote private LAN. So by having two interfaces one physical and one virtual, you can ping local LAN servers and remote LAN servers, also the physical interface is configured with your local DNS server, and the virtual interface is configured with the remote DNS server. So you can resolve both local DNS and remote DNS.