Exclude IP from VPN Tunnel on client

Need help configuring your VPN? Just post here and you'll get that help.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
zakazak
OpenVpn Newbie
Posts: 7
Joined: Wed Nov 09, 2011 10:10 pm

Exclude IP from VPN Tunnel on client

Post by zakazak » Tue Jan 03, 2023 9:05 am

Hello everyone,

not sure if this is the correct place to ask, so please forgive me if I should have posted elsewhere.

I am running OpenVPN Server on my Router and connect with Archlinux (KDE / Networmanager) as client.
So far my VPN Tunnel seems to work and all traffic is routed through the VPN.

However, the output of netstat -rn makes me curious if all routes are really correct?

netstat -rn without OpenVPN connected:

Code: Select all

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         12.99.102.1     0.0.0.0         UG        0 0          0 enp9s0u1u3u4
12.99.102.0     0.0.0.0         255.255.254.0   U         0 0          0 enp9s0u1u3u4
netstat -rn with OpenVPN connected (VPN Server 155.120.155.120):

Code: Select all

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         12.9.0.1        0.0.0.0         UG        0 0          0 tun0
0.0.0.0         12.99.102.1     0.0.0.0         UG        0 0          0 enp9s0u1u3u4
12.9.0.0        0.0.0.0         255.255.255.0   U         0 0          0 tun0
12.99.102.0     0.0.0.0         255.255.254.0   U         0 0          0 enp9s0u1u3u4
12.99.102.1     0.0.0.0         255.255.255.255 UH        0 0          0 enp9s0u1u3u4
155.120.155.120 12.99.102.1     255.255.255.255 UGH       0 0          0 enp9s0u1u3u4
Additionally I would like to exclude a single IP on my companies network from the VPN.
This is because the companies RDP server is only accessible from local IPs.
So when connected to my VPN, and routing all my traffic through my VPN, I would connect to the RDP Server with my VPN IP instead of my local company network IP. That doesn't work.

Lets say the RDP Server IP is 12.99.100.122.
In the Networkmanager OpenVPN configuration I will add the following IPv4 route:

Code: Select all

Address: 12.99.100.122
Netmask: 255.255.255.255
Gateway: 12.9.0.1 
However, I still won't be able to reach the RDP server. I also can't ping it.
Do I have to add additional routes?

netstat -rn with OpenVPN connected and route added to the configuration:

Code: Select all

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         12.9.0.1        0.0.0.0         UG        0 0          0 tun0
0.0.0.0         12.99.102.1     0.0.0.0         UG        0 0          0 enp9s0u1u3u4
12.9.0.0        0.0.0.0         255.255.255.0   U         0 0          0 tun0
12.99.100.122   12.99.102.1     255.255.255.255 UGH       0 0          0 tun0
12.99.102.0     0.0.0.0         255.255.254.0   U         0 0          0 enp9s0u1u3u4
12.99.102.1     0.0.0.0         255.255.255.255 UH        0 0          0 enp9s0u1u3u4
12.99.102.1     0.0.0.0         255.255.255.255 UH        0 0          0 tun0
155.120.155.120 12.99.102.1     255.255.255.255 UGH       0 0          0 enp9s0u1u3u4
Thanks in advance!

Post Reply