Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

How do I configure my Raspberry Pi 3 (running Raspbian) to connect to a hidden network? I know it involves editing the /etc/network/interfaces file and the wpa_supplicant.conf file. I've followed a few other guides, but when I make these file changes and reboot, I can't even detect visible networks, as they disappear from my wifi menu. I think I'm just editing these files with incorrect configurations.

like image 349
Kylecrocodyle Avatar asked May 19 '16 01:05

Kylecrocodyle


People also ask

What is the main way to connect the Raspberry Pi to a network?

If you want to connect your Raspberry Pi to the internet, you can plug an Ethernet cable into it (if you have a Raspberry Pi Zero, you'll need a USB-to-Ethernet adapter as well). If your model is a Raspberry Pi 4, Raspberry Pi 3, or Raspberry Pi Zero W, you can also connect to a wireless network.


3 Answers

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.

like image 79
Kylecrocodyle Avatar answered Oct 10 '22 07:10

Kylecrocodyle


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

like image 6
Santiago H Avatar answered Oct 10 '22 09:10

Santiago H


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.

like image 21
gears Avatar answered Oct 10 '22 09:10

gears