CentOS stream 9配置网卡

CentOS stream9的网卡和centos 7的配置路径:/etc/sysconfig/network-scripts/ifcfg-ens32不一样。

CentOS stream 9的网卡路径:

复制代码
/etc/NetworkManager/system-connections/ens32.nmconnection

方法一:

复制代码
[connection]
id=ens32
uuid=426b60a4-4602-3bf0-b9c0-9e2d8b8451f3
type=ethernet
autoconnect-priority=-999
interface-name=ens32
timestamp=1705281331

[ethernet]

[ipv4]
#method=auto #动态
method=manual #静态
address=10.10.10.28/24,10.10.10.254 #第一个是自定义ip,子网掩码长度,网关
dns=8.8.8.8;114.114.114.114 #dns

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

[proxy]

方法二:

1.查看自己windos电脑的DNS配置:

复制代码
"win+r"输入"cmd"回车

C:\Users\admin>ipconfig /all
...
以太网适配器 以太网 13:

   连接特定的 DNS 后缀 . . . . . . . :
   描述. . . . . . . . . . . . . . . : ASIX AX88772D USB 2.0 to Fast Ethernet Adapter #2
   物理地址. . . . . . . . . . . . . : F8-E4-3B-0E-2F-00
   DHCP 已启用 . . . . . . . . . . . : 是
   自动配置已启用. . . . . . . . . . : 是
   本地链接 IPv6 地址. . . . . . . . : fe80::7dff:589c:3705:qwert12345(首选)
   IPv4 地址 . . . . . . . . . . . . : 10.10.10.24(首选)
   子网掩码  . . . . . . . . . . . . : 255.255.254.0
   获得租约的时间  . . . . . . . . . : 2024年1月15日 12:17:48
   租约过期的时间  . . . . . . . . . : 2024年1月20日 12:17:48
   默认网关. . . . . . . . . . . . . : 10.10.10.254
   DHCP 服务器 . . . . . . . . . . . : 10.10.10.254
   DHCPv6 IAID . . . . . . . . . . . : 620291100
   DHCPv6 客户端 DUID  . . . . . . . : 00-01-00-01-27-E4-DD-BF-7C-8A-E1-73-00-00
   DNS 服务器  . . . . . . . . . . . : 10.10.1.24
                                       10.20.90.3
   TCPIP 上的 NetBIOS  . . . . . . . : 已启用
...

找到自己的网卡:

DNS地址:

复制代码
10.10.1.24
10.20.90.3

2.查看自己刚刚安装linux的CentOS stream 9的dns地址:

复制代码
[root@localhost ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 10.10.1.24
nameserver 10.20.90.3

网卡配置:

复制代码
[connection]
id=ens32
uuid=426b60a4-4602-3bf0-b9c0-9e2d8b8451f3
type=ethernet
autoconnect-priority=-999
interface-name=ens32
timestamp=1705281331

[ethernet]

[ipv4]
#method=auto #动态
method=manual #静态
address=10.10.10.28/24,10.10.10.254 #第一个是自定义ip,子网掩码长度,网关
dns=10.10.1.24;10.20.90.3;8.8.8.8;114.114.114.114 #dns

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

[proxy]

重新加载网卡:

复制代码
nmcli c reload
nmcli c up ens32

验证:

复制代码
[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (110.242.68.3) 56(84) 比特的数据。
64 比特,来自 110.242.68.3 (110.242.68.3): icmp_seq=1 ttl=43 时间=54.7 毫秒
64 比特,来自 110.242.68.3 (110.242.68.3): icmp_seq=2 ttl=43 时间=52.3 毫秒
64 比特,来自 110.242.68.3 (110.242.68.3): icmp_seq=3 ttl=43 时间=124 毫秒
64 比特,来自 110.242.68.3 (110.242.68.3): icmp_seq=4 ttl=43 时间=80.7 毫秒
64 比特,来自 110.242.68.3 (110.242.68.3): icmp_seq=5 ttl=43 时间=51.0 毫秒
64 比特,来自 110.242.68.3 (110.242.68.3): icmp_seq=6 ttl=43 时间=53.7 毫秒
64 比特,来自 110.242.68.3 (110.242.68.3): icmp_seq=7 ttl=43 时间=50.8 毫秒
64 比特,来自 110.242.68.3 (110.242.68.3): icmp_seq=8 ttl=43 时间=53.7 毫秒
^C
--- www.a.shifen.com ping 统计 ---
已发送 8 个包, 已接收 8 个包, 0% packet loss, time 7008ms
rtt min/avg/max/mdev = 50.843/65.090/123.722/24.013 ms

在验证过程中使用第二个方法ping百度比一个方法返回值快些。

相关推荐
真正的醒悟19 小时前
2025【1460天】网络工程师经验之道
运维·服务器
Nimsolax19 小时前
Linux信号
linux
ajassi20001 天前
开源 C++ QT Widget 开发(十五)多媒体--音频播放
linux·c++·qt·开源
JosieBook1 天前
【远程运维】Linux 远程连接 Windows 好用的软件:MobaXterm 实战指南
linux·运维·windows
文档搬运工1 天前
Linux MInt启动速度的优化
linux
Broken Arrows1 天前
Linux学习——管理网络安全(二十一)
linux·学习·web安全
Light601 天前
领码方案|Linux 下 PLT → PDF 转换服务超级完整版:异步、权限、进度
linux·pdf·可观测性·异步队列·plt转pdf·权限治理·进度查询
羚羊角uou1 天前
【Linux】命名管道
linux·运维·服务器
IT 小阿姨(数据库)1 天前
PgSQL监控死元组和自动清理状态的SQL语句执行报错ERROR: division by zero原因分析和解决方法
linux·运维·数据库·sql·postgresql·centos
THMAIL1 天前
量化股票从贫穷到财务自由之路 - 零基础搭建Python量化环境:Anaconda、Jupyter实战指南
linux·人工智能·python·深度学习·机器学习·金融