Failure to connect to wifi with Raspberry B3+ with CLI

#1

Hi,
I managed to install OpenWRT on my raspberry (flashed the sd card) but can't conenct my raspberry to the wifi.
I used the Snapshot version since the latest stable version of OpenWRT have issues with the Raspberry B3+. (found it here:
https://downloads.openwrt.org/snapshots/targets/brcm2708/bcm2710/
)

Now at first, I tried to use Luci since it's apparently easier to connect to wifi, but integrating Luci in the build by using the image builder is out of my reach, the instruction were not detailed enough for a beginner like me so I opted to connect to the wifi without Luci.

I then tried to follow the instruction given on this topic since this user's issue were similar to mine:

(since it's clearer than on the wiki page:
https://openwrt.org/docs/guide-user/network/wifi/connect_client_wifi#setup_with_cli
)

But the wifi still did not work (failed to ping basic sites or to opkg update), an important fact is that I use the shared connection of my android smartphone and not a usual router. My mobile phone actually detect that my raspberry is connected to its' shared connection but as I just mentioned, openwrt still can't connect to Internet.

So here is my file

  • /etc/config/network

config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

config globals 'globals'
option ula_prefix 'fd5a:4840:22f4::/48'

config interface 'lan'
option type 'bridge'
option ifname 'eth0'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'

config interface 'wan'
option proto 'dhcp'

~~

and change the /etc/config/wireless file to

config wifi-device 'radio0'
option type 'mac80211'
option channel '36'
option hwmode '11a'
option path 'platform/soc/3f300000.mmc/mmc_host/mmc1/mmc1:0001/mmc1:0001
option htmode 'VHT80'
option country 'CN' # (tried to remove this line but it didn't change anything)
option disabled '0'

config wifi-iface
option network 'wwan'
option ssid 'SSID' #(the actual SSID)
option encryption 'none' #(I tried to use WPA2-PSK at first, but it didn't work until I disabled it on my phone)
option device 'radio0'
option mode 'sta'
option key 'PASSWORD' #(the actual password )
#(I removed the BSSID since it's not mandatory)

~~

Any idea of where I have made a mistake?

Thanks in advance

#2

You could just install LuCI from SSH.

opkg update 
opkg install luci 
/etc/init.d/uhttpd start 
/etc/init.d/uhttpd enable

Do you know that the snapshot you are using supports WiFi?

#3

The issue is that I can't even reach internet (so opkg update won't work), whether it's by Wifi or with an ethernet cable. (I managed to share the ethernet connection with another computer through the cable)

As for the Snapshot it should support Wifi according to the OpenWRT page:
temp

#4

I don't know which impact would an missing country code for wifi would have. Did you configured the country code via raspberian ?

Please also post the output of.
Ifconfig / ip address
route print

Some carriers restrict the usage of mobile hotspot(with ttl from pakackegs) did that worked before with another device?

#5

I don't know which impact would an missing country code for wifi would have. Did you configured the country code via raspberian ?

You mean raspbian?
I did change it, but formatted my SD card with raspian (light) to install OpenWRT instead on it, so I guess it's a no. I will check if Wifi worked with raspbian.
edit: The wifi is properly working on raspbian

Please also post the output of.
Ifconfig / ip address
route print

root@OpenWrt:~# ifconfig

br-lan    Link encap:Ethernet  HWaddr B8:27:EB:F2:C2:73
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fdac:9a8:3c13::1/60 Scope:Global
          inet6 addr: fe80::ba27:ebff:fef2:c273/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1949 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1102 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:169693 (165.7 KiB)  TX bytes:161745 (157.9 KiB)

eth0      Link encap:Ethernet  HWaddr B8:27:EB:F2:C2:73
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1960 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1102 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:198235 (193.5 KiB)  TX bytes:161745 (157.9 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:257 errors:0 dropped:0 overruns:0 frame:0
          TX packets:257 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:17484 (17.0 KiB)  TX bytes:17484 (17.0 KiB)

wlan0     Link encap:Ethernet  HWaddr B8:27:EB:A7:97:26
          inet6 addr: fe80::ba27:ebff:fea7:9726/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:229 (229.0 B)  TX bytes:2028 (1.9 KiB)



root@OpenWrt:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags   Metric Ref    Use   Iface
192.168.1.0     *                     255.255.255.0   U       0         0        0       br-lan

Some carriers restrict the usage of mobile hotspot(with ttl from pakackegs) did that worked before with another device?

Sorry I didn't understood your question, can you please reformulate it?

#6

Yes here the qoute from openwrt

Wireless Country Code Issue

The Country Code under Wireless in OpenWrt does not work, and you do need to set/change the country code in the latest Raspbian, and then you can go back to OpenWrt; the new country code will be used. Starting with Raspberry Pi 3 B+, the on-board wireless won't even start if there is no country code (set in Raspbian) See: Cannot use channels 12 and 13 on Raspberry Pi 3 in AP config

You're wlan0 didnt got an ip.

Some mobilephone contracts are restricted so it wouldn't be possible to use your phone as hotspot. Did you tried it before?

#7

Some mobilephone contracts are restricted so it wouldn't be possible to use your phone as hotspot. Did you tried it before?

No it works as a hotspot, right now I am using the hotspot to access to the forum with my computer.

The Country Code under Wireless in OpenWrt does not work, and you do need to set/change the country code in the latest Raspbian, and then you can go back to OpenWrt; the new country code will be used. Starting with Raspberry Pi 3 B+, the on-board wireless won't even start if there is no country code (set in Raspbian)

Ok, but I don't understand how I am supposed to do this, if I use OpenWRT, I will have to format the SD card containing Raspbian, how will it even remember the country code?

#8

Please have a look at link section
Wireless Country Code Issue
https://openwrt.org/toh/raspberry_pi_foundation/raspberry_pi

#9

I already changed the country on Raspbian after your previous post.

I must have a misunderstanding somewhere else: because I believe that to use OpenWRT I have to format my SD card and flash the image of OpenWRT instead, hence modifying the Raspbian configuration is meaningless in this situation.

#10

Um , the raspian shoud only be used to change the region code.

After that as you wrote flash again the openwrt image to the sd card.

Within the next 2 days i haven't time to test the snapshot build on my raspberry 3b+ .

Maybe you could use the latest stable for the 3b+ , setup the configuration, copy it . Flash the snapshot and copy the running configuration back.

#11

Hmm, still didn't work but never mind I found a snapshot release with luci included and managed to connect to Wifi here:

Still, I am thankfull for your help.

#12

Hi could you post your configs from your running setup ?
Then we see the differences.

Regards
Sebastian

#13

Do you mean ifconfig and route? Because the files are not the same with this image, e.g I can't find the etc/config directory

root@OpenWrt:/etc# ifconfig
br-lan    Link encap:Ethernet  HWaddr B8:27:EB:F2:C2:73
          inet addr:192.168.2.1  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fdfa:b0dd:d6ab::1/60 Scope:Global
          inet6 addr: fe80::ba27:ebff:fef2:c273/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1422 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1188 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:361223 (352.7 KiB)  TX bytes:353919 (345.6 KiB)

eth0      Link encap:Ethernet  HWaddr B8:27:EB:F2:C2:73
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1438 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1206 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:382679 (373.7 KiB)  TX bytes:356072 (347.7 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:363 errors:0 dropped:0 overruns:0 frame:0
          TX packets:363 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:27500 (26.8 KiB)  TX bytes:27500 (26.8 KiB)

wlan0     Link encap:Ethernet  HWaddr B8:27:EB:A7:97:26
          inet addr:192.168.43.211  Bcast:192.168.43.255  Mask:255.255.255.0
          inet6 addr: fe80::ba27:ebff:fea7:9726/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:449 errors:0 dropped:0 overruns:0 frame:0
          TX packets:648 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:113410 (110.7 KiB)  TX bytes:300168 (293.1 KiB)

Route

root@OpenWrt:/# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.43.178  0.0.0.0         UG    0      0        0 wlan0
192.168.2.0     *               255.255.255.0   U     0      0        0 br-lan
192.168.43.0    *               255.255.255.0   U     0      0        0 wlan0

#14

Please also post the Output from uci show.

Keep in mind to remove the PSK from Wireless Section before post.

Thanks
Sebastian

#15

Sure:

root@OpenWrt:~# uci show

network.loopback=interface
network.loopback.ifname='lo'
network.loopback.proto='static'
network.loopback.ipaddr='127.0.0.1'
network.loopback.netmask='255.0.0.0'
network.globals=globals
network.globals.ula_prefix='fdfa:xxxx:xxxx::/48'
network.lan=interface
network.lan.type='bridge'
network.lan.ifname='eth0'
network.lan.proto='static'
network.lan.netmask='255.255.255.0'
network.lan.ip6assign='60'
network.lan.ipaddr='192.168.2.1'
network.wwan=interface
network.wwan.proto='dhcp'

wireless.radio0=wifi-device
wireless.radio0.type='mac80211'
wireless.radio0.path='platform/soc/3f300000.mmc/mmc_host/mmc1/mmc1:0001/mmc1:000                                                                                                             1:1'
wireless.radio0.short_gi_40='0'
wireless.radio0.hwmode='11g'
wireless.radio0.htmode='HT20'
wireless.radio0.legacy_rates='1'
wireless.radio0.disabled='0'
wireless.radio0.channel='6'
wireless.radio0.country='00'
wireless.@wifi-iface[0]=wifi-iface
wireless.@wifi-iface[0].network='wwan'
wireless.@wifi-iface[0].ssid='SSID'
wireless.@wifi-iface[0].encryption='psk2'
wireless.@wifi-iface[0].device='radio0'
wireless.@wifi-iface[0].mode='sta'
wireless.@wifi-iface[0].bssid='E4:0E:EE:XX:XX:XX'
wireless.@wifi-iface[0].key='PASSWORD'