ubuntu 设置静态IP
一、
ip address
sudo nano /etc/netplan/50-cloud-init.yaml
修改前:
修改后:
====================================================================
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
enp0s3:
dhcp4: no
addresses: [192.168.31.142/24]
optional: true
routes:
- to: default
via: 192.168.31.1
nameservers:
addresses: [114.114.114.114,8.8.8.8]
version: 2
====================================================================
sudo netplan apply #生效
原文地址:https://blog.csdn.net/xiaoxionglove/article/details/142601636
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!