6

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?

2 Answers 2

7

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

2
  • Thanks a lot. Yeah, it's really significant one. Thanks for this hack!
    – k1T4eR
    Feb 22, 2019 at 17:25
  • Amazing! How would you call it, SSID injection? :D Sep 20, 2020 at 20:31
4

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .