一、故障表现
主板为技嘉B560M AORUS PRO AX,系统为PVE 7.0-8,早起为了用sas盘,搞了sas背板的几箱以及直通卡,所以在pcie X16的接口上插了直通卡,结果因为一些原因全买了sata盘,导致换了机箱,所以为了回血把老机箱和直通卡都想出掉,后面换了机箱之后拔掉直通卡,发现网络不通,无法连接,后面通过显示器直连主机,发现系统已经正常启动,但是网络不通,于是使用lspci查看网卡状态
#未拔直通卡时的状态 02:00.0 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01) 02:00.1 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01) 03:00.0 Ethernet controller: Intel Corporation Ethernet Controller I225-V (rev 03) 06:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04) 09:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04) #拔掉直通卡后的状态 01:00.0 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01) 01:00.1 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01) 02:00.0 Ethernet controller: Intel Corporation Ethernet Controller I225-V (rev 03) 05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04) 08:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04) 可以看到序号都前移的一位,网卡名称未拔直通卡时为enp3s0,拔掉直通卡后变成enp2s0,刚好与lspci中的序号对应,所以怀疑直通卡因为是连接磁盘的,顺位要比网卡高,所以直通卡在的时候第一个位置给了直通卡,其他的都后移一位,只是怀疑,未查到相关资料。期间问了下技嘉售后,表述windows系统外,概不负责,也是比较失望吧。
二、问题处理
知道问题之后就有应对之策了,修改网络配置,#为原来的配置,重启网络,ifconfig enp2s0 down,ifconfig enp2s0 up
vi /etc/network/interfaces # please utilize the 'source' or 'source-directory' directives to do # so. # PVE will preserve these directives, but will NOT read its network # configuration from sourced files, so do not attempt to move any of # the PVE managed interfaces into external files! auto lo iface lo inet loopback #iface enp3s0 inet manual iface enp2s0 inet manual iface enp6s0 inet manual iface enp9s0 inet manual iface enp2s0f0 inet manual iface wlp10s0 inet manual iface enp2s0f1 inet manual auto vmbr0 iface vmbr0 inet static address 192.168.1.181/24 gateway 192.168.1.1 #bridge-ports enp3s0 bridge-ports enp2s0 bridge-stp off bridge-fd 0
pve虚拟机通过配置文件,修改直通设备,#为原来的配置,执行启动qm start 104
vi /etc/pve/qemu-server/104.conf boot: order=sata0;ide2;net0 cores: 2 #hostpci0: 0000:06:00.0 #hostpci1: 0000:09:00.0 #hostpci2: 0000:02:00.0 #hostpci3: 0000:02:00.1 hostpci0: 0000:05:00.0 hostpci1: 0000:08:00.0 hostpci2: 0000:01:00.0 hostpci3: 0000:01:00.1 ide2: none,media=cdrom memory: 4096 name: openwrt net0: virtio=A6:8F:AF:42:6A:65,bridge=vmbr0,firewall=1 numa: 0 onboot: 1 ostype: l26 sata0: local-lvm:vm-104-disk-1,size=1584M scsihw: virtio-scsi-pci smbios1: uuid=9798e59d-b79a-4184-aa23-e731ba7541ec sockets: 4 vmgenid: 17d3ed4d-9cc0-431b-ba84-ba2415823f16