A Python script that monitors internet connectivity and automatically reboots your network via its admin portal if a connection issue is detected. Designed to run 24/7 on a computer connected to a Virgin Media network.
Routers can sometimes lose internet connectivity even when everything appears normal. This script periodically pings a WAN address, and if no connection is detected, it reboots your router (designed for the Virgin Media Hub 5). Feel free to modify the code to support other routers - contributions are welcome! 💙🧑💻
- A computer that can run continuously on your network.
- Python 3.7 or higher.
- The
requestspackage (install withpip install requestsorpip install -r requirements.txt). - Supported router:
- Virgin Media Hub 5 (router or modem mode)
- Gateway IP address and router admin credentials.
- Run this on a device connected via Ethernet.
- Avoid deploying on networks or devices you can’t physically access to prevent accidental lockouts.
- Logging is disabled by default; enable it for troubleshooting if needed.
- Use this tool only on networks you are authorised to manage.
- Verify your
config.jsonsettings to avoid unintentional reboot loops.
- Install dependencies:
or
pip install requests
pip install -r requirements.txt
- Run the script:
python main.py
- First-time setup:
If noconfig.jsonis found, you’ll be guided through a setup wizard to create one. You can edit or delete this file later to reconfigure the program.
- Gateway IP Address: Typically for vigin media hub 5
192.168.0.1(or192.168.100.1in modem mode). - Admin Password: Found on your router or accompanying documentation/ Passwords vary per device.
- No Data Collection: The script solely pings to check connectivity and never collects or transmits personal data.
- Optional Local Logging: Debug logs are stored locally and remain off by default.
- Minimal Dependencies: Only relies on the
requestspackage; all other libraries are built into Python. - User Configurability: All network check targets and credentials are fully configurable via
config.json. - Open Source: The full source code is available for review, ensuring complete transparency.
- No data is collected or transmitted.
- Logging is optional and local.
- Minimal dependencies and full configurability.
- Open source for complete transparency.