How do I detect and connect to a hidden SSID on my Raspiberry Pi 3 (Raspbian)?

别说谁变了你拦得住时间么 提交于 2019-12-03 05:39:06

First, enter the following in the terminal:

sudo nano /etc/network/interfaces  

Edit the interfaces file to look like so, which shouldn't be too different from the default:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Next, we will edit the wpa_supplicant.conf file. Enter the following in the terminal:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Edit the settings of this configuration file to be as such:

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1 
network={
        scan_ssid=1
        ssid="Your Hidden SSID"
        psk="Your SSID's Password"
        key_mgmt=WPA-PSK }

Note: You will need to change the "country" setting based on your location. Also, scan_ssid must be set to 1 to be able to detect a hidden SSID. Input your SSID name and password for your hidden network. Save these changes, reboot your raspberry pi, and then it should be automatically connected to the hidden network upon returning to the desktop.

I have a Pi 3. Including or excluding country=US had no effect. editing the wpa_supplicant.conf file to look like this:

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

network={
    scan_ssid=1
    ssid="NAME"
    psk="password"
}

removing key_mgmt=WPA-PSK and rebooting worked for me.

1. To connect to a hidden network yo need to modify only /etc/wpa_supplicant/wpa_supplicant.conf

network={
       ssid="your SSID"
       scan_ssid=1
       psk=your PSK 
}

I create this file and encrypted using wpa_passphrase "your PSK" "your SSID" command

2. /etc/network/interfaces does not need to be modify by you if you need to connect to your hidden network. When you modify wpa_supplicant.conf file in the interfaces file is created a new configuration automatically. In my case it looks like:

# 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

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf  /etc/wpa_supplicant/wpa_supplicant.conf


allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf  /etc/wpa_supplicant/wpa_supplicant.conf

Be sure when you add a new network on wpa_supplicant.conf file does not exist any conflict with the IPs allowed in the /etc/dhcpch.conf file...

For more information you can check: https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md

I have a Raspberry Pi 3 (Model B) running Raspbian 9 (Stretch),
this network interface configuration worked for me to connect to my routers hidden SSID (TP Link Archer 2600, secured with WPA/WPA-2 Personal).

1) /etc/network/interfaces:

# 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

####################################################
##### custom stuff to find hidden router SSIDs #####
####################################################
auto lo
iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Note that I only set up loopback and wlan0 (wireless) interfaces, I didn't need the eth0 (wired connection) interface.

2) /etc/wpa_supplicant/wpa_supplicant.conf:

country=SE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
ap_scan=1
update_config=1
network={
    scan_ssid=1
    ssid="xxx"
    psk="xxx"
}

Make sure to set up your country, ssid and psk appropriately.
ssid is the hidden SSID of your router or access point.
psk is the passphrase to connect and authenticate to the router or access point.

3) /etc/dhcpcd.conf:

I didn't have to change anything in dhcpcd.conf.

Requirement of Raspberry Pi System:

List the all available hidden wifi.

Steps to Follow

First open the terminal then type:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add the following:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=IN
network={
        ssid="XXXXXXXX"
        priority=1
        proto=RSN
        key_mgmt=WPA-EAP
        pairwise=CCMP
        auth_alg=OPEN
        eap=PEAP
        identity="18XXXXXXXX3"
        password=hash:d7XXXXXXXXXXXxXXXxce
        phase1="peaplabel=0"
        phase2="auth=MSCHAPV2"
}

Save the file and exit the wpa_supplicant.conf. Your need to give your hidden wifi name in place of ssid, user ID in place of identity and Password need to converted into hash code format.

Use this command in terminal to convert your password into hash code format.

echo -n 'YOUR_REAL_PASSWORD' | iconv -t utf16le | openssl md4 > hash.txt

Next Do the following:

  1. sudo nano hash.txt
  2. Insert hash: in place of (stdin)=
  3. Copy the entire text and exit
  4. Next modify the password in wpa_supplicant.conf file and exit

Reboot the system.

Expected Output

It will connect to Hidden ssid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!