how HTB VPN works?

There are two types of IP addresses.

  1. Private IP - You can see it in LAN settings using (ifconfig command or similar in ipcinfig in windows) - This is the address of your machine which can only be reached from LAN only.

  2. Public IP - Have you ever thought how you can ping Google’s IP (8.8.8.8) from your machine since it is not in your LAN ? This is because of your Public IP which will get assigned dynamically (changes frequently which depends on availability of public IPs) by DHCP (Dynamic host configuration protocol). This is the IP address by which you gets connected to all over the network and of course you can reach any server via this IP only.

… Traffics …
To understand how traffic separates from public IP to VPN IP, you must need to understand the concept of IP addresses classes.

Address range for private IP addresses - example for understanding

  1. 10.0.0.1 - 10.255.255.255 (used mostly in VPN and of course HTB VPN works with this range only - this is called as tunnel 0 - tun0 in ifconfig)

  2. 192.168.0.1 - 192.168.255.255 (used in LAN - when you connects to a WiFi, you can see something like 192.168.181.24 you will get this assigned with availability for IP addresses in your LAN - eth0 in ifconfig)

The addresses I mentioned above can be pinged only with your respective tun0 or eth0 IP addresses (private) only, where you can ping public servers like Yahoo, Google, Facebook with your dynamically assigned public IP address like 111.xx.xx.xx (you can find this by typing ‘whats my IP in google’) only.

As I already mentioned that VPN servers require certificate verification (read your .ovpn file) so that you can legitimately connect to that private VPN server.

This is how it works - I hope it helps you.
Please read more about this in articles so that you can understand it better and I may missed something.

Good luck. :wink: Happy learning and happy hacking.