B4J Question B4J select ethernet connection

gpa

Member
Licensed User
Longtime User
Hi...
I have a app running fine on rpi zero 2. It sends data over wlan0 no problems.
However - if I connect a local ethernet connection (via usb0) then my app tries to send data that way instead of over wlan0.
But that's just a local connection and has no internet access.
I altered the route metrics so wlan0 is much lower than usb0 but that didn't fix it.
Ideally I'd like to select the interface to use for internet access programatically - is that possible in b4j?

Thanks....
 

MicroDrie

Well-Known Member
Licensed User
Not only the metrics are important when choosing a route. If a lower metric is not enough, you can specify a specific interface for the route. With the command route print you can find the number of the preferred interface, for example 2. Then you can add an IF 2 to the default route at the end.
example route
Change preferred interface:
route CHANGE 192.168.1.0 MASK 255.255.255.0 192.168.1.1 METRIC 2 IF 2
 
Upvote 0
Top