# Automate Up Route Add Whenever it's Removed: A Solution for Seamless Wireguard VPN Experience with NordVPN
As a remote worker, having a reliable and secure connection to your home network is crucial. Wireguard VPN offers an excellent solution, but setting up a proper routing configuration can be a challenge. In this article, we'll explore the issue of automating the addition of routes after NordVPN disconnects, and provide potential solutions to overcome this problem.
### The Problem
When connected to the Wireguard VPN, your virtual IP address is 10.0.0.2/24, while LAN devices are assigned 192.168.8.x addresses. However, reaching the server through NordVPN requires manual intervention, as the route needs to be added using the command `sudo ip route add 10.0.0.0/24 via 192.168.8.1`. The current setup involves running a script or service on startup to add this route, but it fails when NordVPN reconnects.
### Workarounds and Challenges
To mitigate this issue, one workaround is to use SSH to connect to another device on the LAN once connected to Wireguard, then run the IP route command. This hack may not be ideal, as it introduces additional latency and potential security risks.
An alternative solution involves using a bash script, like `net-o-matic`, which monitors the connection and takes action when it drops. However, adapting this script to trigger on specific events detected by `ip-monitor` requires careful configuration and testing.
### Potential Solutions
To automate the addition of routes after NordVPN disconnects, consider the following approaches:
#### 1. Using `iptables` and `script`
Create a service or crontab that runs a script on startup, which uses `iptables` to add the route when the VPN is down. When reconnecting to Wireguard, run another script that deletes the temporary route and adds it again using `ip route`.
#### 2. Implementing Route Monitoring with `watchdog` and `route-notify`
Use tools like `watchdog` to monitor the VPN connection and notify your system when it drops. Then, use `route-notify` to automatically add the necessary routes.
#### 3. Modifying NordVPN's Configuration
If possible, reach out to NordVPN support to see if they can provide an API or command-line interface to manage their configuration, allowing you to automate route additions and deletions.
### Conclusion
Automating route additions after NordVPN disconnects requires creativity and experimentation with existing tools and scripts. By understanding the underlying routing mechanisms and using a combination of techniques like `iptables`, `watchdog`, and `route-notify`, you can create a seamless Wireguard VPN experience even when connected to NordVPN.
**Additional Resources**
* [Net-O-Matic GitHub Repository](https://github.com/waltinator/net-o-matic) * [IP Monitor Documentation](https://manpages.ubuntu.com/manpages/bionic/man1/ip-monitor.1.html)
Note: This article is written as a detailed and engaging explanation of the original content, with added sections and suggestions for potential solutions. The HTML format provides better readability and makes it easier to navigate through the article.