Wifi Problem After Setting Static IP in Ubuntu 18.04.01 LTS
I had a similar problem with assigning a static IP address to my WiFi interface rendered with networkd using Netplan. For me the main factor was that I had set the wrong password. Make sure that the access point exists, along with the correctly stated password. I blindly defined a no-existing access point before rebooting the system that set a static IP address when rendered with networkd believing it didn't matter. After the reboot, the WiFi no longer worked.
I'm not sure whether or not this is a bug, but trying to assign a static IP address for the WiFi interface rendered with NetworkManager did not apply my static IP address to my interface, even when viewed and defined visibly in the NetworkManager GUI (current bug report has been created). I relied on netplan YAML configuration rendered with networkd with proper credentials to avoid this problem. This worked as intended, but my system relied on a USB dongle for direct Ethernet connection as a backup network interface. After my Netplan settings were applied, I could not have any contact with my Ethernet interface connection. By default, NetworkManager is the default service for Ubuntu 18.04 Desktop, which manages network interfaces normally through the GUI. From my Netplan configuration, I explicitly stated configurations for my WiFi interface, but networkd did not automatically assign settings for new interfaces when detected on the system. I created a YAML configuration adapted from this SO post to set all interfaces first with NetworkManager and then specified my WiFi interface to render with networkd for the static address assignment:
network:
version: 2
renderer: NetworkManager
wifis:
renderer: networkd
wlp1s0:
addresses: [192.168.1.231/24]
dhcp4: no
dhcp6: no
gateway4: 192.168.1.1
nameservers:
addresses: [192.168.1.1]
access-points:
accesspointename:
password: passwordgoeshere
After a reboot I had an established connection with my static WiFi interface and ethernet interface was functioning as intended.
In case you would rather not reboot the entire system, and/or if the intended access point to connect to is different than what is already connected via NetworkManager or nmcli you can run the following commands in order to restart the services after applying netplan:
sudo netplan apply; sudo systemctl daemon-reload; sudo systemctl stop NetworkManager; sudo systemctl restart systemd-networkd.service; sudo systemctl restart NetworkManager