ubuntu 20在虚拟机桥接模式下设置固定ip

设置配置文件,不同系统文件名可能不同:
/etc/netplan/01-network-manager-all.yaml
修改文件内容,自己修改对应ip地址和网关:

# Let NetworkManager manage all devices on this system
#network:
network:
  ethernets:
    enp0s3:
      dhcp4: false
      addresses: [192.168.0.105/24]
      gateway4: 192.168.0.1
      nameservers:
        addresses: [8.8.8.8,114.114.114.114]

使配置生效:

sudo netplan apply

查询ip地址是否改变:

ifconfig

猜你喜欢

转载自blog.csdn.net/niu_88/article/details/121259187