27 lines
1.0 KiB
Markdown
27 lines
1.0 KiB
Markdown
---
|
|
tags:
|
|
- Scirpts
|
|
- Desktop
|
|
- Wireguard
|
|
---
|
|
# WireGuard Activation Script (`wg-up.sh`)
|
|
|
|
This script initializes and activates the configured WireGuard tunnel using `wg-quick`. **Always ensure you have appropriate network permissions (sudo) to run this.**
|
|
|
|
## Execution Steps
|
|
|
|
To bring the WireGuard interface online, execute the following command in a privileged shell session:
|
|
|
|
```bash
|
|
sudo wg-quick up wg0
|
|
```
|
|
|
|
### Verification
|
|
|
|
After running this script, verify the connection status and IP assignment using:
|
|
|
|
* **Check Tunnel Status:** `wg show`
|
|
* **Verify Connectivity:** Attempt to ping an internal service endpoint.
|
|
|
|
> [!NOTE] Modernized Workflow
|
|
While using `sudo wg-quick up wg0` is functional, for system-level automation or service management (e.g., in Docker/Kubernetes), it is best practice to define a corresponding **systemd unit file**. This ensures the connection attempts to start automatically on boot and can be managed via `systemctl status`, providing robust logging and dependency handling beyond simple script execution. |