[-] sykaster@feddit.nl 1 points 3 days ago

Thanks! Unfortunately my VPN is OpenVPN and doesn't support Wireguard yet :(

[-] sykaster@feddit.nl 1 points 3 days ago

Cool! And you can easily control the mini router from your devices so that it connects to the hotel WiFi or whatever network you want?

[-] sykaster@feddit.nl 1 points 4 days ago

Interesting! I'm new to this, this is really valuable! What made you choose this approach?

[-] sykaster@feddit.nl 3 points 4 days ago

Understood, yes it's a kill switch. I'll test your set of rules in a bit and let you know!

[-] sykaster@feddit.nl 1 points 4 days ago

Except that that set of rules doesn't work, or do you mean defining a default gateway?

[-] sykaster@feddit.nl 0 points 4 days ago

Interesting, but by the time I apply the rules the VPN connection has already been established. Wouldn't that remove the necessity for the last line?

[-] sykaster@feddit.nl 1 points 4 days ago

I guess what I'm really trying to do is make sure that whatever happens, if the vpn fails (tun0), there is no more communication with the Internet.

[-] sykaster@feddit.nl 1 points 4 days ago

Hmm, but wouldn't that allow applications to communicate on wlan0 without using the vpn?

Thanks for your help and excuse my ignorance.

[-] sykaster@feddit.nl 1 points 4 days ago

I see, but then how would I disable everything else? Should I not use the default rules?

[-] sykaster@feddit.nl 0 points 4 days ago

It does, but later I have the rules to counteract those, for the VPN specifically: sudo ufw allow in on tun0 sudo ufw allow out on tun0

So that would open that up again, or am I wrong?

[-] sykaster@feddit.nl 1 points 4 days ago

That makes sense, but it's possible that the VPN connection drops for a second, and then it can't re-establish it, right? How would I deal with that?

35
submitted 4 days ago* (last edited 4 days ago) by sykaster@feddit.nl to c/linux@lemmy.ml

Hi all, I'm trying to have my rpi5 running raspberry OS communicate with the Internet only through the tun0 interface (vpn). For this I wanted to create a ufw ruleset. Unfortunately, I've hit a roadblock and I can't figure out where I'm going wrong.

Can you help me discover why this ruleset doesn't allow Internet communication over tun0? When I disable ufw I can access the Internet.

The VPN connection is already established, so it should keep working, right?

I hope you can help me out!

This is the script with the ruleset: sudo ufw reset

Set default policies

sudo ufw default deny incoming

sudo ufw default deny outgoing

Allow SSH access

sudo ufw allow ssh

Allow local network traffic

sudo ufw allow from 192.168.0.0/16

sudo ufw allow out to 192.168.0.0/16

Allow traffic through VPN tunnel

sudo ufw allow in on tun0

sudo ufw allow out on tun0

Add routing between interfaces (I read its necessary, not sure why?)

sudo ufw route allow in on tun0 out on wlan0

sudo ufw route allow in on wlan0 out on tun0

sudo ufw enable

[-] sykaster@feddit.nl 14 points 2 weeks ago

I always find this kind of silly. You were born and raised in the USA, so you're American, whether you like it or not. There's people saying they're Irish American despite 3 generations having passed, so when does it end? Am I Dutch-Norwegian because my great grandmother was Norwegian and came to The Netherlands?

No, I'm Dutch, I was born and raised here without influence of the Norwegian culture.

view more: next ›

sykaster

joined 1 month ago