Hi, I’d like to setup a VPN for WAN traffic only (if possible for some specific applications only) but if not possible, I’d be ok with all WAN out traffic.
My VPN provider offers: Ubuntu, Fedora and CentOS configs, but I believe that none of those fit with DietPI distro (correct me if I’m wrong). Anyway, I can always use a manual OpenVPN config as workaround.
Also, I need to keep SSH on the local network otherwise I’d loose access to my server.
dietpi-vpn supports ovpn files for config.
To exlude local traffic you need to modify your open vpn config. private / locale IP ranges go through your default interface and the rest is routed through the virtual VPN interface.
See the following link for information: https://stackoverflow.com/questions/70224509/exclude-ip-from-openvpn-route
Ok, first things first, I’m trying to get all traffic to go through the VPN and so far, I seemed to have accomplished it with the config that I added these 3 lines that should let the LOCAL traffic (these are my vlans) out of it:
However, after applying and doing so, I could see that WAN in the server is in fact using the VPN and I’m still able to maintain the local SSH connection to it (great). But… none of my server services are reachable at this point and I don’t get why.
I’m using the exact same host that is accessing through SSH, but for some reason I can’t reach any of my local servers through the web browser. Not even FTP or SMB. Any clue?
Also, I’d like to know how to disable the VPN, because I’ve tried turning off and running service dietpi-vpn stop and even so, I still can’t reach anything. It’s like if the VPN settings (killswitch) were still applied.
It’s like if the dietpi-vpn changed the iptables configs and didn’t revert back when I stopped the VPN. I can see that most of connections are set to DROP (probably due to the killswitch setting, which I then toggled off).
I’m afraid at this point of logging out from SSH and losing access to my server.
I guess the answer is not coming through the same interface which got the request.
Can you check a route to a local client, it should show dev eth0
ip route get <CLIENT_IP>
And do you maybe have any DROP rules in your iptables?
iptables -L -v -n
I guess you need to deactivate the kill switch and not jsut stop the service. These DROP rules you see come from the kill switch, it only allows connections throught the VPN
I fixed the DROP but “reseting” the settings in dietpi-vpn. However, now again, with the right config applied (kill switch on, start on boot etc) and the exceptions posted above, I can’t access any of the hosted services. This is the iptables:
FYI: This is a DMZ’d device that has only “return traffic” rule as accepted in the router. But this shouldn’t be an issue since it works without the VPN. This means that I can’t start connections from server → client in my LAN. Not sure if this has any relevance to the matter.
So, how can I always allow LAN communication while preserving the WAN OUT kill switch (which I really want to)? Can I add persistent rules to the iptables that won’t be overridden?
Edit: I disabled the killswitch and the iptables remain the same. Do I need to reboot?