服务器操作系统为XenServer,在更换主板后,系统无法找到网卡。这是因为主板更换后,需要重新激活网卡(Network Interface Card,简称:NIC),在XenServer记录的是以前网卡中的MAC地址,需要重新更新下!
解决方案:
1,像这种情况,一般都是通过远程KVM/IPMI链接到服务器处理,或者叫机房人员处理。
2,登录上服务器的命令行,开始更新网卡信息
①,通过下面的命令,找到老MAC的UUID
xe pif-list
uuid ( RO) : 6816c0f9-1100-eab4-1c90-5cf189772d3d
device ( RO): eth0
currently-attached ( RO): true
VLAN ( RO): -1
network-uuid ( RO): 3e75f091-a744-805c-7cee-3225defb8cde
②,从XenServer中删掉老MAC的UUID
xe pif-forget uuid=6816c0f9-1100-eab4-1c90-5cf189772d3d
③,运行下面的命令,获取新的网卡的MAC地址
ifconfig –a
eth0 Link encap:Ethernet HWaddr 00:25:90:03:2F:F8
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2805226683 errors:0 dropped:3751 overruns:0 frame:0
TX packets:1109860936 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:807885103 (770.4 MiB) TX bytes:2385065327 (2.2 GiB)
Interrupt:16 Memory:fb5e0000-fb600000
④,找到服务器的UUID
xe host-list
uuid ( RO) : 9e7a38ef-e2b2-474a-8503-4cb4da161bfc
name-label ( RW): 114
name-description (RW): Default install of XenServer
⑤,运行下面的命令添加网卡与设备的MAC信息
xe pif-introduce device=eth0 host-uuid=9e7a38ef-e2b2-474a-8503-4cb4da161bfc mac=00:25:90:03:2F:F8
⑥,检查网卡是运行的
ifconfig
lo Link encap: Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:11940991 errors:0 dropped:0 overruns:0 frame:0
TX packets:11940991 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2022330535 (1.8 GiB) TX bytes:2022330535 (1.8 GiB)
Note: eth0 does not appear in the output.
⑦,运行下面的命令激活接口
ifup eth0
⑧,检查这个网卡是否激活,更新成功
cat /etc/sysconfig/network-scripts/ifcfg-eth0
# DO NOT EDIT: This file (ifcfg-eth0) was autogenerated by interface-reconfigure
XEMANAGED=yes
DEVICE=eth0
ONBOOT=no
TYPE=Ethernet
HWADDR=00:25:90:03:2f:f8
ETHTOOL_OFFLOAD_OPTS=”gro off lro off”
MTU=1500
BRIDGE=xenbr0
⑨,如果MAC是不正确的,请运行以下命令来编辑该文件,并更新MAC地址
vi /etc/sysconfig/network-scripts/ifcfg-eth0
# DO NOT EDIT: This file (ifcfg-eth0) was autogenerated by interface-reconfigure
XEMANAGED=yes
DEVICE=eth0
ONBOOT=no
TYPE=Ethernet
HWADDR=00:25:90:03:2f:f8 (改为正确的MAC地址)
ETHTOOL_OFFLOAD_OPTS=”gro off lro off”
MTU=1500
BRIDGE=xenbr0
⑩,运行下面的命令激活网卡或刷新连接的状态
xe pif-scan host-uuid=xxxx
到此步已经完成了XenServer网卡的更新
3,接下就是重新把服务器的IP设置下(可能由于第二步操作,清除了之前的IP信息)
回到XenServer控制台
xsconsole
选择 “ Network and Management Interface” — “Configure Management Interface”,一步步的重新设置IP