1

Short question: How can you make only one specific program run off wlan0 and leave everything else to run off the ethernet?

Long question: I've been using my Raspberry Pi for a while now and I love it! One of it's major uses is running homebridge. However, I would really like to use it for a few more things that require a stronger network connection in the form of ethernet. To cut short, whilst homebridge works perfectly when there is no ethernet plugged in, the second the ethernet is plugged in it stops working. Furthermore, when I reset homebridge and re-add it, it only works for about 30 minutes before cutting out once again. To clarify, everything else works perfectly on ethernet such as SSH, Remote Desktop etc. Also, I have done some digging around on forums to try and find a solution both to the homebridge problem but also on how to do what I've asked but I couldn't find anything that worked for me. Therefore, would love to find out if there is a way of having the ethernet plugged in but have only homebridge ignore it and use wlan0 instead? Is there a simple prefix that can be added to the usual homebridge command to do this or is it a little bit trickier?

Thank you in advance for any help,

Kind regards, Tom

  • Routing is not enough to pull it off (even using separate routing tables, which is provided out of the box with iproute2)? – eftshift0 Aug 7 '18 at 0:27
  • @eftshift0 Thanks for your response! That's a shame; any ideas come to mind that might work? Would you be able to point me in the right direction? – Tom Aug 7 '18 at 0:44
  • 1
    Well.... I was just asking you if using iproute2 was not enough. Playing with different routing tables could be an option. You can set up traffic to use a separate routing table that sends traffic through wlan, for example. linux-ip.net/html/routing-tables.html – eftshift0 Aug 7 '18 at 14:41
1

Raspberry pi kernel supports network namespaces, so you can start your program in a separate network namespase using ip netns. If you only set up wlan0 in that namespace, your program won't have a choice.

Prior to namespaces support, the standard solution was to create a special user which would run the program, and define a routing table entry which redirects the traffic of that user to a different network interface. Or, if homebridge always uses the same port, you can redirect its traffic based on the port number. I suppose this is what @eftshift0 refers to in his comment. It's still a viable option if you're more familiar with routing than namespaces.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.