解决由于网络设备导致的启动缓慢问题

解决由于网络设备导致的启动缓慢问题

我正在尝试对配备 SSD 的较现代机器的启动时间进行故障排除。该机器运行 Ubuntu Server 14.04.3 LTS,有两个以太网端口。未安装网络管理器。所有设备都支持千兆以太网,并且始终使用 Cat6 电缆。从服务器到交换机的电缆长度为 6 或 10 英尺。

当仅eth0与 DHCP 一起使用时,机器将在大约 2.5 到 3 秒内启动。

我启用了eth1并添加了br0支持虚拟化的主机桥接。虚拟机使用第二个以太网接口,并且没有虚拟机自动启动。现在启动时间约为 30 秒。

我该如何解决这个问题?

或者我该如何修复它(如果可以根据我掌握的有限信息确定的话)?


/etc/networks/interfaces

更改生成树协议状态(开启或关闭)没有区别。注释掉桥接器可将启动时间缩短至约 5 秒。

$ cat /etc/network/interfaces
...

# Primary network interface
auto eth0
iface eth0 inet dhcp

# Secondary network interface
iface eth1 inet manual
      pre-up ifconfig $IFACE up
      post-down ifconfig $IFACE down

# Bridged interface for virtualization
auto br0
iface br0 inet dhcp
      bridge_ports eth1
      bridge_stp on
      bridge_fd 0
      bridge_maxwait 0

dmesg 输出

$ dmesg | egrep -i "(eth|r1869)"
[    1.580017] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[    1.581643] r8169 0000:02:00.0 eth0: RTL8168evl/8111evl at 0xffffc900018fc000, 00:e0:4c:68:03:5e, XID 0c900800 IRQ 46
[    1.582988] r8169 0000:02:00.0 eth0: jumbo features [frames: 9200 bytes, tx checksumming: ko]
[    1.583755] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[    1.585640] r8169 0000:03:00.0 eth1: RTL8168evl/8111evl at 0xffffc90005b98000, 00:e0:4c:68:03:5f, XID 0c900800 IRQ 48
[    1.587100] r8169 0000:03:00.0 eth1: jumbo features [frames: 9200 bytes, tx checksumming: ko]
[    3.086938] r8169 0000:02:00.0 eth0: link down
[    3.086956] r8169 0000:02:00.0 eth0: link down
[    5.463989] r8169 0000:02:00.0 eth0: link up
[    7.138820] device eth1 entered promiscuous mode
[    7.248670] r8169 0000:03:00.0 eth1: link down
[    7.248687] r8169 0000:03:00.0 eth1: link down
[   25.169258] r8169 0000:03:00.0 eth1: link up
[   25.169742] br0: port 1(eth1) entered listening state
[   25.169748] br0: port 1(eth1) entered listening state
[   27.171555] br0: port 1(eth1) entered learning state
[   29.174455] br0: port 1(eth1) entered forwarding state

ethtool

$ sudo ethtool eth0 | egrep -i "(speed|duplex|neg)"
    Speed: 1000Mb/s
    Duplex: Full
    Auto-negotiation: on
$ sudo ethtool eth1 | egrep -i "(speed|duplex|neg)"
    Speed: 100Mb/s
    Duplex: Full
    Auto-negotiation: on

答案1

根据这些消息...

[    7.248687] r8169 0000:03:00.0 eth1: link down
[   25.169258] r8169 0000:03:00.0 eth1: link up

...网卡似乎无法建立物理以太网链路。请确保您的电缆良好;也许可以尝试交换 eth0 和 eth1。使用ethtool eth1mii-tool -v eth1检查已协商的速度。

答案2

Grawity 给出的答案是,电缆可能存在问题。为了完整和参考,以下是新的消息输出。

$ dmesg | egrep -i "(eth|r1869)"
[    1.578910] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[    1.580850] r8169 0000:02:00.0 eth0: RTL8168evl/8111evl at 0xffffc900018fc000, 00:e0:4c:68:03:5e, XID 0c900800 IRQ 46
[    1.580852] r8169 0000:02:00.0 eth0: jumbo features [frames: 9200 bytes, tx checksumming: ko]
[    1.581047] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[    1.581495] r8169 0000:03:00.0 eth1: RTL8168evl/8111evl at 0xffffc90005b98000, 00:e0:4c:68:03:5f, XID 0c900800 IRQ 48
[    1.581496] r8169 0000:03:00.0 eth1: jumbo features [frames: 9200 bytes, tx checksumming: ko]
[    2.847016] r8169 0000:02:00.0 eth0: link down
[    2.847034] r8169 0000:02:00.0 eth0: link down
[    5.169713] r8169 0000:02:00.0 eth0: link up
[   11.065366] device eth1 entered promiscuous mode
[   11.194437] r8169 0000:03:00.0 eth1: link down
[   11.194454] r8169 0000:03:00.0 eth1: link down
[   13.533359] r8169 0000:03:00.0 eth1: link up
[   13.533844] br0: port 1(eth1) entered forwarding state
[   13.533851] br0: port 1(eth1) entered forwarding state

相关内容