服务器更换网卡不能通信等问题

1.服务器更换网卡(服务器开机网卡的灯是不亮的)
2.进系统进行网卡配置

[root@bj ~]# cat /etc/udev/rules.d/70-persistent-net.rules 
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key. 
# PCI device 0x8086:0x1521 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:67:38:9b:23", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
# PCI device 0x8086:0x1521 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:67:38:9b:22", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x8086:0x1521 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:67:38:9b:21", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x1521 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:67:38:9b:24", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
# PCI device 0x14e4:0x168e (bnx2x)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0a:f7:5c:7a:50", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"(这是旧网卡的信息)
# PCI device 0x14e4:0x168e (bnx2x)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0a:f7:5c:7a:52", ATTR{type}=="1", KERNEL=="eth*", NAME="eth5"(这是旧网卡的信息)
# PCI device 0x8086:0x10fb (ixgbe)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="90:e2:ba:00:1d:b0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4" (这是新网卡的信息,
把网卡名称换成旧网卡的名称)
# PCI device 0x8086:0x10fb (ixgbe)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="90:e2:ba:00:1d:b1", ATTR{type}=="1", KERNEL=="eth*", NAME="eth5" (这是新网卡的信息,
把网卡名称换成旧网卡的名称)
注意,网卡换过一次就会在这个文件中添加一条记录,这里我们把更换掉的网卡给注释掉了

3.修改网卡的配置文件,把网卡的mac地址给注释掉了
[root@bj ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth4

DEVICE=eth4
#HWADDR=00:0a:f7:5c:7a:50  把网卡的mac地址给注释掉了
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
BRIDGE=cloudbr0
#IPADDR=
#NETMASK=
#GATEWAY=
#DNS1=
#DNS2=


4.重启服务器(查看网卡是亮灯就成功连接到交换机)可以通信

原文地址:https://www.cnblogs.com/zhenhui/p/6179677.html