# DHCP gets IP address wrong



## ilovelinux (Jan 25, 2021)

I just installed FreeBSD 12.2. I'm trying to set up internet access with an Intel 8260 Dual Band AC wifi adapter. I'm using an Xfinity Technicolor XB6 router from Comcast which has an IP address of 10.0.0.1 and when using DHCP it assigns IP addresses in the form of 10.0.0.x. For some reason the DHCLIENT utility in FreeBSD keeps assuming my router's IP address is 192.168.0.1 and assigns an IP address to my laptop in the form of 192.168.0.x which obviously doesn't get me internet access. Is there any way to fix this aside from using a static IP address?


----------



## im (Jan 26, 2021)

ilovelinux said:


> For some reason the DHCLIENT utility in FreeBSD keeps assuming my router's IP address is 192.168.0.1 and assigns an IP address to my laptop in the form of 192.168.0.x which obviously doesn't get me internet acces


It looks like another DHCP server is working. Try to run the dhclient again.
While working it shows a MAC address of a 2nd DHCP server, if exists.
Try to power-off another equipment within your network and try to run dhclient again.


----------



## SirDice (Jan 26, 2021)

Yep, you have two DHCP servers running on your network. DHCP doesn't get addresses wrong, dhclient(8) sends out a broadcast requesting an IP address, first DHCP server that responds wins. So it's never a good idea to put two DHCP servers on the same network unless they're specifically configured to be each other's backup.


----------



## ilovelinux (Jan 27, 2021)

I found the problem. Even though I specifically specified my NETGEAR06 wifi network for my Comcast router, FreeBSD keeps connecting to my Insignia smart light switch's wifi network which is only used for the switch's initial setup. If I restart the "netif" service then FreeBSD briefly connects to my NETGEAR06 router and then connects to my Insignia smart switch before the "dhclient" utility can get an IP address. This roaming issue doesn't happen under Arch Linux.


----------



## Emrion (Jan 27, 2021)

Instead of complaining what FreeBSD does or doesn't, compared to another OS, you have some possibilities to make things going like you want.

dhclient.conf(5), read "*reject* _ip-address_;".
wpa_supplicant.conf(5), see _priority _and the examples below. Don't know if it will be of some use here.


----------



## Speedy (Jan 27, 2021)

Not sure what's going on here, but some "experts" cripple their AP configuration deliberately.


----------



## scottro (Jan 27, 2021)

If you look at man (5) dclient.conf, there is an option for server name. I've never run into your situation, so this is untested by me.

As for Arch not having the problem, I'm not really familiar with the internals on either system. If this is wireless, you could easily specify the access point though.


----------



## ilovelinux (Jan 27, 2021)

Emrion said:


> Instead of complaining what FreeBSD does or doesn't, compared to another OS, you have some possibilities to make things going like you want.
> 
> dhclient.conf(5), read "*reject* _ip-address_;".
> wpa_supplicant.conf(5), see _priority _and the examples below. Don't know if it will be of some use here.


For some reason my NETGEAR06 network was set to priority 5 during installation, but the point is that FreeBSD or any other OS for that matter shouldn't be connecting to a wifi network unless I explicitly tell it to. The NETGEAR06 network is the only one listed in rc.conf or wpa_supplicant.conf. This is the bug in FreeBSD that needs to be fixed.


----------



## Emrion (Jan 28, 2021)

How can it connect to a wifi network without password? Is this network open?

Anyway, reading wpa_supplicant.conf(5), it shouldn't try to connect to a network that isn't listed in wpa_supplicant.conf. So, if you can reproduce the bug, post all the details to https://bugs.freebsd.org/bugzilla/.


----------



## sko (Jan 28, 2021)

ilovelinux said:


> [...] my Insignia smart light switch's wifi network which is* only used for the switch's initial setup*


Then *WHY* is this (open?) network still enabled??

(And I'm not going to ask why anyone would want a wifi-enabled light switch...)


----------



## shahinco (Feb 11, 2022)

I do have same problem on my Intel NUC i7, After login wifi details FreeBSD DHCP client taking wrong IP addresses.. I don't understand why ?


----------



## grahamperrin@ (Feb 12, 2022)

ilovelinux said:


> For some reason my NETGEAR06 network was set to priority 5 during installation, but the point is that FreeBSD or any other OS for that matter shouldn't be connecting to a wifi network unless I explicitly tell it to. The NETGEAR06 network is the only one listed in rc.conf or wpa_supplicant.conf. This is the bug in FreeBSD that needs to be fixed.



I don't know about `priority`, but this might be of interest: 

FreeBSD bug 256957 – Wi-Fi: rc.conf(5) NOAUTO, ifconfig(8) up and unwanted WLAN connections to open networks


----------

