vim /etc/netplan/01-network-manager-all.yaml
静态IP:
# Let NetworkManager manage all devices on this system
#network:
# version: 2
# renderer: NetworkManager
# ethernets:
# enp6s0:
# dhcp4: yes
network:
version: 2
ethernets:
enp6s0:
dhcp4: no
addresses: [192.168.1.22/24]
optional: true
gateway4: 192.168.1.1
nameservers:
addresses: [192.168.1.1]
DHCP:
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
ethernets:
enp6s0:
dhcp4: yes
#network:
# version: 2
# ethernets:
# enp6s0:
# dhcp4: no
# addresses: [192.168.1.22/24]
# optional: true
# gateway4: 192.168.1.1
# nameservers:
# addresses: [192.168.1.1]
sudo netplan apply
评论