>>106189344
>NetworkManager
There is no networkmanager on my system
>Show us
First you set up a namespace with a working internet connection
namespace="vpn"
wan="wan0"
veth1="veth1"
veth0="veth0"
ip netns add $namespace
ip link add $veth0 type veth peer name $veth1
ip link set $veth1 netns $namespace
ip addr add 10.200.1.1/24 dev $veth0
ip link set $veth0 up
ip netns exec $namespace ip addr add 10.200.1.2/24 dev $veth1
ip netns exec $namespace ip link set $veth1 up
ip netns exec $namespace ip link set lo up
ip netns exec $namespace ip route add default via 10.200.1.1
Then routing, I think you also needed to flip some bit in some sysfs directory to allow forwarding, google that yourself
iptables -t nat -A POSTROUTING -s 10.200.1.0/24 -o $wan -j MASQUERADE
iptables -A FORWARD -i $wan -o $veth0 -j ACCEPT
iptables -A FORWARD -o $wan -i $veth0 -j ACCEPT
If you want your namespace to still access localhost, eg for unbound DNS server
ip netns exec $namespace ip route add 192.168.0.0/24 dev veth1 via 10.200.1.2
Then just run
ip netns exec $namespace wg-quick up wg0
And the namespace is VPN'd. Anything you run prefixed with "ip netns exec vpn" is vpn'd