The above image shows what I think occurs during an OpenVPN connection. Hosts A and B are connected to the VPN through the VPN server at 1.2.3.4:1194. My question is: if host A wishes to send a packet to host B (say an ICMP echo packet), how does the packet traverse to get to B? My initial thoughts were:
The process creates the packet with a destination of 10.20.0.6, and source of 192.168.0.x (the source ip being 192.168.0.x considering the application is unaware of the VPN connection). From the routing tables pushed to the application's computer, the packet is sent to the virtual interface.
Host A's Virtual Interface encapsulates the packet to be destined for Host B's WAN-facing address (3.4.5.6).
Is this so far correct? How does the router at B know that this packet is destined for host B? Does host A instead put 1.2.3.4 as the destination (rather than 3.4.5.6), and let the VPN server re-route through the server's already-established connection with B? Does the router at B have to be pre-setup to even allow any sort of VPN connection?