Ubuntu18设置静态IP

1、编辑配置文件

#打开配置文件
vi /etc/netplan/xxx.ymal

#其中enp0s3为固定ip
#其中enp0s8为dhcp
network:
    ethernets:
        enp0s3:
            addresses: [172.16.172.100/24]
            dhcp4: false
            gateway4: 172.16.172.2
            dhcp6: false
            optional: true
        enp0s8:
            addresses: []
            dhcp4: true
            optional: true
    version: 2

2、启用配置

netplan apply 

Leave a Reply

Your email address will not be published. Required fields are marked *

*