cscuilla
Posts: 58
Joined: Tue Apr 26, 2016 6:35 pm

2 IP addresses when wifi is configured

Fri Sep 01, 2017 7:01 pm

I'm using Stretch lite. I connect to my wifi by editing /etc/wpa_supplicant/wpa_supplicant.conf

Code: Select all

network={
        ssid="MySSID"
        psk="MySSIDpassword"
}
Now, when using dhcp, If I boot the pi with an ethernet cable plugged in, I get two different IP addresses. I can connect via putty using either address. Both ips show under ifconfig

If I set a static IP from /etc/dhcpcd.conf, then I reboot the pi, I only get the one IP address. (the static one I set.) If I unplug the ethernet cable, the IP address instantly transfers to the wlan and the connection is not lost. The IP shows for the ethernet port on ifconfig if it's plugged in, and if it's not plugged in, the IP shows for the wireless adapter.

Is their a way for dhcp to act this same way? So that the IP is given to ethernet but if that is unplugged, the same IP is transferred to wireless?

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: 2 IP addresses when wifi is configured

Fri Sep 01, 2017 8:10 pm

You need to change it to include

Code: Select all

country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
ahead of your network={...} block. Set the right ISO two character country code.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Raspberry Pi OS”