Ubuntu 18LTS ifupdown has been replaced by netplan(5) on this system NetworkManager已经废弃interfaces配置,用netplan 配置取代
详情请看man netplan
Distribution installers, cloud instantiation, image builds for particular devices, or any other way to deploy an operating system put its desired network configuration into YAML configuration file(s). During early boot, the netplan "network renderer" runs which reads /{lib,etc,run}/net‐ plan/*.yaml and writes configuration to /run to hand off control of devices to the specified networking daemon. Examples Configure an ethernet device with networkd, identified by its name, and enable DHCP: network: version: 2 ethernets: eno1: dhcp4: true This is an example of a static-configured interface with multiple IPv4 addresses and multiple gateways with networkd, with equal route metric lev‐ els, and static DNS nameservers (Google DNS for this example): network: version: 2 renderer: networkd ethernets: eno1: addresses: - 10.0.0.10/24 - 11.0.0.11/24 nameservers: addresses: - 8.8.8.8 - 8.8.4.4 routes: - to: 0.0.0.0/0 via: 10.0.0.1 metric: 100 - to: 0.0.0.0/0 via: 11.0.0.1 metric: 100examples:
#/etc/netplan/01-netcfg.yaml network: ethernets: eth0: addresses: [192.168.1.1/24] gateway4: 192.168.1.254 nameservers: addresses: [114.114.114.114,8.8.8.8] version: 2