Netplan not connecting to hidden SSID Server 18.04.1 LTS

5,259

Solution 1

Based on my reading of the official source code, this does NOT work yet. Netplan delegates WiFi connection to wpa_supplicant, but there are no provisions to emit the "scan_ssid=1" configuration line that wpa_supplicant expects.

See write_wpa_conf(): https://github.com/CanonicalLtd/netplan/blob/1265de994bd1ff5e1dad573d816b9201127206b3/src/networkd.c

However, by gross abuse of string escaping in the SSID name, I did get my connection to work.

"MYREALSSID\"\n  scan_ssid=1\n# \"hack!":
  password: "MYSSIDPASSWORD"

eventually becomes:

network={
  ssid="MYREALSSID"
  scan_ssid=1
# "hack!"
  psk="MYSSIDPASSWORD"
}

(Note the comment to swallow the open double quote).

Ubuntu bug: https://bugs.launchpad.net/netplan/+bug/1866100

Solution 2

Since version 0.100 Netplan has been updated to now allow the hidden keyword.

As per the approved PR:

To check if you have the latest version check man netplan and look for the hidden (bool) keyword.

Suggested way:

man netplan | grep hidden

Example usage according to man page (hidden: true):

# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eth0:
            dhcp4: true
            optional: true
    version: 2
    wifis:
        wlan0:
            dhcp4: true
            optional: true
            access-points:
                "SSID_name":
                    hidden: true
                    password: "WiFi_password"

Answer source: Documentation | Experience | Field Test

Share:
5,259

Related videos on Youtube

k1T4eR
Author by

k1T4eR

Updated on September 18, 2022

Comments

  • k1T4eR
    k1T4eR over 1 year

    I've a problem with Netplan not connecting to WiFi network with hidden SSID. It works great if I'll make this network visible. But no chance with hidden one. Any options to configure that?

  • k1T4eR
    k1T4eR about 5 years
    Thanks a lot. Yeah, it's really significant one. Thanks for this hack!
  • Sasha Shpota
    Sasha Shpota over 3 years
    Amazing! How would you call it, SSID injection? :D