
CentOS stream9的网卡和centos 7的配置路径/etc/sysconfig/network-scripts/ifcfg-ens32不一样。CentOS stream 9的网卡路径/etc/NetworkManager/system-connections/ens32.nmconnection 也可能是ens33.nmconnection方法一[connection] idens32 uuid426b60a4-4602-3bf0-b9c0-9e2d8b8451f3 typeethernet autoconnect-priority-999 interface-nameens32 timestamp1705281331 [ethernet] [ipv4] #methodauto #动态 methodmanual #静态 address10.10.10.28/24,10.10.10.254 #第一个是自定义ip子网掩码长度网关 dns8.8.8.8;114.114.114.114 #dns [ipv6] addr-gen-modeeui64 methodauto [proxy]方法二1.查看自己windos电脑的DNS配置winr输入cmd回车C:\Users\adminipconfig /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.32.查看自己刚刚安装linux的CentOS stream 9的dns地址[rootlocalhost ~]# cat /etc/resolv.conf # Generated by NetworkManager nameserver 10.10.1.24 nameserver 10.20.90.3网卡配置[connection] idens32 uuid426b60a4-4602-3bf0-b9c0-9e2d8b8451f3 typeethernet autoconnect-priority-999 interface-nameens32 timestamp1705281331 [ethernet] [ipv4] #methodauto #动态 methodmanual #静态 address10.10.10.28/24,10.10.10.254 #第一个是自定义ip子网掩码长度网关 dns10.10.1.24;10.20.90.3;8.8.8.8;114.114.114.114 #dns [ipv6] addr-gen-modeeui64 methodauto [proxy]重新加载网卡nmcli c reload nmcli c up ens32 或者nmcli c up ens33验证[rootlocalhost ~]# 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_seq1 ttl43 时间54.7 毫秒 64 比特来自 110.242.68.3 (110.242.68.3): icmp_seq2 ttl43 时间52.3 毫秒 64 比特来自 110.242.68.3 (110.242.68.3): icmp_seq3 ttl43 时间124 毫秒 64 比特来自 110.242.68.3 (110.242.68.3): icmp_seq4 ttl43 时间80.7 毫秒 64 比特来自 110.242.68.3 (110.242.68.3): icmp_seq5 ttl43 时间51.0 毫秒 64 比特来自 110.242.68.3 (110.242.68.3): icmp_seq6 ttl43 时间53.7 毫秒 64 比特来自 110.242.68.3 (110.242.68.3): icmp_seq7 ttl43 时间50.8 毫秒 64 比特来自 110.242.68.3 (110.242.68.3): icmp_seq8 ttl43 时间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百度比一个方法返回值快些。