https://github.com/davyjonescodes/wireguardnamespace
Create isolated Linux network namespaces optionally routed through WireGuard VPN for sandboxed applications, regional testing, or privacy control.
https://github.com/davyjonescodes/wireguardnamespace
bash namespace networking vpn wireguard
Last synced: about 1 month ago
JSON representation
Create isolated Linux network namespaces optionally routed through WireGuard VPN for sandboxed applications, regional testing, or privacy control.
- Host: GitHub
- URL: https://github.com/davyjonescodes/wireguardnamespace
- Owner: DavyJonesCodes
- License: mit
- Created: 2025-06-09T08:10:26.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-09T08:44:58.000Z (about 1 year ago)
- Last Synced: 2025-06-09T09:26:27.277Z (about 1 year ago)
- Topics: bash, namespace, networking, vpn, wireguard
- Language: Shell
- Homepage:
- Size: 42 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WireguardNamespace
**WireguardNamespace** is a standalone Bash script for setting up isolated Linux network namespaces with optional WireGuard VPN routing. It's ideal for sandboxing applications, routing specific programs through VPNs, or testing in a clean network environment.
---
## โจ Features
- ๐งฑ **Namespace Isolation**: Create isolated network spaces for apps or testing.
- ๐ **WireGuard Support**: Automatically connects VPN via `wg-quick` (if enabled).
- ๐งน **Clean Teardown**: Easily delete namespace, interfaces, and routing rules.
- ๐ท๏ธ **Custom Naming**: Use `--name ` to manage multiple namespaces.
- ๐ซ **VPN Optional**: Use `--no-vpn` for direct internet access without tunneling.
---
## ๐ Usage
```bash
sudo ./WireguardNamespace.sh [--name ] [interface] [--no-vpn] [--teardown]
````
### Arguments
| Option | Description |
| ------------ | ---------------------------------------------------------------- |
| `--name` | Set custom namespace name (default: `vpnspace`) |
| `--no-vpn` | Skip VPN setup (provides regular internet in namespace) |
| `--teardown` | Remove namespace, veth, and NAT rules |
| `interface` | Network interface to use (e.g. `eth0`). Auto-selected if omitted |
---
### โ
Examples
```bash
# Default setup with VPN
sudo ./WireguardNamespace.sh
# Create isolated namespace without VPN
sudo ./WireguardNamespace.sh --no-vpn
# Create a custom namespace called 'research'
sudo ./WireguardNamespace.sh --name research
# Teardown custom namespace
sudo ./WireguardNamespace.sh --name research --teardown
```
---
## ๐ฆ Requirements
* Linux with:
* `ip`, `iptables`, `wg-quick`, `curl`, `jq`
* A valid WireGuard config (default path is `/etc/wireguard/wg0.conf`)
* Root privileges (`sudo`)
---
## ๐ License
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
---
## ๐ค Contributing
Want to improve this script or add new features? Feel free to fork and submit a pull request. Ideas and suggestions welcome!
---
## ๐ฌ Support
Open an issue or email [devjonescodes@gmail.com](mailto:devjonescodes@gmail.com) if you need help or want to collaborate.