Ubuntu 17 开始使用netplan配置网络,因此很多其它系统的教程都不再适用(/etc/network/interfaces 下的配置已经不再起作用)
1 | cat /etc/netplan/01-network-manager-all.yaml |
The top-level node in a netplan configuration file is a network: mapping
that contains version: 2 (the YAML currently being used by curtin, MaaS,
etc. is version 1), and then device definitions grouped by their type, such as
ethernets:, modems:, wifis:, or bridges:. These are the types that our
renderer can understand and are supported by our backends.
Each type block contains device definitions as a map where the keys (called
“configuration IDs”) are defined as below.
老实说,version干嘛的我没看懂,反正都写version: 2就完事了
测试
1 | sudo netplan try |
应用(其实上面那个命令用完之后按Enter也就应用了)
1 | sudo netplan apply |