1

enter image description here

I can successfully connect to my RPI using SSH when the RPI is connected to a wireless access point and powered by a Xiaomi battery; but I cannot when I pull off the power and plug in the socket & disconnect from the AP.

My home has 2 wireless access points; my computer and raspberry pi are connected to one which is being used as a hub.

Access point which is directly connected to the internet: 192.168.25.1

Access point used as a hub: 192.168.25.2

My computer: 192.168.25.38

My raspberry pi: 192.168.25.254(wired), 192.168.25.150(wired-manually set), and 192.168.25.54(wireless)

Subnet mask: 255.255.255.0

This is what ifconfig shows w/ wired connection:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.25.254  netmask 255.255.255.0  broadcast 192.168.25.255
        inet6 fe80::ba27:ebff:feea:707d  prefixlen 64  scopeid 0x20<link>
        ether XX:XX:XX:XX:XX:XX  txqueuelen 1000  (Ethernet)
        RX packets 120  bytes 17014 (16.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 173  bytes 26794 (26.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.25.54  netmask 255.255.255.0  broadcast 192.168.25.255
        inet6 fe80::e66f:6720:9885:bfe0  prefixlen 64  scopeid 0x20<link>
        ether YY:YY:YY:YY:YY:YY  txqueuelen 1000  (Ethernet)
        RX packets 146  bytes 18413 (17.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 39  bytes 6553 (6.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

And this is what iwconfig shows:

eth0      no wireless extensions.

lo        no wireless extensions.

wlan0     IEEE 802.11  ESSID:"*wap to the internet*"  
          Mode:Managed  Frequency:2.437 GHz  Access Point: ZZ:ZZ:ZZ:ZZ:ZZ:ZZ  
          Bit Rate=24 Mb/s   Tx-Power=31 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=70/70  Signal level=-37 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

This is the content of /etc/wpa_supplicant/wpa_supplicant.conf.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="wap to the internet"
        psk=419a1c553c3e97c809ab7e1e4a61b24ec9e41a3e695fdb152b123cb36f8496cc
}

network={
        ssid="wap as a hub"
        psk=84f5ad15d48b3eec93640122b573f206d37abdcf8772a5295ea4dea872487f61
}

I guess two possible causes: 1. Power - Both the iPhone charge adapter and my Macbook are too weak to supply power 2. Not booted - The two power sources mentioned above are sufficient but my access point cannot spot my RPI when it's booted up

Would anyone help me figure out what prevents establishing WiFi connection? Any comments will be appreciated a lot.

  • A hub is not an access point. There are router available which can make an access point and which have additional ports to plug in ethernet cables. Do you mean such a router? What does that mean with: "but I cannot when I pull off the power and plug in the socket & disconnect from the AP". What socket? If you disconnect from the AP you cannot have a connection to it. I do not understand what is how connected. Can you please edit your question and add a diagram about your connections? – Ingo Mar 30 at 17:00
  • @Ingo I mean I can connect to my RPI via WiFi only when it's linked to an access point with a LAN cable – JYC Mar 31 at 5:57
0

There are many things mixed up: wired and wireless with multiple ip addresses. I cannot say what exactly is going wrong because the setup does not respect any specification. You should first strip down it to just the elementary needed setup and then you can extend it to your nice to have options.

First of all you must use a proper power supply with 5.1V and at least 2.5A (more current range doesn't hurt) plugged into the micro USB port. The RasPis are very sensible with power so it doesn't make sense to continue without a proper power supply.

If you have the right power supply then you should check that there is only one DHCP server running on your network. It seems that Access Point A and Access Point B are both bridging WiFi and wired connections so you have everywhere one broadcast domain on subnet 192.168.25.0/24. In a subnet (broadcast domain) there must only be one DHDP server running. Usually router like your Access Points have a DHCP server built in and running so everything works plug and play. So you have to ensure that a DHCP server on one Access Point is disabled. It doesn't matter which one but for a structured top down design I would disable it on Access Point B.

Next you should remove all needless interfaces and ip addresses on the RasPi. You should use first a wired connection because it works out of the box without additional configuration. So disable WiFi on the RasPi by adding this option to /etc/dhcpcd.conf:

nohook wpa_supplicant

Then remove the settings for the static ip address 192.168.25.150 for eth0.

Reboot and tell me if it works as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.