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 #生效

相关推荐
cui_ruicheng1 小时前
Linux进程间通信(三):System V IPC与共享内存
linux·运维·服务器
蚰蜒螟1 小时前
深入 Linux 内核同步机制:从 futex 到 spinlock 的完整旅程
linux·windows·microsoft
运维全栈笔记1 小时前
Linux安装配置Tomcat保姆级教程:从部署到性能调优
linux·服务器·中间件·tomcat·apache·web
dllmayday2 小时前
Linux 上用终端连接 WiFi
linux·服务器·windows
ACP广源盛139246256732 小时前
IX8024与科学大模型的碰撞@ACP#筑牢科研 AI 算力高速枢纽分享
运维·服务器·网络·数据库·人工智能·嵌入式硬件·电脑
峥无3 小时前
Linux系统编程基石:静态库·动态库·ELF文件·进程地址空间全景图
linux·运维·服务器
用户2367829801684 小时前
从 chmod 755 说起:Unix 文件权限到底是怎么算的?
linux
码云数智-大飞4 小时前
本地部署大模型:隐私安全与多元优势一站式解读
运维·网络·人工智能
Strugglingler4 小时前
【systemctl 学习总结】
linux·systemd·systemctl·journalctl·unit file
全球通史4 小时前
RDKS100 GPU量化环境配置
ubuntu