1. 首先安装程序
sudo apt-get install wpasupplicant
sudo apt-get install network-manager
2. 查看无线网卡名
ifconfig -a
或
ip a
找到无线网卡: wlan0
3. 配置无线网卡节点
sudo vi /etc/netplan/50-cloud-init.yaml
格式需要严格缩进
# 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:
renderer: NetworkManager
ethernets:
eth0:
dhcp4: true
optional: true
wifis:
wlan0:
dhcp4: true
access-points:
"HUAWEI-00452L":
password: "Abcd1234"
version: 2
network:
renderer: NetworkManager
ethernets:
eth0:
dhcp4: true
optional: true
wifis:
wlan0:
dhcp4: false
addresses: [192.168.1.101/24]
gateway4: 192.168.1.1
nameservers:
addresses: [192.168.1.1]
optional: true
access-points:
"xxxxx":
password: "xxxxx"
解释说明 `/24` 含义
4. 重启网络
sudo netplan generate
sudo netplan apply