找回密码
 register

QQ登录

只需一步,快速开始

[*网络运维*] Proxmox VE (PVE 8) 在多网卡环境下判断管理接口并避免配置错误

[复制链接]

[*网络运维*] Proxmox VE (PVE 8) 在多网卡环境下判断管理接口并避免配置错误

[复制链接]
Waylee

主题

0

回帖

1万

积分

仙帝

积分
10124
Waylee 2024-9-28 14:30 | 显示全部楼层 |阅读模式

马上注册,查看网站隐藏内容!!

您需要 登录 才可以下载或查看,没有账号?register

×
案例环境:有多张网卡,怎么去判断你的管理是接的哪一个呢?
在有多张网卡的服务器上,尤其是进行虚拟化管理(如PVE环境)时,准确定位管理网卡显得尤为重要。本文通过实际案例,展示如何逐步判断服务器的管理接口接在哪张网卡上,确保配置准确,避免错误操作导致管理系统失联。
一、查看PCI设备信息
首先,我们通过 lspci 查看所有网卡的PCI设备信息:
➜  ~ lspci
0000:03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04)
0000:04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04)
0000:05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04)
0000:06:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04)
0000:0a:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)

虽然这里看到rev 04和rev 05,这里代表的是硬件版本号(Revision ID),但是我们架设我们两张卡都是这个类型,就没办法判断了哦。
二、查看网络配置
通过 ip addr 命令查看网络接口的状态和 IP 地址信息:
➜  ~ ip addr
6: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vmbr0 state UP group default qlen 1000
    link/ether c8:28:88:88:f8:38 brd ff:ff:ff:ff:ff:ff
    altname enp10s0
7: vmbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether c8:28:88:88:f8:38 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.4/24 scope global vmbr0
       valid_lft forever preferred_lft forever
    inet6 288e:380:4848:f808:8828:a8f8:f838:8f88/64 scope global dynamic mngtmpaddr 
       valid_lft 44486sec preferred_lft 44486sec
    inet6 fe80::ce28:aaff:fe34:ff3d/64 scope link 
       valid_lft forever preferred_lft forever

从这里可以看出,你的管理接口是vmbr0,它绑定了192.168.0.4/24的IP地址,物理网卡是eno1 作为 vmbr0 的下层接口,它的MAC地址是c8:28:88:88:f8:38,代表该网卡是服务器的管理接口。
三、查看PCI设备详细信息
通过 lspci -v 可以进一步查看网卡的详细信息:
➜  ~ lspci -v 
0000:03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04)
        Subsystem: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller
        Flags: fast devsel, IRQ 16, IOMMU group 17
        I/O ports at 6000 
        Memory at 86110000 (64-bit, non-prefetchable) [size=64K]
        Memory at 86120000 (64-bit, non-prefetchable) [size=16K]
        Expansion ROM at 86100000 [disabled] [size=64K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable+ 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [b0] MSI-X: Enable+ Count=32 Masked-
        Capabilities: [d0] Vital Product Data
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [148] Virtual Channel
        Capabilities: [168] Device Serial Number 00-00-00-00-00-00-00-00
        Capabilities: [178] Transaction Processing Hints
        Capabilities: [204] Latency Tolerance Reporting
        Capabilities: [20c] L1 PM Substates
        Capabilities: [21c] Vendor Specific Information: ID=0002 Rev=4 Len=100 <?>
        Kernel driver in use: r8169
        Kernel modules: r8169

0000:04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04)
        Subsystem: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller
        Flags: fast devsel, IRQ 18, IOMMU group 18
        I/O ports at 5000 
        Memory at 86010000 (64-bit, non-prefetchable) [size=64K]
        Memory at 86020000 (64-bit, non-prefetchable) [size=16K]
        Expansion ROM at 86000000 [disabled] [size=64K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable+ 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [b0] MSI-X: Enable+ Count=32 Masked-
        Capabilities: [d0] Vital Product Data
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [148] Virtual Channel
        Capabilities: [168] Device Serial Number 00-00-00-00-00-00-00-00
        Capabilities: [178] Transaction Processing Hints
        Capabilities: [204] Latency Tolerance Reporting
        Capabilities: [20c] L1 PM Substates
        Capabilities: [21c] Vendor Specific Information: ID=0002 Rev=4 Len=100 <?>
        Kernel driver in use: r8169
        Kernel modules: r8169

0000:05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04)
        Subsystem: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller
        Flags: fast devsel, IRQ 18, IOMMU group 19
        I/O ports at 4000 
        Memory at 85f10000 (64-bit, non-prefetchable) [size=64K]
        Memory at 85f20000 (64-bit, non-prefetchable) [size=16K]
        Expansion ROM at 85f00000 [disabled] [size=64K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable+ 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [b0] MSI-X: Enable+ Count=32 Masked-
        Capabilities: [d0] Vital Product Data
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [148] Virtual Channel
        Capabilities: [168] Device Serial Number 00-00-00-00-00-00-00-00
        Capabilities: [178] Transaction Processing Hints
        Capabilities: [204] Latency Tolerance Reporting
        Capabilities: [20c] L1 PM Substates
        Capabilities: [21c] Vendor Specific Information: ID=0002 Rev=4 Len=100 <?>
        Kernel driver in use: r8169
        Kernel modules: r8169

0000:06:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04)
        Subsystem: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller
        Flags: fast devsel, IRQ 18, IOMMU group 20
        I/O ports at 3000 
        Memory at 85e10000 (64-bit, non-prefetchable) [size=64K]
        Memory at 85e20000 (64-bit, non-prefetchable) [size=16K]
        Expansion ROM at 85e00000 [disabled] [size=64K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable+ 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [b0] MSI-X: Enable+ Count=32 Masked-
        Capabilities: [d0] Vital Product Data
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [148] Virtual Channel
        Capabilities: [168] Device Serial Number 00-00-00-00-00-00-00-00
        Capabilities: [178] Transaction Processing Hints
        Capabilities: [204] Latency Tolerance Reporting
        Capabilities: [20c] L1 PM Substates
        Capabilities: [21c] Vendor Specific Information: ID=0002 Rev=4 Len=100 <?>
        Kernel driver in use: r8169
        Kernel modules: r8169

0000:0a:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)
        DeviceName: RTL8125 2.5GbE Controller
        Subsystem: ASUSTeK Computer Inc. RTL8125 2.5GbE Controller
        Flags: bus master, fast devsel, latency 0, IRQ 18, IOMMU group 21
        I/O ports at 8000 
        Memory at 86200000 (64-bit, non-prefetchable) [size=64K]
        Memory at 86210000 (64-bit, non-prefetchable) [size=16K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable+ 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [b0] MSI-X: Enable+ Count=32 Masked-
        Capabilities: [d0] Vital Product Data
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [148] Virtual Channel
        Capabilities: [168] Device Serial Number 01-00-00-00-68-4c-e0-00
        Capabilities: [178] Transaction Processing Hints
        Capabilities: [204] Latency Tolerance Reporting
        Capabilities: [20c] L1 PM Substates
        Capabilities: [21c] Vendor Specific Information: ID=0002 Rev=4 Len=100 <?>
        Kernel driver in use: r8169
        Kernel modules: r8169
从这个输出中,可以看到 0000:0a:00.0 对应的是 rev 05 版本的网卡。接下来我们需要确认这个设备和管理接口的关联性。
四. 通过 ethtool 确认网卡对应的PCI总线ID
使用 ethtool 查看 eno1 的总线信息,以确认它是否对应 0000:0a:00.0:
➜  ~ ethtool -i eno1
driver: r8169
version: 6.8.4-2-pve
firmware-version: rtl8125b-2_0.0.2 07/13/20
expansion-rom-version: 
bus-info: 0000:0a:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no

ethtool 的输出可以确认,eno1 的总线ID是 0000:0a:00.0,这与 lspci -vrev 05 的设备一致。因此,eno1 确实是连接管理网络的物理网卡。
四. 总结
游客,如果您要查看本帖隐藏内容请回复

您需要登录后才可以回帖 登录 | register

本版积分规则

雪舞知识库 | 浙ICP备15015590号-1 | 萌ICP备20232229号|浙公网安备33048102000118号 |网站地图|天天打卡

GMT+8, 2024-12-5 03:00 , Processed in 0.080073 second(s), 12 queries , Redis On.

Powered by XueWu Licensed

Copyright © Tencent Cloud.

快速回复 返回顶部 返回列表