this post was submitted on 20 Jun 2024
25 points (87.9% liked)
Programming
17424 readers
25 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Do you have a link at hand on how start a process within a specific veth by chance? Own name spaces are easy enough and a lot of tutorials but I don't want my programs to ever be not in the vpn space, not at startup not as fail over etc.
That's the reason why I stuck with the container setup, only for gluetun plus vpned services.
That sentence doesn't make any sense.
Processes run in network namespaces (netns), and that's exactly what
ip netns exec
does.A newly created netns via
ip netns add
has no network connectivity at all. Even (private) localhost is down and you have to runip link set lo up
to bring it up.You use
veth
pairs to connect a virtual device in a network namespace, with a virtual device in the default namespace (or another namespace with internet connectivity).You route the VPN server address via the netns veth device and nothing else. Then you run wireguard/OpenVPN inside netns.
Avoid using systemd since it runs in the default netns by default, even if called from a process running in another netns.
The way I do it is:
ip netns exec
):I have this in my tmux config:
So I always know which socket a tmux session is running on. You can include network info there if you're still not confident in your setup.
Now, I can detach that tmux session. Reattaching with
tmux -L NS_AA attach
from anywhere will give me the session still running inAA
.Yeah I had a brainfart, meant namespace...
And thanks a lot for this writeup I think with your help I figured out where I went wrong in my train of thought and I'll give it another try next week when I have a bit downtime.
The time you took to write this is highly appreciated! ♥