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

这样就成功配置了网卡了

相关推荐
咚为16 分钟前
比AccessLog更全面的原生Nginx 日志记录
运维·nginx·junit
我星期八休息22 分钟前
Linux系统编程—基础IO
linux·运维·服务器·c语言·c++·人工智能·算法
Shingmc327 分钟前
【Linux】数据链路层
linux·服务器·网络
a752066281 小时前
零基础实操:小龙虾 AI OpenClaw 接入 Kimi 详细步骤
运维·服务器
KK溜了溜了1 小时前
Python从入门到精通
服务器·开发语言·python
bksczm1 小时前
文件描述符
linux
Goldbioinformatics1 小时前
Windows版Claude Cowork启动Linux问题
linux·运维·windows
念恒123061 小时前
Ext系列文件系统(下)
linux·运维·服务器
小贾要学习1 小时前
【Linux】Linux高性能IO多路复用:epoll全方位详解(从原理到实战)
linux·服务器·网络