3

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.

  • 3
    If you didn't fiddle with it it just works. Setting static IP just makes it worse. – Milliways Feb 03 '21 at 08:38
  • 1
    Does it work if you follow the default setup of Wireless connectivity? – Ingo Feb 03 '21 at 10:54
  • @Milliways Well, the reason why I was messing with static IP addressing was that the main goal was to turn the Pi into a music server in the end which needs a constant IP address. I originally came across this issue because I was setting up the server and lost all networking ability while configuring. So I had to reinstall Raspian with the new goal of trying to understanding Wireless connectivity and IP address with the Pi to avoid that issue. If the problem is that the static addressing is just borked then I'll just go with IP reservations then. – Nike Adeyemi Feb 03 '21 at 17:26
  • @ Ingo Yes, I followed the setups in that link that apply and I still have the problem where connecting to 2.4 Wireless gives me a 169.245.x.x address. – Nike Adeyemi Feb 03 '21 at 17:28
  • 1
    /etc/wpa_supplicant/wpa_suplicant.conf you're missing a p in the file name – Jaromanda X Feb 03 '21 at 22:45
  • See How to set up networking/WiFi. You can't have followed ANY of the official links if you put anything in interfaces. You have failed to list contents of wpa_supplicant.conf and have 2 independent services attempting to run wpa_supplicant. – Milliways Feb 03 '21 at 23:38
  • @Milliways Well, I did go to other tutorials outside the official one and they mentioned either having that in their interfaces or not having that in their interfaces and leaving it alone. I'll take the extra stuff out of interfaces then and go through the Wifi set up again. – Nike Adeyemi Feb 04 '21 at 02:11
  • @Milliways I put the interfaces file back to how it was before and went through all the methods of setting up the WIFI. I configured WIFI through the GUI, wlan0 IP address was an APIPA, I went through raspi-config, made sure Local is set to my country, and reentered my SSID and password, same APIPA address. I followed the steps to encrypt the passkey to if that made a difference and used the wpa_cli command to reconfigure, and still got the same 169.254.252.18 APIPA address. – Nike Adeyemi Feb 04 '21 at 03:01
  • main 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:11
  • @Seamus Isn't that best practice for setting up servers in general? To either reserve, an IP address or have a static one so that whatever connects to it can always connect to it to manage and use it reliably. If I understand, with a dynamic address it's not guaranteed the address you get will always stay the same so if what device depends on the IP address to find the server it's going to break if the IP address changes. – Nike Adeyemi Feb 06 '21 at 21:23
  • No - it is not best practice for devices on private, single-subnet networks. Before you ask more questions, I would like to ask you one: Have you taken the time to read man dhcpcd and man 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 using ssh seamus@rpi4b.local (or rpi3b, or 1bp or whatever). – Seamus Feb 06 '21 at 22:17
  • @Seamus I see, okay, so there's not really a need to do any manual network configuration in this situation, besides maybe wpa_supplicant.conf. As long as I know the user, hostname, and password I can get in. – Nike Adeyemi Feb 07 '21 at 03:39

1 Answers1

3

So it turns out it was a hardware issue rather than a software issue. Looking at my question again, I recalled that 2.4 GHz wireless connections are well known for dropping due to any kind of interference of other devices that give off the 2.4GHz noise frequency while 5GHz doesn't have that problem. One of the things I failed to mention earlier in the question was that I had a very small SanDisk 3.0 USB 64GB flash drive plugged into the 3.0 USB port of the Pi. After some research, I learned that 3.0 USB devices also give off this 2.4GHz noise frequency.

https://www.pcmag.com/opinions/wireless-witch-the-truth-about-usb-30-and-wi-fi-interference

I did some testing to confirm it. First I just plugged the USB in and out while the Pi was on and checked the wifi using ifconfig and iwconfig. It completely knocked out the 2.4 Wireless connection every time I plugged 3.0 USB into the port. Then I did a test based on page 11 in this intel white paper on the subject where they used a wireless mouse since they usually used 2.4GHz frequency. I plugged the Pi into a TV to get the display up to see the cursor. The wireless mouse worked normally even when 15ft or so away from the pi, but when I plugged the USB back in, the mouse movement was jittery when up close to the pi, and when far away, the mouse cursor wouldn't even move.

In short, the answer for me appears to be, the 3.0 USB flash drive is interfering with the 2.4GHz wireless connection. So I need to either use the 2.0 USB port, find a way to distance the 3.0 USB from the Pi, look into a 3.0 USB flash drive with shielding, use a 2.0 USB flash drive instead, or forget 2.4GHz and just use 5GHz or Ethernet instead.