我在使用双千兆以太网 NIC 时遇到了一些奇怪的行为;我设置了一台具有多个网络接口的计算机来连接一些工业相机,并设置了一个 DHCP 服务器(isc-dhcp-server,Ubuntu 16.04)来静态分配它们的 IP。注意:设置中没有路由器/交换机。只有 NIC 和通过 RJ45 电缆的直接连接。
这适用于计算机上的其他 NIC。我看到DHCP 发现数据包进来,然后DHCP 提供被发送到远程设备,稍后通过DHCP 确认来自远程设备。
但是,对于这种特殊的 NIC(LogiLink 2 端口千兆 LAN PCI-Express,PC0075 v.2.0;芯片组:RTL8111F;见数据表)我刚才看到多个 DHCP 发现收到的数据包以DHCP 提供在 DHCP 服务器端。远程设备似乎没有收到DHCP 提供。事实上,我尝试使用 Windows 机器作为客户端,但我没有看到任何DHCP 提供来自服务器的回复(如果我没有忽略任何数据包的话,DHCP 服务器根本没有数据包,因为 Windows 机器只是发送了很多垃圾邮件)。
现在奇怪的是:我保留了一切原样(DHCP 服务器具有静态 IP 192.168.1.1/24),并将 Windows 客户端配置为使用固定 IP(192.168.1.2/24)。现在,只要连接了电缆,就可以从 Windows 客户端向 DHCP 服务器发送 ping 操作(成功收到 ping 回复)。因此,DHCP 服务器上的 NIC能够发送数据包,电缆/连接不是问题,Windows 客户端确实通过此连接进行通信。我多次在客户端的静态 IP 和 DHCP 配置之间切换以验证这一点(DHCP=不工作,静态 IP=一切正常)。
一些诊断(注意:我将公共 IP 地址更改为 42.xxx,并且对于 MAC 地址,最后 4 位十六进制数字也发生了更改):
$ lspci -k | grep 'RTL' -A2
06:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 07)
Subsystem: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
Kernel driver in use: r8168
Kernel modules: r8169, r8168
07:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 07)
Subsystem: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
Kernel driver in use: r8168
Kernel modules: r8169, r8168
#### NOTE: This was when the Windows Client was connected to eth3, eth1/eth2 disconnected; the "RUNNING" shows up properly for eth1/eth2 as soon the cable is connected ####
$ ifconfig
eth0 Link encap:Ethernet HWaddr 10:7b:44:a5:ff:42
inet addr:42.0.0.1 Bcast:42.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::127b:44ff:fea5:ff42/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:44357 errors:0 dropped:2143 overruns:0 frame:0
TX packets:590 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5653188 (5.6 MB) TX bytes:94249 (94.2 KB)
Interrupt:20 Memory:92f00000-92f20000
eth1 Link encap:Ethernet HWaddr 00:13:3b:0f:ff:f1
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::213:3bff:fe0f:fff1/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:191 errors:0 dropped:0 overruns:0 frame:0
TX packets:34 errors:0 dropped:46 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:20166 (20.1 KB) TX bytes:2400 (2.4 KB)
Interrupt:45 Base address:0x2000
eth2 Link encap:Ethernet HWaddr 00:13:3b:0f:ff:f2
inet addr:192.168.2.1 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::213:3bff:fe0f:fff2/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:1388 errors:0 dropped:0 overruns:0 frame:0
TX packets:140 errors:0 dropped:68 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:155296 (155.2 KB) TX bytes:10878 (10.8 KB)
Interrupt:46 Base address:0x8000
eth3 Link encap:Ethernet HWaddr 00:e0:4c:13:ff:f3
inet addr:192.168.3.1 Bcast:192.168.3.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:4cff:fe13:fff3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:357 errors:0 dropped:0 overruns:0 frame:0
TX packets:72 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:49440 (49.4 KB) TX bytes:9345 (9.3 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:36 errors:0 dropped:0 overruns:0 frame:0
TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:2671 (2.6 KB) TX bytes:2671 (2.6 KB)
$ cat /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
log-facility local0;
authorative;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.2 192.168.1.254;
}
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.2 192.168.2.254;
}
subnet 192.168.3.0 netmask 255.255.255.0 {
range 192.168.3.2 192.168.3.254;
}
subnet 192.168.4.0 netmask 255.255.255.0 {
range 192.168.4.2 192.168.4.254;
}
host cam1 {
hardware ethernet 00:01:0d:c2:ff:01;
fixed-address 192.168.1.2;
}
host cam2 {
hardware ethernet 00:01:0d:c2:ff:02;
fixed-address 192.168.2.2;
}
host cam3 {
hardware ethernet 00:01:0d:c2:ff:03;
fixed-address 192.168.3.2;
}
host cam4 {
hardware ethernet 00:01:0d:c2:ff:04;
fixed-address 192.168.4.2;
}
host notebook {
hardware ethernet 80:fa:5b:4b:ff:05;
fixed-address 192.168.1.2;
}
到目前为止我已经尝试过:
- 我尝试更换电缆并使用两个端口,但没有变化。
- 我尝试使用内置内核驱动程序(Ubuntu 16.04,内核 4.4.0-124-generic 和 RealTek 的驱动程序(r8168-8.045.08),根据“lspci -k”,NIC 当前正在使用这些驱动程序
- 我尝试将 NIC 配置为使用 10 MBit/s 半双工,但没有影响。
问题:
- 为什么此 NIC(eth1/eth2)的 DHCP OFFER 没有出现在客户端上,而 eth3(不同的适配器,其他使用 RTL81524-2 芯片组)却运行正常?
- 如何修复?
- 有什么建议我可以尝试吗?(除了在客户端设置静态 IP 地址)
编辑:
我使用静态 IP 在该 NIC 上配置了客户端设备(摄像头)。如果我手动断开/重新连接电缆并延迟一段时间,这似乎有效。出于某种原因,关闭后连接无法以自动方式正确建立。此外,在实际使用其他 NIC 时,我遇到了一些“无可用缓冲区空间”消息,而几乎没有负载(只有一些间隔 1 秒的 ping)。我恢复了内核集成驱动程序 - 到目前为止,我没有看到“无缓冲区空间”消息;但连接仍然无法自动建立。我想知道这是否可能是网络适配器有缺陷……以及驱动程序无法正确处理导致的问题。
编辑#2:
似乎我可以使用“mii-tool -r eth1”和“mii-tool -r eth2”强制重新协商链接,而不是断开/重新连接电缆。这仅适用于配置静态 IP(DHCP 仍然失败)。另请注意,“mii-tool”声称设备协商了“1000baseT-HD”(半双工)链接,ethtool 告诉我它是全双工。对于 mii-tool 和 ethtool,“mii-tool -r”命令之前和之后显示的状态相同:
# mii-tool
SIOCGMIIREG on eth0 failed: Input/output error
SIOCGMIIREG on eth0 failed: Input/output error
eth0: negotiated 1000baseT-FD flow-control, link ok
eth1: negotiated 1000baseT-HD flow-control, link ok
eth2: negotiated 1000baseT-HD flow-control, link ok
eth3: negotiated 1000baseT-FD flow-control, link ok
SIOCGMIIPHY on 'eth4' failed: Operation not supported
# ethtool eth1
Settings for eth1:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Link partner advertised pause frame use: Symmetric Receive-only
Link partner advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: MII
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000033 (51)
drv probe ifdown ifup
Link detected: yes
# ethtool eth2
Settings for eth2:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Link partner advertised pause frame use: Symmetric Receive-only
Link partner advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: MII
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000033 (51)
drv probe ifdown ifup
Link detected: yes