0

I want to run "megatools" with a vpn. The problem is it has to be ONLY megatools. I googled multiply hours and found a concept where I have a new user and every packet sent by this user gets marked with iptables and then routed to the network interface tun1 (the vpn).

Some guy on askubuntu tried to help me get this working, but I am not planning to study these iptables. His explaination was not clear enough and I dont think he does like my question at all.

I have added a command to my ovpn config so that the network adapter won't get set to default when connecting.

Is there no option to use the network interface for a specific user or service, other than marking packets and then routing them? System: raspberry pi with raspbian

3
  • 1
    On a new kernel the routing code can also decide base on the uid of the process. Does this article answer your question: Jailing specific processes inside a VPN? Jan 20, 2020 at 23:05
  • omg. yes. I mean I had to realize that my rpi does not have the new iproute2 version in the repository but at the end it worked. I now have a user that uses the vpn and one that uses my home ip. Do you want to repost your comment as a answer, or should I do that? Jan 21, 2020 at 18:14
  • You can answer the question. Jan 21, 2020 at 18:22

1 Answer 1

1

Piotr P. Karwasz solved this issue.

The link he directed me to explained everything, and had all commands listed.

Now the problems I had to go through (maybe you have similar ones):

  1. When I added the two scripts to my .ovpn I had to change the execution permissions. This confused me at first because I was running the .ovpn as root.

  2. I had to change $route_vpn_gateway to the Gateway found out with "route -n".

  3. Removing "while ; do :; done" fixed a weird error message, but it worked both ways.

  4. And now ipoute2 itself. After getting weird issues that the argument "uidrange" isn't valid, I found out that iproute2 was outdated. The default repository on RaspBian wasn't including 4.12.0; the version that does add "uidrange". After putting the debian repository on the apt list and upgrading everything, it finally worked.

I hope you don't spend as much time with this as me. Have a nice day!

Not the answer you're looking for? Browse other questions tagged .