Wifi IP only works when the LAN cable is also plugged in


 

Jason J

TVWBB Fan
Hi Guys,

I cannot get the wifi on my heatermeter to work on it's own. I have configured it as shown here: https://github.com/CapnBry/HeaterMe...p-via-config-file-step-by-step-easiest-method except that I gave it a static IP (the one the DHCP originally assigned it). It end in .168. Note: I have tried with DHCP and static IP and get the same issue.

If my Lan connection is configured and working with a static ip which ends in .189. When the lan cable is plugged in, I can ping .164 and access it via a browser. As soon as I disconnect the lan cable and reboot the heatermeter, I cannot ping or connect to .164

When the lan cable is connected, I can look at the properties of the wwan interface in heatermeter and get:

Uptime: 0h 7m 50s
MAC-Address: 80:1F:02:D3:A9:C7
RX: 152.63 KB (1210 Pkts.)
TX: 510.00 B (5 Pkts.)
IPv4: XXX.XXX.X.164/24

So it looks like it is sending and receiving. This is very odd! Anyone know what is going on here?
 
Does your wifi router show the HM wireless device connected? You may try turning off wifi security for a moment and see if the HM connects via wifi then. On my last build I couldn't get the wifi to work until I dropped security on the router, then it connected and worked, after I enabled the wifi security again the HM still connected... Odd, but that's what happened to me.
 
Does your wifi router show the HM wireless device connected? You may try turning off wifi security for a moment and see if the HM connects via wifi then. On my last build I couldn't get the wifi to work until I dropped security on the router, then it connected and worked, after I enabled the wifi security again the HM still connected... Odd, but that's what happened to me.

So odd. I disabled the network protection. I switched the interface back to dhcp. It get a new ip of .166. It shows up on the router network map. I cannot access it or ping it. It ONLY starts working once the LAN is connected.
 
You can't have an IP for the ethernet on the same subnet as the wifi adapter. For some reason despite the wired link being disconnected, it remains the primary interface for the subnet due to how the routing table is built. This is true for any Linux system, but I think on desktop distributions, the a network manager app does something to jigger the routes as the link goes up and down? I'm not sure how this works normally, but I believe it works just as poorly under Raspbian.

If you just look at `ip route list table main` you'll see that even though the eth0 link never came up, it has a routing entry above the wlan0 entry causing traffic out to go through that. If you run tcpdump at the device, it actually will see traffic coming in wlan0 but will send replies out eth0 (well, it will arp on eth0 looking for the address to reply to).

EDIT: This RedHat article seems to indicate you can get it to work if you add "from" statements to your route tables but it might require the tables to be broken up by interface? I don't know it is getting too complicated for me. It might be easier to just add a static routes to translate to/from 192.168.200.0/24 and just reach the wired ethernet interface on the Pi via the fallback address, and turn your static assignment back to DHCP.
 
Last edited:

 

Back
Top