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百度比一个方法返回值快些。

相关推荐
Lupino7 小时前
我把 OpenClaw 装到服务器上后,才明白它真正该装在哪里(实战复盘)
运维
蝎子莱莱爱打怪9 小时前
ESXi 强制断电后恢复CentOS7虚拟机避坑指南:解决重复注册&目录清理难题
linux·后端·程序员
xlp666hub1 天前
Leetcode第五题:用C++解决盛最多水的容器问题
linux·c++·leetcode
张宏2361 天前
原子操作 (基于Linux 应用层 C 语言)
linux
kymjs张涛2 天前
OpenClaw 学习小组:初识
android·linux·人工智能
程序设计实验室2 天前
经历分享,发现挖矿木马后,服务器快速备份与重装(腾讯云平台)
linux
Miku162 天前
OpenClaw-Linux+飞书官方Plugin安装指南
linux·人工智能·agent
Miku162 天前
OpenClaw 接入 QQ Bot 完整实践指南
linux·人工智能·agent
Yogurt_cry2 天前
[树莓派4B] 闲置近10年的爱普生 L310 打印机爆改无线打印机
linux·物联网·树莓派
爱吃橘子橙子柚子3 天前
3CPU性能排查总结(超详细)【Linux性能优化】
运维·cpu