Solved Troubleshooting wlan0

Hi,

I am looking for help understanding my wireless network interface. At home, wlan0 always connects to wifi, gets an address, and I can surf the web. However this last week I have been on a trip and connecting to different APs by editing wpa_supplicant.conf, entering the new SSID and psk, and then doing service netif restart.
- the wifi network is connected because I see the SSID in ifconfig wlan0 and I am assigned an IP address
- I can ping the router at 192.168.1.1
- I cannot ping the outside internet: I try ping 1.1.1.1 and I get network is down

Here is my rc.conf for wlan0 and my lagg0 interface (em0 omitted):
Code:
wlans_iwm0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"
cloned_interfaces="lagg0"
ifconfig_lagg0="up laggproto failover laggport em0 laggport wlan0 DHCP"

And now the weirdest part: after some time, the internet connection will randomly begin working. So, it seems like something is timing out and refreshing, or cache expiring. But I have no idea where to look.
 
I would assume it's not a good idea to run a dhcp client on both the wlan and lagg interface…

But then, being able to ping some router sounds like your wifi works ?
 
then doing service netif restart.
If you do this you also need to run service routing restart.

I can ping the router at 192.168.1.1
If that address is on a directly connected network you don't need routing to access it.

I cannot ping the outside internet: I try ping 1.1.1.1 and I get network is down
No, you cannot ping outside your directly connected network. You either don't have a (default) gateway or the gateway is refusing to forward the traffic.

Troubleshooting network connections is fairly easy, just follow some basic steps.

  • Check ifconfig wlan0. Is the interface associated or not? This would indicate an issue with WPA/WPA2.
  • Does the interface have an IP address or not. This might indicate a problem with DHCP.
  • Look at netstat -rn. Did you get a default gateway? If using DHCP you should get a default gateway from DHCP.
  • ping(1) the default gateway. Then ping something beyond that gateway (like 8.8.8.8). Some networks won't allow you direct access to the outside world, you may need to configure a proxy for browsing.
  • check /etc/resolv.conf, try to resolve something using host(1) or drill(1). This would indicate DNS issues.
 
I should add that some more time will go by, and then the internet connectivity vanishes again, and I lose the ability to ping 1.1.1.1 again.
 
I should add that some more time will go by, and then the internet connectivity vanishes again, and I lose the ability to ping 1.1.1.1 again.
Your lagg(4) failover might be switching back and forth between wired and wireless. This would cause your MAC address to change from the router's point of view.
 
If you do this you also need to run service routing restart.


If that address is on a directly connected network you don't need routing to access it.


No, you cannot ping outside your directly connected network. You either don't have a (default) gateway or the gateway is refusing to forward the traffic.

Troubleshooting network connections is fairly easy, just follow some basic steps.

  • Check ifconfig wlan0. Is the interface associated or not? This would indicate an issue with WPA/WPA2.
  • Does the interface have an IP address or not. This might indicate a problem with DHCP.
  • Look at netstat -rn. Did you get a default gateway? If using DHCP you should get a default gateway from DHCP.
  • ping(1) the default gateway. Then ping something beyond that gateway (like 8.8.8.8). Some networks won't allow you direct access to the outside world, you may need to configure a proxy for browsing.
  • check /etc/resolv.conf, try to resolve something using host(1) or drill(1). This would indicate DNS issues.
Thank you for these comprehensive steps. I do see that the interface is associated. I have an IP from DHCP. Attached is a photo of netstat which seems to indicate that the default gateway is correctly set to the router. I can ping the default gateway. But no addresses beyond it.
 

Attachments

  • 9A6E8B6F-CE31-418E-8CEE-D6A9B54B733F.jpeg
    9A6E8B6F-CE31-418E-8CEE-D6A9B54B733F.jpeg
    338.7 KB · Views: 218
But no addresses beyond it.
You might be on a network that doesn't allow workstations or other devices direct access to the internet. If it's on your own (home) network then you might want to have a look on your modem/router as that seems to block the traffic.
 
Your lagg(4) failover might be switching back and forth between wired and wireless. This would cause your MAC address to change from the router's point of view.
I think this is a good notion.... I manually deleted my lagg0 interface, commented out the lagg0 lines in rc.conf and restarted netif. wlan0 connected to the internet right away and is still going, which is a good sign.
 
There's an example in the handbook that shows how to use lagg(4) to automagically switch between wired and wireless. But one of the key instruction sets the MAC address of the wired and wireless interfaces the same. When you don't have it your IP address would switch MAC addresses, that could cause your router to lose track of the host that has that IP address (ARP table might timeout).
 
here is the em0 portion of my rc.conf

Code:
ifconfig_em0="DHCP"
ifconfig_em0_ipv6="inet6 accept_rtadv"
ifconfig_em0="ether xx:xx:xx:xx:xx:xx"

I wonder if I have made a syntactical error by setting the variable ifconfig_em0 twice, thereby failing to set the wired mac address to be the same as the wireless mac address, thereby causing the mac-switching and confusing the router.
 
I wonder if I have made a syntactical error by setting the variable ifconfig_em0 twice, thereby failing to set the wired mac address to be the same as the wireless mac address, thereby causing the mac-switching and confusing the router.
You've definitely made a mistake there. But it's the last setting that prevails, not the first. rc.conf is just a shell script that only contains variables. So the second definition overruled the first.

Code:
#!/bin/sh

FOO="bar"
FOO="not bar"

echo $FOO

If you want to use lagg(4) then the DHCP should be done on the lagg(4) interface, not the individual (physical) interfaces (em0 and wlan0 in your case).
 
My initial assumption was two dhclients "fighting" ;) shouldn't router advertisements also be handled by the lagg interface only?
 
shouldn't router advertisements also be handled by the lagg interface only?
For IPv6? I suspect so. Never tried it with IPv6. But yes, my assumption would to place the whole IP settings to the lagg(4) interface, not the individual (member) interfaces.
 
Here's my cleaned-up rc.conf

ifconfig_em0="ether xx:xx:xx:xx:xx:xx" ifconfig_em0_ipv6="inet6 accept_rtadv" wlans_iwm0="wlan0" ifconfig_wlan0="WPA" cloned_interfaces="lagg0" ifconfig_lagg0="up laggproto failover laggport em0 laggport wlan0 SYNCDHCP"

connectivity feels like its behaving normally.
 
Back
Top