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

相关推荐
负二代0.014 分钟前
Linux下的网络管理
linux·网络
有毒的教程34 分钟前
SaltStack 开源自动化运维工具详细介绍
运维·开源·saltstack
s_daqing42 分钟前
ubuntu(arm)安装redis
linux·redis·ubuntu
大房身镇、王师傅1 小时前
【VirtualBox】VirtualBox 7.1.6 RockyLinux10 配置增强功能 设置共享目录
运维·服务器·virtualbox·rockylinux10
林鸿群1 小时前
ubuntu 26.04 安装mysql-server
linux·mysql·ubuntu
betazhou1 小时前
rsync使用案例分析
linux·运维·服务器·rsync·同步数据
安静的技术开发者1 小时前
Linux Ubuntu学习笔记
linux·ubuntu
geshifei2 小时前
Sched ext回调1——init_task (linux 6.15.7)
linux·ebpf
晚风予卿云月2 小时前
【Linux】自动化构建—make/Makefile
linux·自动化·make/makefile
minglie12 小时前
谷歌浏览器搜索技巧
运维