WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to connect to WiFi with hidden SSID  (Read 7090 times)

Offline jgrulich

  • Sr. Member
  • ****
  • Posts: 341
    • GRULICH DESIGN - R&D Lab.
How to connect to WiFi with hidden SSID
« on: January 10, 2016, 04:16:24 PM »
Hi All,
I need to connect to wifi with hidden ssid. I'm using the minimal TC7 version with no GUI.
I've tested all around with the wpa config file, scan_ssid=1, whatever, but no lucky.
Please help if someone found some tricky configuration which works.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1243
Re: How to connect to WiFi with hidden SSID
« Reply #1 on: January 10, 2016, 04:32:45 PM »
the easiest way would be to create the wifi.db file in the home directory

/home/pi/wifi.db   
SSID        password       WPA

Then just startup as normal with "wifi.sh -a"

Offline jgrulich

  • Sr. Member
  • ****
  • Posts: 341
    • GRULICH DESIGN - R&D Lab.
Re: How to connect to WiFi with hidden SSID
« Reply #2 on: January 11, 2016, 03:25:07 AM »
That was my firs step, but seems that wifi.sh is not written for hidden networks. It even doesn't detect it, nor to connect.
It reports error, something like a "Can't connect, too few arguments ...".


Offline jgrulich

  • Sr. Member
  • ****
  • Posts: 341
    • GRULICH DESIGN - R&D Lab.
Re: How to connect to WiFi with hidden SSID
« Reply #4 on: January 11, 2016, 01:36:27 PM »
Thank's nitram.
 Your solution may work, but I was not able to open the SSID for evaluation. But finally I've found this solution.
The way is to use the manual config, wifi.sh can't be used at all. The issue was that wpa need to scan ssid's and test them.
I'm using the channel 11 and it takes roughly 12 seconds.
This is my tutorial:

First need to be created the config file, for example /tmp/wifi.cfg.

Code: (bash) [Select]
network={
scan_ssid=1
ssid="yourwifiname"
psk="yourwifipassword"
}

The most important is the scan_ssid=1 parameter which executes the network scan and enables the connection to the hidden networks. This function is not supported by wifi.sh script. The psk may be used in encrypted format generated via wpa_passphrase.

Than need to be created some script for wpa execution and ip querry. This script may be added to bootlocal.sh for automated execution at boot.

Code: (bash) [Select]
ifconfig wlan0 up
wpa_supplicant -iwlan0 -c/tmp/wifi.cfg -Dwext -B
udhcpc -i wlan0 -t 10

The first line may not be necessary at all cases, but some my dongles need it.
The -t 10 parameter is important to safely obtain the ip, because the wpa need pretty long time to scan all the channels as mentioned above. This gives 10 queries with 3 seconds delay, totally 30 second.

This works well and i'ts simple.