wireless doesn't work when ethernet is configured with static ip

So, I have a FreeBSD host. Currently, its ethernet port is only connected to an ethernet switch (no DHCP server on that network) and the wifi is correctly configured and works.
Here's the /etc/rc.conf that works:
Code:
# Ethernet
ifconfig_re0="DHCP"
ifconfig_re0_ipv6="inet6 accept_rtadv"

# WiFi
wlans_ath0="wlan0"
ifconfig_wlan0="WPA DHCP"


Here's the /etc/rc.conf that doesn't work:
But, as soon as I try to change the ethernet port to use a static IP address and reboot, the wifi stops working.
Code:
# Ethernet
ifconfig_re0="inet 10.10.10.1/24"

# WiFi
wlans_ath0="wlan0"
ifconfig_wlan0="WPA DHCP"

What am I missing?
Thanks



P.S. I've posted the same question on stackexchange: https://unix.stackexchange.com/ques...rk-when-ethernet-is-configured-with-static-ip
 
For start defaultrouter in /etc/rc.conf pointed at "default router" address for static address e.g.
Code:
defaultrouter="192.168.0.1"
But I don't bet it'll be enough to fix your problem. Anyway start with that one, let's what will happen and report back.
 
I've added information in Stackexchange's question. I'll post more details here later. But it boils down to:

When I switch interface re0 to use static IP instead of DHCP, the interface wlan0 goes from status "associated" to "no carrier".

vigole Yup, that doesn't help. But thanks anyway :)
 
When I switch interface re0 to use static IP instead of DHCP, the interface wlan0 goes from status "associated" to "no carrier".
These two have nothing to do with each other. No carrier with a wireless interface means you lost the association with your AP. That has nothing to do with DHCP. DHCP actually only works when there's a active connection. A DHCP request (or lack thereof) on one interface has no influence over the connection state of another interface.
 
I know they have nothing to do with each other. Furthermore, changes on interface "re0" (ethernet) shouldn't change anything on the interface "wlan0", right? That the issue I'm trying to understand.

And it's not just that I lost the association with the AP at random, I can reproduce the issue 100%. When I disable DHCP on "re0", I lose the connection on "wlan0".

Any idea what's going on?
 
changes on interface "re0" (ethernet) shouldn't change anything on the interface "wlan0", right?
Correct.

When I disable DHCP on "re0", I lose the connection on "wlan0".
This begs the question, how did you disable DHCP? What exactly did you do? Did you perhaps run service netif restart? That would restart all your interfaces.
 
I think you're going to have to define what "works" mean. Routing to the internet? Can you ping devices on each link?

If the 10 network and the 192 network are both handing out routers wlan0, you're going to have a conflict and I don't know how dhcpclient is going to handle that. I imagine your problem has something to do with wpa_supplicant interaction as well, since as it was pointed out that the interface doesn't even have a carrier when you say it isn't working.

netstat isn't showing any default IPv4 gateways whatsoever in your output. I don't know how your working configuration even "worked" in the first place.
 
I regularly manually configure wlan and get IP with dhclient, manually configure ethernet with static IP and run dhcpd on it, and always worked. Wlan for connection to internet through a router, ethernet for connection to a local net.
 
I hate stackexchange. But it looks like the OP did service netif restart. That would reconfigure all interfaces, including his Wifi. That simply means his wifi got disassociated, hence the "no carrier". It has nothing to do with DHCP being enabled or not on an unrelated interface.

If you want to reload a single interface, use service netif restart re0.
 
I hate stackexchange
Up until now, the total amount of help which I've received from the Snackechange, Reddit and alike to solve FreeBSD and OpenBSD problems is absolute zero.

[EDIT]

Generally, I confine my search to:

site:freebsd.org
site:freshports.org
site:github.com/freebsd

site:forums.freebsd.org
site:lists.freebsd.org
site:bugs.freebsd.org
site:reviews.freebsd.org
site:wiki.freebsd.org

https://www.freebsd.org/cgi/man.cgi?query=%s
https://www.freebsd.org/cgi/ports.cgi?query=%s
 
SirDice and Claus-andersen (on StackOverflow) both gave good to great tips.

A) Restarting only 1 interface
The main issue is really that I was restarting all the interfaces at the same time, which made me believe that changing settings on the interface re0 was affecting wlan0 (even though I knew it shouldn't be the case). So this answer technically answers my question "What am I missing?" (I was missing that all the interfaces were restarted when I was running "service netif restart" or "/etc/netstart").

B) How I'm testing
Another good point that msplsh and the guy on StackOverflow brought up is that I didn't explain what I tried to test the network, nor did I say what I was expecting. So here it is.

For testing the wlan0 interface, I was just pinging one of google's DNS servers: ping 8.8.8.8, and for testing the re0 I was pinging the only other computer plugged on the switch (which I also configured with a static IP).

When I said that it worked, it was when I got answers from both pings.

When I said it didn't work, it was when I couldn't ping 8.8.8.8; the local network on re0 always worked (i.e. I could always ping the other computer on the LAN).

C) The issue is definitely with wlan0 only

So since I last posted something here, I turned on and off the computer a few times (I have a web server and syncthing running fine on it). And the wireless works most of the time. AND I changed the router since. But it happened again this morning that wlan0 wasn't working (and by that I mean that the interface status was "no carrier, and ofc I couldn't reach 8.8.8.8 from it).

C) Debugging the wlan

Claus-andersen gave me another good tip on how to debug the wireless connection. He said that I could kill the currently running wpa_supplicant process and run it manually with some flags for debugging like this:
wpa_supplicant -i wlan0 -d -c /etc/wpa_supplicant.conf

So I did that... and it just worked (I got a working connection, I can reach that computer from the wifi, can reach google from it, etc).

I really have to go now, but the issue now is: why didn't it connect to wifi automatically? If it failed once for some reason, why didn't try again?

Thank you all!
 
Back
Top