gsmnetworkmanageriprouteraspbian-buster

Configuring NetworkManager to route local wlan data over WiFi for debugging when cellular connection is active


Hi this is on Raspbian buster and NetworkManager 1.10.0 but it is a network manager question mostly I think.

My application has a Wifi and a cellular network connection. When I am debugging I use Wifi (SSH to my computer) but I want the application to use cellular for MQTT and telemetry data.

I can adjust the route metric for my cellular connection so it higher priority than the WiFI but what happens to debug data intended for my computer? I want this to still be over WiFi. Does the routing fall back to Wifi interface for 192.168.x.x. I have attached a print of my default IP routes with both connections active.

IP routes with both Wifi and ppp active

Do I need to go into my Wifi connection in NM and add a route that is something like:

destination gateway Genmask Flags Metric Ref Iface 192.168.0.0/16 192.168.0.1 0.0.0.0 UG 100 0 0 wlan0 192.168.0.0 192.168.0.0/24 255.255.255.0 U 100 0 0 wlan0

I am just learning about routing so be kind. Thanks in advance!!!


Solution

  • Route metric is the easiest and simplest way to achieve what I wanted.

    I left my wifi connection profile in network manager as the default ipv4.route-metric value. I went into my cellular connection profile and changed the ipv4.route-metric to 500 which was higher priority than the wifi connection (it was 600).

    I used ip route get <external network IP addr> and ip route get <local 192.168 addr> and both returned the routes I expected when both connections were active