Raspberry Pi-3 running Stretch.
There are dozens of posts here and on other forums about how to set a static IP for the Pi. My problem is the other direction.
I have several Pi's, esp switches and a couple of computers on my home LAN. Since an IP scan shows 42 devices, managing them with static IP is becoming a burden. (Static IP is an old habit from decades ago, but I have learned my lesson.)
To set a static IP, I added the static IP information to dhcpd.conf:
# Custom static IP address for eth0.
interface eth0
static ip_address=192.168.1.114/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
# Custom static IP address for wlan0.
interface wlan0
static ip_address=192.168.0.115/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
I also added the network credentials to wpa_supplicant.conf:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="kaywinnet"
psk="80619xyzzy"
key_mgmt=WPA-PSK
}
Now, here's my question. if I take those lines out of dhcpcd.conf and wpa_supplicant.conf then reboot, eth0 does get an IP address via DHCP (from my router), but not wlan0 (on a Pi3 running Stretch).
sudo iwlist wlan0 scan | grep SSID shows the network I want to connect to (Kaywinnet), so I know that wlan0 is working hardware.
sudo ifup wlan0 shows that "interface wlan0 is already configured"
sudo service --status-all shows that dhcpcd is running ([ + ] dhcpcd)
I am pretty certain that my router is providing IP addresses from a DHCP request because many of my esp8266 nodes, my Arduinos and at least my wife's PC (plus my TV, Blu-Ray player and other devices) are all getting IP over DHCP.
Just as an exercise, I flashed the latest Jessie on a new SD card, and it also does not get an IP for the WiFi.
So, I am at a loss to why it appears that my WiFi can't connect using DHCP but it does with static IP.
Any tips of where to look would be appreciated. Also would be appreciated if you don't yell at me for asking the same question on the Pi Foundation forums.
Thanks
ip a
Incidentally the the settings you posted are on different subnets. – Milliways Feb 16 '18 at 05:253: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether b8:27:eb:9b:58:ae brd ff:ff:ff:ff:ff:ff – user3573562 Feb 18 '18 at 06:28
ip a
is a shortcut forip address
. It`s only understandable for those who often use this command ;-) – Ingo Feb 18 '18 at 12:33