You are not logged in.

#1 2022-09-13 23:21:02

TheDcoder
Member
Registered: 2020-06-06
Posts: 121
Website

How to setup a network namespace connected to a VPN to run programs?

Hello,

My goal is to run certain programs (like my IRC and torrent clients) under a VPN (most likely OpenVPN) while the rest of the traffic on my system goes through the network as usual. I have tried to use vopono but I'm currently unable to get it working properly in a configuration which satisfies me, see the issue I created for more info.

Ideally I want to be able to create discrete systemd units for the namespace as well as the programs I want to run under that namespace which routes all traffic through a VPN.

I know that I can use Docker etc. to create a whole new OS environment but I really don't want to do that. I just want something that I can use directly on my system.

I've tried to figure out how to do this but my network knowledge is very rudimentary so I'm confused, so please guide me through this process.

Thanks in advance!

Offline

#2 2023-01-16 03:45:31

TheDcoder
Member
Registered: 2020-06-06
Posts: 121
Website

Re: How to setup a network namespace connected to a VPN to run programs?

Discussion from IRC for reference:

[08:49:07] <Edu4rdSHL> TheDcoder, ip netns will help you
[08:50:37] <TheDcoder> Edu4rdSHL: I tired to understand name spaces but it kind of went over my head, lol
[08:50:58] <TheDcoder> So I need more info that I can digest
[08:51:44] <Edu4rdSHL> TheDcoder, here's a simple tldr https://linuxhint.com/use-linux-network-namespace/
[08:51:45] <phrik> Title: How to Use Linux Network Namespace (at linuxhint.com)
[08:52:17] <Edu4rdSHL> You can even run your vpn directly on the network namespace and just run the programs there with ip netns exec $network_namespace $command

Offline

#3 2024-02-10 18:18:54

TheDcoder
Member
Registered: 2020-06-06
Posts: 121
Website

Re: How to setup a network namespace connected to a VPN to run programs?

I just found an article on the internet which literally addresses this exact question!

https://kitsunemimi.pw/notes/posts/putt … a-vpn.html

I will try it soon and report back if there are any issues smile

Offline

#4 2024-09-04 00:35:25

brauliobo
Member
Registered: 2008-07-29
Posts: 21

Re: How to setup a network namespace connected to a VPN to run programs?

Offline

Board footer

Powered by FluxBB