我是 Debian 新手,我的机器有 6 个网卡。这将是一个便宜的路由器,但 Linux 仅为 4 个网卡(eth0...eth3)制作 ethX 设备:
root@dc-02:~# dmesg | grep eth
[ 1.474080] 8139too 0000:00:0c.0: eth0: RealTek RTL8139 at 0xd400, 00:50:ba:ca:90:87, IRQ 19
[ 1.475862] 8139too 0000:00:13.0: eth1: RealTek RTL8139 at 0x7800, 00:c0:df:12:05:1f, IRQ 18
[ 1.477545] eth2: 100/10M Ethernet PCI Adapter at 0001d000, 00:02:44:45:01:84, IRQ 16.
[ 1.479051] eth3: 100/10M Ethernet PCI Adapter at 0001b800, 00:02:44:47:04:b0, IRQ 17.
[ 15.225247] 8139too 0000:00:0c.0: eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1
lspci 显示所有卡:
root@dc-02:~# lspci
. . .
00:0a.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
00:0b.0 Ethernet controller: Device 0000:f640 (rev 10)
00:0c.0 Ethernet controller: D-Link System Inc RTL8139 Ethernet (rev 10)
00:0d.0 Ethernet controller: MYSON Technology Inc SURECOM EP-320X-S 100/10M Ethernet PCI Adapter
00:0e.0 Ethernet controller: MYSON Technology Inc SURECOM EP-320X-S 100/10M Ethernet PCI Adapter
. . .
那么,我该如何打开 eth4 和 eth5?有可能吗?非常感谢,并致以最诚挚的问候。
答案1
因此,当我SURECOM
用基于芯片组 NIC 替换 NIC时RTL8139
,一切都正常。
问题确实出在驱动程序上。非常感谢 DerfK 和 Danila Ladner 的建议。
当时只有一个问题——为每个 NIC 提供“正确的” IP。
我在 Google 上搜索了如何ethX
在 udev 中重命名设备,发现我可以编写规则来通过 udev 命名设备。在 Debian 7 中,此规则已存在/etc/udev/rules.d/70-persistent-net.rules
。我已根据自己的要求编辑了此文件。
root@dc-02:/etc/udev/rules.d# 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 0x1186:/sys/devices/pci0000:00/0000:00:0d.0 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:ba:ca:90:87", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x10ec:/sys/devices/pci0000:00/0000:00:0d.0 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:22:88:86:78", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x10ec:/sys/devices/pci0000:00/0000:00:0a.0 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:22:39:47:4f", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
# PCI device 0x10ec:/sys/devices/pci0000:00/0000:00:13.0 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:22:39:47:64", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
# PCI device 0x10ec:/sys/devices/pci0000:00/0000:00:0b.0 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:40:f4:87:f6:e4", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"
# PCI device 0x10ec:/sys/devices/pci0000:00/0000:00:0a.0 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="4c:00:10:a1:e9:9c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth5"
所以,现在 - 没有任何问题,一切正常。我认为,这个问题已经解决了。