准备
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
01-netcfg.yaml
50-cloud-init.yaml
99_config.yaml
DHCP 动态获取 IP
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4:
yes
sudo
dhclient
ifconfig
|
grep
-B1 inet
静态 IP 地址
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses: [192.168.88.100
/24
]
gateway4: 192.168.88.2
nameservers:
addresses: [192.168.88.2, 114.114.114.114]
总结