5
submitted 12 hours ago* (last edited 12 hours ago) by MoogleMaestro@lemmy.zip to c/linuxquestions@lemmy.zip

I have an oddly-specific networking question that I'm hoping to get solved (and would like to have Lemmy be the home of the solution, in case I stumble upon this myself.)

I have a device that needs to "phone home" on a weekly basis. This device needs to have a static IP in order to be "valid". On windows, I usually can get it to work by starting openvpn, plugging in the external device in question and "routing that" through Openvpn. You do this by simply connecting the external nic and then right click on the nic in the control panel and set the "Allow other network users to connect through this computer's internet connection" along with assigning the external device to the OpenVPN connection. This routes all internet packets from X device to the internet via the OpenVPN connection without a major problem. I should note that it's extremely fickle, and it hurts my ability to remote in the machine on occasion, so I'm looking to change it.

What I'd like on my linux system is to simulate the same setup, but with 1) a permanent "connection" to the openvpn end point that is always available but not used by most networking tasks on the computer (for example, browser will use standard ethernet connection) and 2) The external nic will automatically route itself through the OpenVPN server, acting as a "router" for a (singular) external device that needs to access the internet.

Is this possible? Are there any guides for setting up this kind of complex network setup? Is it possible to do without going crazy and making my computer a full-blown router (like, doing DHCP work and the like)?

you are viewing a single comment's thread
view the rest of the comments
[-] moonpiedumplings@programming.dev 2 points 4 hours ago

Yes it should be possible, although somewhat challenging.

If this device acts an an ethernet interface that is behind windows, then you are probably going to want:

  • Create a network namespace
  • Put an openvpn in that network namespace (and have that be the only route out)
  • Put the ethernet interface in that network namespace as well

This is the first solution I can think of, off of the off my head, provided that the external device is actually pretending to be a network interface you are connecting.

In addition to that, you will likely have to create a custom service to recreate this setup on boot. The tools for managing linux firewalls and network namespaces independently of abstraction layers aren't great.

Alternatively, if you are actually running an app that is connecting to that device via USB or the like, you can run that app within a network namespace to force traffic through the VPN. But the steps and solution would be similar.

this post was submitted on 18 May 2026
5 points (100.0% liked)

Linux Questions

3921 readers
6 users here now

Linux questions Rules (in addition of the Lemmy.zip rules)

Tips for giving and receiving help

Any rule violations will result in disciplinary actions

founded 2 years ago
MODERATORS