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

这样就成功配置了网卡了

相关推荐
海盗12349 分钟前
VMware 中 CentOS 7 无法使用 yum 安装 wget 的完整解决方案
linux·运维·centos
小宇的天下10 分钟前
Synopsys Technology File and Routing Rules Reference Manual (1)
java·服务器·前端
kida_yuan21 分钟前
【Linux】在树莓派上搭建自建 Git 服务(基于 GitLab)- 实战笔记与运维清单
运维·gitlab·树莓派
lph00925 分钟前
mqtt broker (mosquitto)创建服务器、订阅与发布
运维·服务器
by————组态40 分钟前
睿控(Ricon)组态
运维·前端·物联网·信息可视化·组态·组态软件
酒醉的胡铁41 分钟前
uniapp运行到鸿蒙证书配置
服务器·uni-app·harmonyos
戈壁老孙1 小时前
使用Nginx实现动态后端服务切换:一套配置管理多环境
运维·nginx
gtr20201 小时前
Ubuntu24.04 基于 EtherCAT 的 SVD60N 主站
linux·ethercat
weixin_462446231 小时前
ubuntu真机安装tljh jupyterhub支持跨域iframe
linux·运维·ubuntu
小码吃趴菜1 小时前
select/poll/epoll 核心区别
linux