root@localhost:~# mv /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.org
root@localhost:~# vi /etc/netplan/01-netcfg.yaml
# create new
network:
ethernets:
# interface name
enp1s0:
dhcp4: false
# IP address/subnet mask
addresses: [10.0.0.30/24]
# default gateway
# [metric] : set priority (specify it if multiple NICs are set)
# lower value is higher priority
routes:
- to: default
via: 10.0.0.1
metric: 100
nameservers:
# name server to bind
addresses: [10.0.0.10,10.0.0.11]
# DNS search base
search: [srv.world,server.education]
dhcp6: false
version: 2# apply changes
root@localhost:~# netplan apply
root@localhost:~# ip addr
使用Netplan在Ubuntu上配置静态IP地址
最新推荐文章于 2025-04-14 09:59:42 发布