I'm a beginner when it comes to configuring a network through a Linux terminal. I was trying to turn the Pi 4 into a server but at some point, during configuration, I messed up the networking and had to refresh the Raspbian OS. So right now I'm just messing with it, which is running Raspbian 10, Buster, to figure out how to switch between it being using dynamic IP addresses and using static IP addresses. I'm running into an issue where it doesn't connect to any wireless network consistently. I have the main router which is an Arris T1672G Dual-band router from Brighthouse/Spectrum/Time Warner, An Apple express acting as an AP and is connected to the Arris by ethernet, and an extender for the main router for both 2.4 and 5G wireless. The main focus is connecting to the Arris and get a dynamic IP address. Also, I'm using SSH through ethernet to connect with the Pi.
Whenever I try to connect the Pi to the 2.4 Wireless I get an APIPA back.
pi@raspberrypi:~ $ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether dc:a6:32:77:c4:58 brd ff:ff:ff:ff:ff:ff
inet 169.254.21.1/16 brd 169.254.255.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::26ac:ec5:81e4:ab86/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether dc:a6:32:77:c4:59 brd ff:ff:ff:ff:ff:ff
inet 169.254.252.18/16 brd 169.254.255.255 scope global noprefixroute wlan0
valid_lft forever preferred_lft forever
inet6 2603:9001:504:9800:d220:98b5:d209:7ffc/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 3600sec preferred_lft 3600sec
inet6 fe80::40f3:9c82:f538:84/64 scope link
valid_lft forever preferred_lft forever
I know this usually means that it failed to reach the DHCP server. So I tried messing with the dhcpcd.conf file to see if that does anything. I followed some advice from another stack exchanges such as adding ,routes
at the end of the list of options and commenting out the option for classless_static_routes like so:
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name, routers
#option classless_static_routes
Then restarted the dhcpcd service. This is what I got for status.
pi@raspberrypi:~ $ sudo systemctl status dhcpcd
● dhcpcd.service - dhcpcd on all interfaces
Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-02-03 02:23:51 EST; 49s ago
Process: 8050 ExecStart=/usr/lib/dhcpcd5/dhcpcd -q -b (code=exited, status=0/SUCCESS)
Main PID: 8052 (dhcpcd)
Tasks: 2 (limit: 4915)
Memory: 2.2M
CGroup: /system.slice/dhcpcd.service
├─8052 /sbin/dhcpcd -q -b
└─8069 wpa_supplicant -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -Dnl80211,wext
Feb 03 02:24:12 raspberrypi dhcpcd[8052]: wlan0: soliciting a DHCP lease
Feb 03 02:24:17 raspberrypi dhcpcd[8052]: wlan0: using IPv4LL address 169.254.252.18
Feb 03 02:24:17 raspberrypi dhcpcd[8052]: wlan0: adding route to 169.254.0.0/16
Feb 03 02:24:21 raspberrypi dhcpcd[8052]: wlan0: Router Advertisement from fe80::9a6b:3dff:fe58:3247
Feb 03 02:24:21 raspberrypi dhcpcd[8052]: wlan0: adding address 2603:9001:504:9800:d220:98b5:d209:7ffc/64
Feb 03 02:24:21 raspberrypi dhcpcd[8052]: wlan0: adding route to 2603:9001:504:9800::/64
Feb 03 02:24:21 raspberrypi dhcpcd[8052]: wlan0: requesting DHCPv6 information
Feb 03 02:24:21 raspberrypi dhcpcd[8052]: wlan0: fe80::9a6b:3dff:fe58:3247 is reachable again
Feb 03 02:24:21 raspberrypi dhcpcd[8052]: wlan0: adding default route via fe80::9a6b:3dff:fe58:3247
Feb 03 02:24:31 raspberrypi dhcpcd[8052]: wlan0: failed to request information
Still have an APIPA address and sometimes it switches to the 5G Wireless network which works. I tried pinging the router just to see if they could even communicate and I get this.
pi@raspberrypi:~ $ ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
From 169.254.21.1 icmp_seq=1 Destination Host Unreachable
From 169.254.21.1 icmp_seq=2 Destination Host Unreachable
From 169.254.21.1 icmp_seq=3 Destination Host Unreachable
From 169.254.21.1 icmp_seq=4 Destination Host Unreachable
From 169.254.21.1 icmp_seq=5 Destination Host Unreachable
From 169.254.21.1 icmp_seq=6 Destination Host Unreachable
^C
--- 192.168.0.1 ping statistics ---
7 packets transmitted, 0 received, +6 errors, 100% packet loss, time 255ms
pipe 4
I checked route and it gave me this.
pi@raspberrypi:~ $ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 0.0.0.0 0.0.0.0 U 202 0 0 eth0
link-local 0.0.0.0 255.255.0.0 U 202 0 0 eth0
link-local 0.0.0.0 255.255.0.0 U 303 0 0 wlan0
If I understand this correctly, for some reason it did not set a gateway when I tried to connect to 2.4 wireless. So I did some research and found a command that can add a Gateway to wlan0.
pi@raspberrypi:~ $ sudo route add default gw 192.168.0.1 wlan0
SIOCADDRT: Network is unreachable
Then I tried messing with interfaces but again nothing changed.
# interfaces(5) file used by ifup(8) and ifdown(8)
Please note that this file is written to be used with dhcpcd
For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
#---Everything below are my changes---#
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_suplicant.conf
I then tried the Gui but none of the changes I made seem to stick. So now I'm at a loss at what to do next. Why is it that I cannot connect to the 2.4G Wireless but 5G wireless is just fine? Is it a frequency issue? Is there a way to fix it or should I just stick to static addressing for the PI? If more information is needed please let me know.
Edit: Here is my current configuration of wpa_supplicant.conf passwords omitted.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="Apple Network d205d4"
psk="********"
key_mgmt=WPA-PSK
disabled=1
}
network={
ssid="BHNTG1672G3242_5GEXT"
psk="********"
key_mgmt=WPA-PSK
disabled=1
}
network={
ssid="BHNTG1672G3242_2GEXT"
psk="********"
key_mgmt=WPA-PSK
disabled=1
}
network={
ssid="BHNTG1672G3242"
psk="********"
key_mgmt=WPA-PSK
}
And here is wlan0 scan of that 2.4 network.
pi@raspberrypi:~ $ iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 98:6B:3D:58:32:40
Channel:6
Frequency:2.437 GHz (Channel 6)
Quality=54/70 Signal level=-56 dBm
Encryption key:on
ESSID:"BHNTG1672G3242"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 9 Mb/s
18 Mb/s; 36 Mb/s; 54 Mb/s
Bit Rates:6 Mb/s; 12 Mb/s; 24 Mb/s; 48 Mb/s
Mode:Master
Extra:tsf=0000000000000000
Extra: Last beacon: 43030ms ago
IE: Unknown: 000E42484E5447313637324733323432
IE: Unknown: 010882848B961224486C
IE: Unknown: 030106
IE: Unknown: 32040C183060
IE: Unknown: 0706555320010B24
IE: Unknown: 33082001020304050607
IE: Unknown: 33082105060708090A0B
IE: Unknown: 050400010201
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: Unknown: 2A0100
IE: Unknown: 2D1AEC0117FFFFFF0000000000000000000000000000001846471100
IE: Unknown: 3D1606000700000000000000000000000000000000000000
IE: Unknown: 7F0401000000
IE: Unknown: DD180050F2020101800003A4000027A4000042435E0062322F00
IE: Unknown: 0B050F0034127A
IE: Unknown: DD07000C4303000000
pi@raspberrypi:~ $
Edit 2: Okay, this is completely my fault. I forgot I had a tiny 3.0 USB flash drive plugged in this whole time. And that turned out to be the point of failure.
/etc/wpa_supplicant/wpa_suplicant.conf
you're missing ap
in the file name – Jaromanda X Feb 03 '21 at 22:45wpa_supplicant.conf
and have 2 independent services attempting to run wpa_supplicant. – Milliways Feb 03 '21 at 23:38main goal was to turn the Pi into a music server in the end which needs a constant IP address.
No - that is not true. How did you come to that conclusion? – Seamus Feb 05 '21 at 16:11man dhcpcd
andman dhcpcd.conf
? You may also be interested in reading a bit about mDNS & zeroconf networking - which typically means your hosts all find each other without you having to do anything. Example: My home network uses *no static IPs*, yet I always connect to my RPis usingssh seamus@rpi4b.local
(or rpi3b, or 1bp or whatever). – Seamus Feb 06 '21 at 22:17