使用NetPlan配置命令行中的静态IP地址
找到当前网络配置文件。
$ cd /etc/netplan/ $ ls 01-network-manager-all.yaml
编辑当前配置文件。
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: no
addresses: [192.168.1.224/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
应用更改
$ sudo netplan apply
如果遇到问题,可以使用调试模式
$ sudo netplan --debug apply
查看新设置的IP地址是否正确:
$ ip a
日期:2020-07-07 20:55:15 来源:oir作者:oir
