Skip to content

First Version of a Programm to auto reconnect a wireguard connection on Linux

License

Notifications You must be signed in to change notification settings

platofan23/python_wireguard_auto_reconnect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python_wireguard_auto_reconnect

Description of the project

This Python program checks if a wireguard connection is still alive and restarts if the connection is lost.
The programm is constantly pinging the vpn-gateway.
If the ping is a successful the programm goes to sleep for a 30 seconds and than pings again.
If the ping fails the programm restarts the wireguard connection and than pings again. After 50 failed tries the programm is timeouted for 30 minutes.

Project status

The project itself is complete and ready for use. I am open for improvments.

Requirements

Requirements for running the webui are: - python (3.x.x)
- pip (v3) or any other packetmanager
- pythonping

Installation

1. Download and Install Python.
For windows go to (https://www.python.org/downloads/)
For linux use sudo apt-get install python3.x
2. Download and install pip-packetmanager
3. Install pythonping
For Windows py -3 -m pip install pythonping
For Linux pip3 install pythonping
4. Now run the Wireguard_Reconnect.py - File For Windows py -3 Wireguard_Reconnect.py
For Linux python3 Wireguard_Reconnect.py

Additional notes:

- If you want to use it on another operating system you only have to change the line "os.system('sudo wg-quick down wg0')" and "os.system('sudo wg-quick up wg0').
- Other values like the timeouts can be adjusted as well.
- The program must always be run with elevated privileges because of the package pythonping.

About

First Version of a Programm to auto reconnect a wireguard connection on Linux

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages