系统插上PCI网卡每次重启后顺序可能都会不同,影响nagios检控准确度.
CentOS6
在CentOS6中,具体网卡的配置文件在/etc/udev/rules.d/70-persistent-net.rules
cat /etc/udev/rules.d/70-persistent-net.rules
# PCI device 0x14e4:0x163b (bnx2) (custom name provided by external tool)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”78:2b:cb:xx:xx:02″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth1″
# PCI device 0x14e4:0x163b (bnx2) (custom name provided by external tool)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”78:2b:cb:xx:xx:03″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth2″
# USB device 0x9710:0x7830 (usb) (custom name provided by external tool)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:60:6e:xx:xx:f6″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″
# PCI device 0x14e4:0x165a (tg3)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:10:18:xx:xx:51″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth3″
# PCI device 0x8086:0x10c9 (igb)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:1b:21:xx:xx:a1″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth4″
# PCI device 0x8086:0x10c9 (igb)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:1b:21:xx:xx:a0″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth5″
删除(usb),(tg3)并调整bnx2及igb的名称,调整后如下
# PCI device 0x14e4:0x163b (bnx2) (custom name provided by external tool)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”78:2b:cb:xx:xx:02″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″
# PCI device 0x14e4:0x163b (bnx2) (custom name provided by external tool)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”78:2b:cb:xx:xx:03″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth1″
# PCI device 0x8086:0x10c9 (igb)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:1b:21:xx:xx:a1″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth2″
# PCI device 0x8086:0x10c9 (igb)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:1b:21:xx:xx:a0″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth3″
配置网卡文件
同时修改/etc/sysconfig/network-scripts/ifcfg-eth*网卡配置文件,修改设备名和MAC地址和udev对应.
同时注意ip地址和网关.
重启服务器
reboot
centos5.8
dmesg中看到intel的pci网卡先于内置网卡
e1000e: Intel(R) PRO/1000 Network Driver – 1.4.4-k
e1000e: Copyright(c) 1999 – 2011 Intel Corporation.
e1000e 0000:03:00.0: Disabling ASPM L1
GSI 25 sharing vector 0x52 and IRQ 25
ACPI: PCI Interrupt 0000:03:00.0[A] -> GSI 38 (level, low) -> IRQ 82
PCI: Setting latency timer of device 0000:03:00.0 to 64
EDAC MC: Ver: 2.0.1 Feb 21 2012
e1000e 0000:03:00.0: eth0: (PCI Express:2.5GT/s:Width x4) 00:15:17:2d:52:c4
e1000e 0000:03:00.0: eth0: Intel(R) PRO/1000 Network Connection
e1000e 0000:03:00.0: eth0: MAC: 0, PHY: 4, PBA No: D28207-005
e1000e 0000:03:00.1: Disabling ASPM L1
GSI 26 sharing vector 0x62 and IRQ 26
ACPI: PCI Interrupt 0000:03:00.1[B] -> GSI 45 (level, low) -> IRQ 98
PCI: Setting latency timer of device 0000:03:00.1 to 64
sd 0:0:0:0: Attached scsi generic sg0 type 0
sd 0:0:1:0: Attached scsi generic sg1 type 0
scsi 3:0:0:0: Attached scsi generic sg2 type 5
e1000e 0000:03:00.1: eth1: (PCI Express:2.5GT/s:Width x4) 00:15:17:2d:52:c5
e1000e 0000:03:00.1: eth1: Intel(R) PRO/1000 Network Connection
e1000e 0000:03:00.1: eth1: MAC: 0, PHY: 4, PBA No: D28207-005
bnx2: Broadcom NetXtreme II Gigabit Ethernet Driver bnx2 v2.1.11 (July 20, 2011)
GSI 27 sharing vector 0x72 and IRQ 27
ACPI: PCI Interrupt 0000:01:00.0[A] -> GSI 36 (level, low) -> IRQ 114
PCI: Setting latency timer of device 0000:01:00.0 to 64
eth2: Broadcom NetXtreme II BCM5716 1000Base-T (C0) PCI Express found at mem da000000, IRQ 114, node addr 0024e86cd577
GSI 28 sharing vector 0x7A and IRQ 28
ACPI: PCI Interrupt 0000:01:00.1[B] -> GSI 48 (level, low) -> IRQ 122
PCI: Setting latency timer of device 0000:01:00.1 to 64
eth3: Broadcom NetXtreme II BCM5716 1000Base-T (C0) PCI Express found at mem dc000000, IRQ 122, node addr 0024e86cd578
sr0: scsi3-mmc drive: 24x/24x cd/rw xa/form2 cdda tray
cat /etc/udev/rules.d/60-net.rules
ACTION==”add”, SUBSYSTEM==”net”, IMPORT{program}=”/lib/udev/rename_device”
SUBSYSTEM==”net”, RUN+=”/etc/sysconfig/network-scripts/net.hotplug”
查看driver和bus-info
ethtool -i eth0
driver: bnx2
version: 2.1.11
firmware-version: bc 4.6.4 NCSI 1.0.6
bus-info: 0000:01:00.0
ethtool -i eth1
driver: bnx2
version: 2.1.11
firmware-version: bc 4.6.4 NCSI 1.0.6
bus-info: 0000:01:00.1
ethtool -i eth2
driver: e1000e
version: 1.4.4-k
firmware-version: 5.11-2
bus-info: 0000:03:00.0
ethtool -i eth3
driver: e1000e
version: 1.4.4-k
firmware-version: 5.11-2
bus-info: 0000:03:00.1
编辑顺序
DRIVER指driver: e1000e
ID是指bus-info:PCI ID
vi /etc/udev/rules.d/60-net.rules
DRIVER==”bnx2″,ID==”0000:01:00.0″,NAME=”eth0″
DRIVER==”bnx2″,ID==”0000:01:00.1″,NAME=”eth1″
DRIVER==”e1000e”,ID==”0000:03:00.0″,NAME=”eth2″
DRIVER==”e1000e”,ID==”0000:03:00.1″,NAME=”eth3″
重启
reboot
input: PC Speaker as /class/input/input0
bnx2: Broadcom NetXtreme II Gigabit Ethernet Driver bnx2 v2.1.11 (July 20, 2011)
GSI 25 sharing vector 0x52 and IRQ 25
ACPI: PCI Interrupt 0000:01:00.0[A] -> GSI 36 (level, low) -> IRQ 82
PCI: Setting latency timer of device 0000:01:00.0 to 64
eth0: Broadcom NetXtreme II BCM5716 1000Base-T (C0) PCI Express found at mem da000000, IRQ 82, node addr 0024e86cd577
GSI 26 sharing vector 0x5A and IRQ 26
ACPI: PCI Interrupt 0000:01:00.1[B] -> GSI 48 (level, low) -> IRQ 90
PCI: Setting latency timer of device 0000:01:00.1 to 64
eth1: Broadcom NetXtreme II BCM5716 1000Base-T (C0) PCI Express found at mem dc000000, IRQ 90, node addr 0024e86cd578
EDAC MC: Ver: 2.0.1 Feb 21 2012
e1000e: Intel(R) PRO/1000 Network Driver – 1.4.4-k
e1000e: Copyright(c) 1999 – 2011 Intel Corporation.
e1000e 0000:03:00.0: Disabling ASPM L1
GSI 27 sharing vector 0x62 and IRQ 27
ACPI: PCI Interrupt 0000:03:00.0[A] -> GSI 38 (level, low) -> IRQ 98
PCI: Setting latency timer of device 0000:03:00.0 to 64
sd 0:0:0:0: Attached scsi generic sg0 type 0
sd 0:0:1:0: Attached scsi generic sg1 type 0
scsi 3:0:0:0: Attached scsi generic sg2 type 5
e1000e 0000:03:00.0: eth2: (PCI Express:2.5GT/s:Width x4) 00:15:17:2d:52:c4
e1000e 0000:03:00.0: eth2: Intel(R) PRO/1000 Network Connection
e1000e 0000:03:00.0: eth2: MAC: 0, PHY: 4, PBA No: D28207-005
e1000e 0000:03:00.1: Disabling ASPM L1
GSI 28 sharing vector 0x72 and IRQ 28
ACPI: PCI Interrupt 0000:03:00.1[B] -> GSI 45 (level, low) -> IRQ 114
PCI: Setting latency timer of device 0000:03:00.1 to 64
e1000e 0000:03:00.1: eth3: (PCI Express:2.5GT/s:Width x4) 00:15:17:2d:52:c5
e1000e 0000:03:00.1: eth3: Intel(R) PRO/1000 Network Connection
e1000e 0000:03:00.1: eth3: MAC: 0, PHY: 4, PBA No: D28207-005
sr0: scsi3-mmc drive: 24x/24x cd/rw xa/form2 cdda tray
nagios的check_traffic.sh脚本查看顺序
./check_traffic.sh -V 2c -C privatepass -H localhost -L
List Interface for host localhost.
Interface index 1 orresponding to lo
Interface index 2 orresponding to eth0
Interface index 3 orresponding to eth1
Interface index 4 orresponding to eth2
Interface index 5 orresponding to eth3
No Responses (yet)
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.