Jump to content
Not connected, Your IP: 3.137.167.53
Omniferum

ANSWERED Blocking non-VPN traffic with Windows Firewall

Recommended Posts

I have tweaked the backup function so you don't actually have to press Y or N.

 

There is an error in my script that I have fixed (was something I never really tested properly).

 

Use the updated script in the first post.

 

Works perfectly!!!

 

Thanks!!

Share this post


Link to post

 

I have tweaked the backup function so you don't actually have to press Y or N.

 

There is an error in my script that I have fixed (was something I never really tested properly).

 

Use the updated script in the first post.

 

Works perfectly!!!

 

Thanks!!

 

How hard would it be to change the script to allow certain connections (say Plex remote) to use a non VPN route, while everything is else remains routed through the VPN? Is it just a firewall rule?

 

Thanks!

Share this post


Link to post

This depends on how many different addresses your service uses. Best way to estimate

would be connecting to the service from a clean machine and inspecting the outgoing connections.

 

My plex server resides on the same machine running the vpn and is accessible through a defined port. The various clients could be at any random address, depending on which network they are on. The problem is that directing the traffic from plex through the VPN does not provide enough bandwidth for streaming at 10+ Mbps.

 

Couldn't any outbound connection coming from the specified port be directed through a non-vpn route?

Share this post


Link to post

You can just add an 'allow' rule for the .exe to do whatever it likes or limit its IP/PORT access. The windows firewall does allow for program-specific configurations.

 

MAIN SCRIPT HAS BEEN UPDATED BECAUSE I MADE A STUPID MISTAKE.

 

I've made this as idiot-proof as possible now and, well, I doubt there are really gonna be anymore updates.

 

Still working rock solid for me.

 

Hope it is still out there helping people.

Share this post


Link to post

Hey,

 

There is something that I really cant figure it out how to solve... How to block all non-VPN traffic if I choose to connect to internet via a 3G USB modem (aka 3G/4G dongle)? The AirVPN client's default Network Lock can't block it neither. Any help and suggestions would be highly appreciated.

 

By the way, thank for a great script - works flawless for ethernet connections.

Share this post


Link to post

I suspect the problem is this line: wmic nic where PhysicalAdapter=TRUE get netconnectionid /format:csv

 

wmic nic where PhysicalAdapter=TRUE get netconnectionid /format:csv -> wmic nic get netconnectionid /format:csv

 

Basically if you remove this exact string (it occurs twice in the script, remember to change both!): PhysicalAdapter=TRUE

 

You can just search/replace in any text editor.

 

Please note that it is a suggestion and not a concrete answer as don't know what else your 3g modem does. If it has its own connection software then maybe there is an issue there but my guess is the best I could make given my skills and knowledge.

Share this post


Link to post

Actually if that suggestion DOESN'T fix it I would appreciate the output of the following command pasted here so I could check.

 

wmic nic get netconnectionid /format:csv

 

You can copy and paste that into any command window.

Share this post


Link to post

Hello! I've faced with error while running script. Could you please be so kind and give advise how to fix this problem ?

 

log from script is bellow

 

Sanitizing and configuring your network adaptors

------------------------------------------------
 
­apter... '­apterdnsprimary primary validate' is not a valid argument for this command.
The syntax supplied for this command is not valid. Check help for the correct syntax.

Share this post


Link to post
Posted ... (edited)

Hello, thanks for your work. 
I am trying to set up this on my win 11 pc and the switch works but not 100%. 
I have followed instructions precisely, made a openvpn folder and placed AirVPN_Europe_UDP-443-Entry3.ovpn and AirVPN_Europe_TCP-443-Entry3.ovpn in there.
I have tried various combinations, only tcply udp, only countries allowed by eddie tcp, udp, tcp and udp, but the problem is still here.

The problem is following:
When the switch is on i have connection but only via the server that was setup in eddie in that time, but i cant change vpn server in eddie it is just stuck at changing.
Then i cant connect to internet , i must make a few steps to get the vpn back, as it not works at that time.
So i turn off the script and i have internet but the vpn is not working. I must disable network lock and turn on and off the script, and eddie on and off a few times to get eddie to connect again. 

Is the script working as it should or am i missing something?
Sorry if my english is bad, it is not my native language.

Edited ... by Mgm84bd

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Security Check
    Play CAPTCHA Audio
    Refresh Image

×
×
  • Create New...