ubuntu用netplan配置静态ip

[chrism@hp netplan]$ cd /etc/netplan/
[chrism@hp netplan]$ cat 01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp0s31f6:
      dhcp4: no
      addresses: [1.1.1.1/24]
[chrism@hp netplan]$ sudo netplan apply

也可以用systemd配置:

root@dev-r630-03:~# cat /etc/systemd/network/static-eno1.network
[Match]
Name=eno1
[Network]
Address=10.12.205.13/24
Gateway=10.12.205.1
DNS=10.12.68.102
DNS=10.12.68.101

systemctl enable systemd-networkd
systemctl start systemd-networkd

 

你可能感兴趣的:(linux)