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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章