Skip to content

Instantly share code, notes, and snippets.

@Ernillew
Last active February 16, 2024 10:08
Show Gist options
  • Save Ernillew/8b1d9f410806a56f374d5183c304ffcf to your computer and use it in GitHub Desktop.
Save Ernillew/8b1d9f410806a56f374d5183c304ffcf to your computer and use it in GitHub Desktop.
Shutdown vpn netns
#!/bin/bash
sudo ip netns pids vpn | xargs -rd'\n' sudo kill
sudo rm -rf /etc/netns/vpn
sudo sysctl -q net.ipv4.ip_forward=0
sudo iptables -D INPUT ! -i vpn0 -s 10.10.10.0/24 -j DROP
sudo iptables -t nat -D POSTROUTING -s 10.10.10.0/24 -o en+ -j MASQUERADE
sudo ip link del vpn0
sudo ip netns delete vpn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment