UbuntuServer22.04配置静态IP地址

查看网络配置文件

使用命令, 查看网络配置文件

bash 复制代码
ls -l /etc/netplan/

输出如下(文件名可能不同, 以实际查询为准)

复制代码
-rw------- 1 root root 191 Mar 17 03:30 00-installer-config.yaml

编辑文件即可修改网络配置

bash 复制代码
sudo vim /etc/netplan/00-installer-config.yaml

配置参考

静态 IP 配置

yml 复制代码
network:
    ethernets:
        enxf8e43bf186b0:
            dhcp4: true
            nameservers:
                addresses: [223.5.5.5,223.6.6.6]
    version: 2

动态IP地址配置

yml 复制代码
network:
    ethernets:
        enxf8e43bf186b0:
            dhcp4: no
            addresses: [192.168.59.101/24]
            gateway4: 192.168.59.1
            nameservers:
                addresses: [223.5.5.5,223.6.6.6]
    version: 2

enxf8e43bf186b0 为网卡名, 每台电脑都不相同,可以使用名 ip addr 查询

相关推荐
物联网老王4 小时前
Ubuntu Linux Cursor 安装与使用一
linux·运维·ubuntu
一位摩羯座DBA6 小时前
Redhat&Centos挂载镜像
linux·运维·centos
学习3人组6 小时前
CentOS配置网络
linux·网络·centos
weixin_307779136 小时前
Hive集群之间迁移的Linux Shell脚本
大数据·linux·hive·bash·迁移学习
漫步企鹅7 小时前
【蓝牙】Linux Qt4查看已经配对的蓝牙信息
linux·qt·蓝牙·配对
cui_win7 小时前
【网络】Linux 内核优化实战 - net.core.flow_limit_table_len
linux·运维·网络
梦在深巷、7 小时前
MySQL/MariaDB数据库主从复制之基于二进制日志的方式
linux·数据库·mysql·mariadb
冰橙子id8 小时前
linux系统安全
linux·安全·系统安全
stark张宇8 小时前
VMware 虚拟机装 Linux Centos 7.9 保姆级教程(附资源包)
linux·后端
Johny_Zhao8 小时前
Ubuntu系统安装部署Pandawiki智能知识库
linux·mysql·网络安全·信息安全·云计算·shell·yum源·系统运维·itsm·pandawiki