Ubuntu 20.04.1 LTS 网络配置
netplan配置
# 跳转至 netplan
$ cd /etc/netplan
$ ls
01-network-manager-all.yaml
$ cat *.yaml
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
# ubuntu 桌面版默认是 NetworkManager 管理网络连接,这里可以修改成 想要 networkd方式
$ cp 01-network-manager-all.yaml 01-network-manager-all.yaml.backup
# 备份 01-network-manager-all.yaml
# `注意了 你的网口可能不是这个,查看ifconfig 后再填写`
$ nano *.yaml
network:
version: 2
renderer: networkd
ethernets:
enp3s4f1:
addresses:
- 192.168.16.152/24
gateway4: 192.168.16.1
nameservers:
addresses:
- 223.5.5.5
- 223.6.6.6
ubuntu 20 网口名称 叫 enp3s4f0 和 enp3s4f1,与18不同,这里我配置成 152
你也可以设置成自动配网
network:
version: 2
renderer: networkd
ethernets:
enp3s4f1:
dhcp4: true
dhcp6: true
要更新netplan配置,运行netplan apply命令
sudo netplan apply
WiFi配置
ethernets:
id0:
[...]
access-points:
mode: infrastructure
bssid: mywifi
band: 5GHz
channel: 5
auth:
key-management: none | psk | eap
password: my-password-string