ubuntu 设置静态IP

一、

bash 复制代码
ip address

sudo nano /etc/netplan/50-cloud-init.yaml

修改前:

修改后:

bash 复制代码
====================================================================
# 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
====================================================================
bash 复制代码
sudo netplan apply #生效

相关推荐
CS_Zero14 小时前
安卓开发:Linux的android工具命令
android·linux·运维
何中应14 小时前
Grafana如何安装插件
运维·grafana·可观测
女神下凡14 小时前
芯参谋(84):Linux eMMC 驱动开发指南
linux·运维·arm开发·驱动开发·单片机·嵌入式硬件
SEO-狼术15 小时前
Aspose.Email for .NET 26 Crack
运维·服务器
vortex515 小时前
Windows Server IIS 运维配置指南:架构、身份、安全与排障
运维·windows·架构
无足鸟ICT1 天前
【RHCA+】vmstat命令(监控系统资源)
linux·服务器
闪亮的路灯1 天前
Linux 安装mqtt服务mosquitto
linux·运维·服务器
HideF1 天前
nmcli
linux·服务器·网络
qetfw1 天前
UOS DHCP Relay:跨网段分配与 IP、DNS、网关验证
linux·服务器·网络·tcp/ip·uos
szxinmai主板定制专家1 天前
X86 工控机 vs RK3588 异构主控:AMR 控制器 BOM、散热、长期运维对比
运维·stm32·单片机·嵌入式硬件·fpga开发·am62x