Linux:Centos9:配置固定ip

centos9的网卡位置移动到了 /etc/NetworkManager/system-connections/ 下面

查看网卡

复制代码
ifconfig

当前有两块网卡,我要去配置ens160的一个固定的ip,让其ip为192.168.6.20/24,网关为192.168.6.254.dns为:1.1.1.1

复制代码
vim /etc/NetworkManager/system-connections/ens160.nmconnection
复制代码
[connection]
id=ens160
uuid=44657eba-8ca8-31e6-b455-88d782c6c395
type=ethernet
autoconnect-priority=-999
interface-name=ens160

[ethernet]

[ipv4]
#method=auto
method=manual
address1=192.168.6.20/24,192.168.6.254
dns=1.1.1.1

[ipv6]
addr-gen-mode=eui64
method=auto

[proxy]

配置完数据后重启网卡

复制代码
nmcli c reload ens160

这样就成功配置了网卡了

相关推荐
十日十行11 小时前
Linux和window共享文件夹
linux
Sinclair15 小时前
简单几步,安卓手机秒变服务器,安装 CMS 程序
android·服务器
木心月转码ing19 小时前
WSL+Cpp开发环境配置
linux
Rockbean2 天前
用40行代码搭建自己的无服务器OCR
服务器·python·deepseek
蝎子莱莱爱打怪2 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
茶杯梦轩2 天前
CompletableFuture 在 项目实战 中 创建异步任务 的核心优势及使用场景
服务器·后端·面试
崔小汤呀2 天前
最全的docker安装笔记,包含CentOS和Ubuntu
linux·后端
何中应2 天前
vi编辑器使用
linux·后端·操作系统
何中应2 天前
Linux进程无法被kill
linux·后端·操作系统
何中应2 天前
rm-rf /命令操作介绍
linux·后端·操作系统