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

相关推荐
Championship.23.246 小时前
Linux 3.0 锁机制与故障排查详解
linux·运维·服务器
天疆说6 小时前
Zotero Connector 在 Edge 里找不到桌面 Zotero(Linux / Zotero 9.0.6 / Edge 150)
linux·前端·edge
风123456789~8 小时前
【Linux专栏】ls 排除某个文件
linux·运维·服务器
IT曙光9 小时前
ubuntu apt-get离线源制作
linux·ubuntu
其实防守也摸鱼9 小时前
运维--学习阶段问题解答(1)(自测)
linux·运维·服务器·数据库·学习·自动化·命令模式
懒鸟一枚9 小时前
深入理解 Linux 内存、Swap 交换分区与分页机制的关系
java·linux·数据库
Darkwanderor11 小时前
对Linux的进程控制的研究
linux·运维·c++
bksczm13 小时前
linux之线程概念和控制
linux·开发语言·c++
爱网络爱Linux14 小时前
Linux proc 目录安全加固
linux·运维·rhce·rhca·红帽认证·proc 目录安全加固
hehelm14 小时前
Linux网络编程—TCP字典翻译系统
linux·开发语言·网络·c++·tcp/ip