# FreeBSD 13.1 Networking Conundrum



## blackhaz (Jul 14, 2022)

Please help me make sense out of this. I was a happy camper with FreeBSD until I upgraded to 13.1. So, the situation:

- Thinkpad X1 Yoga 1st Gen. 

- Built-in WiFi adapter (wlan0) running on iwm - supports only 802.11a/g. I can live with prehistoric ~ 10 Mbps speeds, but both modes loose connectivity to the AP (Virgin Broadband Wi-Fi router) from time to time, begin to loose packets or show 3000 ms pings - while all other devices in the house (Macbook, T400 running Linux, T430 on Windows) have absolutely zero issues. This almost never happened on 12.X, I just got slow speeds.  

- Bought a TPLink USB Wi-Fi adapter (wlan2) running rtwn - exactly the same story as with the wlan0.

- Bought an Ethernet USB dongle (ue0). Relevant /etc/rc.conf lines: 

```
# NICs 
wlans_iwm0="wlan0"
create_args_wlan0="-ht"
ifconfig_wlan0="WPA DHCP mode 11a"
ifconfig_ue0="up"
ifconfig_ue0="inet 192.168.200.30 netmask 255.255.255.0"
defaultrouter="192.168.200.1"
wlans_rtwn0="wlan2"
ifconfig_wlan2="WPA DHCP"
```
What happens here is that the defaultrouter setting is completely ignored. I have "no route to host". Then, ue0 never gets IP address on start. Every time I have to manually use ifconfig to bind an IP address to it, as if the inet setting is ignored. I tried with the "up" line and without it, it's the same. I also have to create a route manually every time. Never happened on 12.X.

Any ideas what am I doing wrong?


----------



## SirDice (Jul 14, 2022)

blackhaz said:


> What happens here is that the defaultrouter setting is completely ignored.


It's not ignored, it gets overruled by DHCP. As you have two interfaces, both doing DHCP, you can get a back-and-forth between the two DHCP settings. So wlan0 does a DHCP request, gets an IP and a default gateway, then wlan2 does a DHCP request and gets an IP and a default gateway. That second received gateway is going to overwrite the gateway from the first DHCP request. Then wlan0 does a DHCP renew, which would set the gateway to whatever it receives, then wlan2 does a renew and overwrites that gateway again. So your default gateway keeps changing and will be set to the last successful DHCP request or renew.

If both wlan0 and wlan2 are on the same network you'll get two interfaces with the same subnet, which is going to cause other issues (which interface should it use to access that subnet?). Two or more interfaces in the same subnet is going to make routing very problematic.


----------



## blackhaz (Jul 14, 2022)

SirDice, thank you. This makes sense.


----------



## SirDice (Jul 14, 2022)

You should be able to configure dhclient(8) to ignore the gateway, or at least only request an IP and subnet mask and ignoring any of the other options. 

But you still need to watch for multiple interfaces in the same subnet. That's generally a bad idea.


----------

