eth0和eth1在启动时都分配了相同的IP地址

我在Sun Fire x4140上安装了一个物理SLES 11 SP2服务器,在重启后给我带来了networking问题。 网卡在机载。

在启动过程中networking看起来很成功,但是networking服务(如nfs)却很难实现。 这是因为eth0和eth1都接收到相同的configuration,并且都是ifup-ed。 一旦所有东西都出来了,我在控制台上,ifconfig显示eth0和eth1是UP的,并且运行着相同的IP。 尝试ping该子网中的任何内容都失败。 重新启动networking服务可以解决问题。

eth0是根据MAC地址应该configuration为主要的正确NIC。

问题:什么导致eth1被提出与eth0相同的configuration?

我没有为eth1设置configuration脚本:

banjer@harp:~> ls -la /etc/sysconfig/network/ total 104 drwxr-xr-x 6 root root 4096 Jun 11 12:21 . drwxr-xr-x 6 root root 4096 Apr 10 09:46 .. -rw-r--r-- 1 root root 13916 Apr 10 09:32 config -rw-r--r-- 1 root root 9952 Apr 10 09:36 dhcp -rw------- 1 root root 180 Jun 11 12:21 ifcfg-eth0 -rw------- 1 root root 180 Jun 11 12:21 ifcfg-eth3 -rw------- 1 root root 172 Feb 1 08:32 ifcfg-lo -rw-r--r-- 1 root root 29333 Feb 1 08:32 ifcfg.template drwxr-xr-x 2 root root 4096 Apr 10 09:32 if-down.d -rw-r--r-- 1 root root 239 Feb 1 08:32 ifroute-lo drwxr-xr-x 2 root root 4096 Apr 10 09:33 if-up.d drwx------ 2 root root 4096 May 5 2010 providers -rw-r--r-- 1 root root 25 Nov 16 2010 routes drwxr-xr-x 2 root root 4096 Apr 10 09:36 scripts 

另外,eth3还configuration了一个不同子网中的IP,但是这并没有带来任何问题。 FYI正在使用的内核模块是forcedeth

 banjer@harp:~> sudo cat /etc/sysconfig/network/ifcfg-eth0 BOOTPROTO='static' BROADCAST='' ETHTOOL_OPTIONS='' IPADDR='172.21.64.25/20' MTU='' NAME='MCP55 Ethernet' NETWORK='' REMOTE_IPADDR='' STARTMODE='auto' USERCONTROL='no' ONBOOT="yes" 

如果您需要查看它,以下是eth3:

 banjer@harp:~> sudo cat /etc/sysconfig/network/ifcfg-eth3 BOOTPROTO='static' BROADCAST='' ETHTOOL_OPTIONS='' IPADDR='172.11.200.4/24' MTU='' NAME='MCP55 Ethernet' NETWORK='' REMOTE_IPADDR='' STARTMODE='auto' USERCONTROL='no' ONBOOT="yes" 

也许是与udev有关的东西? 70-persistent-net-rules对我来说看起来不错,但我可能完全不了解它。

 banjer@harp:~> 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 0x10de:0x0373 (forcedeth) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:18:4f:8d:85:4c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2" # PCI device 0x10de:0x0373 (forcedeth) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:18:4f:8d:85:4a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" # PCI device 0x10de:0x0373 (forcedeth) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:18:4f:8d:85:4b", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1" # PCI device 0x10de:0x0373 (forcedeth) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:18:4f:8d:85:4d", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3" # PCI device 0x1077:0x3032 (qla3xxx) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:c1:dd:0e:34:6c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4" 

任何其他的想法是什么会导致这个?

更新1

根据build议,我给所有其他网卡没有被使用的configuration(eth1和eth2),例如这里是eth1:

 banjer@harp:/etc/sysconfig/network> sudo cat ifcfg-eth1 BOOTPROTO='static' BROADCAST='' ETHTOOL_OPTIONS='' IPADDR='' MTU='' NAME='MCP55 Ethernet' NETMASK='255.255.255.0' NETWORK='' REMOTE_IPADDR='' STARTMODE='off' ONBOOT='no' USERCONTROL='no' 

并将特定的HWADDR添加到实际插入的NIC(eth0和eth3)中。 在testing重新启动期间,我看到networking正如预期的那样出现,eth1和eth2按预期“跳过”。 然而,eth1仍然是由eth0的configuration引起的。

我在/etc/udev/udev.conf设置了udev_log="debug" ,现在我在/var/log/messages有一堆debugging/var/log/messages 。 这里是 grep eth1 /var/log/messages 的粘贴 ,但是当与其他eth的grep进行比较时,我看不到任何东西。

更新2

想到这是一个udev问题,我对/lib/udev/rules.d/75-persistent-net-generator.rules进行了更改,并且执行了rm /etc/udev/rules.d/70-persistent-net.rules

 # device name whitelist #KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end" KERNEL!="eth[03]|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end" 

重新启动后,这正是我想要的(为eth0,eth3生成规则),但没有解决问题。 eth1还是长大了。 有没有办法debugging整个启动过程,例如strace? 我不知道这是从哪里来的。

作为一个创可贴,我正在添加一个rc脚本来在启动过程中重启networking。

你说你没有eth1的configuration脚本。 为什么不? 它应该configuration或不? 如果是,那么应该有什么IP。 静态分配或DHCP?

这些问题让你思考,顺便说一句,不一定要在这里回答。

尝试为eth1创build一个configuration,即使它只是ONBOOT =“no”的最小configuration,suse可能会做一些疯狂的默认automagic废话,如果没有configuration文件。

使configuration文件更具体应该帮助。 将以下指令添加到您的ifcfg-ethX文件中:

 DEVICE=eth0 HWADDR=00:18:4f:8d:85:4a 

冲洗,起泡,重复为eth3等

你可以(应该?)为eth1等添加configuration文件:

 DEVICE=eth1 HWADDR=00:18:4f:8d:85:4b ONBOOT=no 

尝试添加:

 HWADDR='00:18:4f:8d:85:4a' 

/etc/sysconfig/network-scripts/ifcfg-eth0 。 您可能还想创build一个包含如下所示的ifcfg-eth1

 DEVICE='eth1' BOOTPROTO='none' HWADDR='00:18:4f:8d:85:4b' USERCONTROL='no' ONBOOT='yes' 

至less在RHEL上,它只是提供没有IPconfiguration的接口,在SuSE 11上的联网init脚本看起来类似。关于SuSEnetworkingconfiguration的另一个解决scheme是用类似下面的方法清除70-persistent-net.rules

 cat < /dev/null > /etc/udev/rules.d/70-persistent-net.rules 

这将清除udev规则并告诉init使用ifcfg-eth *文件进行接口识别。

我无法确定两个NIC在启动时configuration相同的IP和子网的神秘背后的原因。

但是,最终的解决scheme是将电缆从第一个NIC移到第二个NIC,即从eth0到eth1。 然后我configuration了ifcfg-eth1和“unconfigured”ifcfg-eth0。 现在我的networking和networking依赖的服务完美地出现了。

我知道这可能是一个forcedeth模块,也可能是一个BIOS问题,但我不会花费更多的时间,因为我们现在正在用完全不同的硬件构build服务器,并从SLES迁移到CentOS,所以我不希望这个问题再次出现。