Understanding how routing / tun mode is working
Posted: Wed May 27, 2020 12:31 am
Hi Everyone,
I've been searching high and low for how exactly OpenVPN implements tun mode (l3 - routing). I've found a load of generic articles that explain the high-level view, but am looking for something a bit more detailed. I'd like to know how the tunneling procedure is actually implemented. Is it similar in nature to GRE?
In my particular implementation right now (I am just learning), I have an OpenVPN for Windows (not Open Access Server) running on a Windows Server 2019 instance. I then likewise installed it on my W10 lab laptop. As such, both devices are on the same LAN, but on different subnets. I have been able to get everything working properly, now I am just trying to understand how it works. I get the basics of what is going on - that packets are being encapsulated in packets - but I'd like a little more detail on how exactly that process is taking place.
I've run a route print (netstat -r) on both my server and my laptop. Here's what I see on my laptop:
So my device is receiving an IP of 192.168.50.6. The server IP is 192.168.50.1. The gateway (tunnel interface?) on my device is 192.168.50.5. However, I'm confused about what the 192.168.50.4 and 192.168.50.7 destinations refer to and why they are needed. Could someone enlighten me? Or perhaps point me to more detailed documentation? I do see in my arp table that 192.168.50.7 has an associated broadcast l2 address.
I've been searching high and low for how exactly OpenVPN implements tun mode (l3 - routing). I've found a load of generic articles that explain the high-level view, but am looking for something a bit more detailed. I'd like to know how the tunneling procedure is actually implemented. Is it similar in nature to GRE?
In my particular implementation right now (I am just learning), I have an OpenVPN for Windows (not Open Access Server) running on a Windows Server 2019 instance. I then likewise installed it on my W10 lab laptop. As such, both devices are on the same LAN, but on different subnets. I have been able to get everything working properly, now I am just trying to understand how it works. I get the basics of what is going on - that packets are being encapsulated in packets - but I'd like a little more detail on how exactly that process is taking place.
I've run a route print (netstat -r) on both my server and my laptop. Here's what I see on my laptop:
Code: Select all
Network Destination Netmask Gateway Interface Metric
192.168.50.1 255.255.255.255 192.168.50.5 192.168.50.6 25
192.168.50.4 255.255.255.252 On-link 192.168.50.6 281
192.168.50.6 255.255.255.255 On-link 192.168.50.6 281
192.168.50.7 255.255.255.255 On-link 192.168.50.6 281