How is incoming and outgoing traffic handled by a Linux system connected to a VPN function?

Micah: 02 February 2022

Say if I have a Linux system that is connected to a VPN that also runs an Apache webserver.

  1. Can incoming traffic from the internet reach the listening Apache webserver on the Linux system connected to a VPN?
  2. Does the outbound traffic from the webserver get routed through the VPN connection?

Jack: 02 February 2022

For the simple case:

If your VPN connection sets your system's default route to the VPN, traffic from the Internet ought to still be able to reach your web server's public IP address, but your system will send responses through the VPN.

If your VPN connection is very selective on what traffic gets sent to it, say, only net 10, net, and, or a specific block owned by the VPN provider, leaving the default route unchanged, then your web server ought to work as usual.