ubuntu18.04静态ip设置

时间:2022-01-26 20:16:55

1.配置文件

vi /etc/netplan/-cloud-init.yaml
network:
ethernets:
enp129s0f0:
addresses: []
dhcp4: true
optional: true
enp129s0f1:
addresses: [100.100.22.16/]
dhcp4: false
gateway4: 100.100.22.254
nameservers:
addresses: [114.114.114.114,223.5.5.5]
ens4f0:
addresses: []
dhcp4: true
optional: true
ens4f1:
addresses: []
dhcp4: true
optional: true
version:

2.测试

netplan try

3.生效

netplan apply