Implement split VPN with IPv6+IPv4 LAN and IPv4-only network

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
johnnyone89
OpenVpn Newbie
Posts: 1
Joined: Thu Jul 13, 2023 11:20 am

Implement split VPN with IPv6+IPv4 LAN and IPv4-only network

Post by johnnyone89 » Thu Jul 13, 2023 12:04 pm

Hello!
Probably, this is the n-th topic about Split VPN configuration, but I have read a lot without success so far.

I have a home router with OpenWRT and OpenVPN package. My ISP only provides IPv6 connection, so the IPv4 traffic is redirected through a DS lite tunnel over IPv6.
If I check my IP (ipleak.net) I can see an IPv4 address, an IPv6 one and IPv4+IPv6 DNS. IP and DNS are correctly passed by the ISP.
I also have two local networks, say LAN_A and LAN_B. LAN_A has IPv4+IPv6 support and LAN_B is IPv4 only. I would like LAN_A to be connected directly to internet, while LAN_B is only accessing internet through VPN (always on tunnel).
I have a commercial VPN provider and I have configured the client with the provided ovpn file.

When the tunnel is not present, everything works as expected. Once I open the VPN tunnel, all the traffic gets redirected to the VPN tunnel (as expected). 128.0.0.0/1 and 0.0.0.0/1 routes are added and DNS from the VPN server are also fetched.
I have implemented a split tunnel by following this guide: https://medium.com/@ingamedeo/openvpn-s ... 302a1a4e12 Basically, route-up is added to the ovpn config and the linked shell script removes the 128.0.0.0 and 0.0.0.0 entries and add routes of LAN_B towards the VPN tunnel.
When I open the VPN connection:
  • LAN_B connects as expected to the VPN and internet. Since the VPN service provider does not offer IPv6 connectivity, everything is passing through IPv4 and I do not see any leak (DNS are correctly set and IPv6 is not available on LAN_B).
  • LAN_A connects to the internet directly, but IPv6 is not available anymore (if I go to ipleak.net I see that IPv6 IP is now mising). Moreover, DNS are not those from the ISP anymore (when tunnel is not present) but those of the VPN provider.
If I close the tunnel, then LAN_A gets the ISP DNS and IPv6 address.

How can I configure the system to let LAN_A get an IPv6 address and use my ISP's DNS, while keeping LAN_B IPv4-only with DNS priovided by the VPN server?

P.S. I tried to ask ChatGPT as well, without success :D

Thank you!

Post Reply