Estou usando uma VM Debian Buster no VirtualBox como um roteador para meu notebook Windows 10. [por motivos que não vale a pena mencionar aqui]
Funcionou bem por alguns dias, mas ontem e hoje o tráfego ficou anormalmente lento e não confiável - na minha rede relativamente estável em casa. Os outros dispositivos, incluindo a máquina host, estavam funcionando bem. A reinicialização da VM (e apenas a VM) a corrige por um [pouco] tempo, no entanto, o problema volta irritantemente em pouco tempo.
Após uma inspeção minuciosa, também tenho logs de erros no console e no arquivo /var/log/syslog
.
Minhas interfaces eth0 e eth1, que estão dando problemas/erros semelhantes, são placas de interface de rede virtual.
O host real do equipamento é um Lenovo ThinkPad E560 Intel i7 com um Intel Dual Band Wireless-AC 3165, que é o NIC real por trás do eth0 NAT.
No entanto, eth1 é uma interface de rede virtual de uma rede interna que fala apenas com outra interface de rede virtual no host do Windows e não está de forma alguma associada a placas de interface de rede reais ou a tráfego externo. Assim, o problema não parece estar associado apenas à rede (externa/real) ou às interfaces físicas da máquina host.
A versão do Virtual Box é 5.2.12 r122591 (Qt5.6.2). Também instalei as ferramentas do Virtual Box na VM em questão.
O que está acontecendo?
As interfaces em questão:
# ip a
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:f6:32:22 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:82:0f:24 brd ff:ff:ff:ff:ff:ff
inet 4.1.1.1/24 brd 4.1.1.255 scope global eth1
valid_lft forever preferred_lft forever
lspci
saída da VM em questão.
$ lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter
00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
00:04.0 System peripheral: InnoTek Systemberatung GmbH VirtualBox Guest Service
00:06.0 USB controller: Apple Inc. KeyLargo/Intrepid USB
00:07.0 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:08.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
00:0d.0 SATA controller: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode] (rev 02)
Erros para eth0. Eth1 também apresentou os mesmos erros.
Jun 25 08:32:22 rui kernel: [31950.194099] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:32:25 rui kernel: [31952.306456] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:32:54 rui kernel: [31981.448886] e1000 0000:00:03.0 eth0: Detected Tx Unit Hang
Jun 25 08:32:59 rui kernel: [31987.206829] e1000 0000:00:03.0 eth0: Detected Tx Unit Hang
Jun 23 20:40:58 rui systemd[1]: Started ifup for eth0.
Jun 23 20:40:58 rui kernel: [ 1.671922] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 08:00:27:f6:32:22
Jun 23 20:40:58 rui kernel: [ 1.672229] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
Jun 23 20:40:59 rui ifup[570]: /sbin/ifup: waiting for lock on /run/network/ifstate.eth0
Jun 23 20:40:59 rui kernel: [ 4.760724] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 23 20:40:59 rui dhclient[581]: Listening on LPF/eth0/08:00:27:f6:32:22
Jun 23 20:40:59 rui sh[563]: Listening on LPF/eth0/08:00:27:f6:32:22
Jun 23 20:40:59 rui dhclient[581]: Sending on LPF/eth0/08:00:27:f6:32:22
Jun 23 20:40:59 rui sh[563]: Sending on LPF/eth0/08:00:27:f6:32:22
Jun 23 20:40:59 rui dhclient[581]: DHCPREQUEST of 10.0.2.15 on eth0 to 255.255.255.255 port 67 (xid=0x1211b42a)
Jun 23 20:40:59 rui sh[563]: DHCPREQUEST of 10.0.2.15 on eth0 to 255.255.255.255 port 67 (xid=0x1211b42a)
Jun 23 20:40:59 rui sh[563]: ifup: interface eth0 already configured
Jun 25 08:33:16 rui dhclient[644]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3 (xid=0xac0f1c44)
Jun 25 08:33:16 rui dhclient[644]: DHCPREQUEST of 10.0.2.15 on eth0 to 255.255.255.255 port 67 (xid=0x441c0fac)
Jun 25 08:33:45 rui kernel: [ 38.195899] e1000 0000:00:03.0 eth0: Detected Tx Unit Hang
Jun 25 08:34:23 rui kernel: [ 76.277453] e1000 0000:00:03.0 eth0: Detected Tx Unit Hang
Jun 25 08:34:37 rui kernel: [ 89.824132] NETDEV WATCHDOG: eth0 (e1000): transmit queue 0 timed out
Jun 25 08:34:37 rui kernel: [ 89.831381] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:34:39 rui kernel: [ 92.002061] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:37:59 rui kernel: [ 292.064298] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:38:01 rui kernel: [ 294.148491] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:38:12 rui kernel: [ 304.388066] e1000 0000:00:03.0 eth0: Detected Tx Unit Hang
Jun 25 08:38:37 rui kernel: [ 329.952311] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:38:39 rui kernel: [ 332.064828] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:38:56 rui kernel: [ 349.313777] e1000 0000:00:03.0 eth0: Detected Tx Unit Hang
Jun 25 08:39:01 rui kernel: [ 354.242015] e1000 0000:00:03.0 eth0: Detected Tx Unit Hang
Jun 25 08:39:03 rui kernel: [ 356.258135] e1000 0000:00:03.0 eth0: Detected Tx Unit Hang
Jun 25 08:39:04 rui kernel: [ 357.298945] e1000 0000:00:03.0 eth0: Detected Tx Unit Hang
Jun 25 08:39:05 rui kernel: [ 357.857091] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:39:07 rui kernel: [ 359.968627] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:40:45 rui kernel: [ 457.982736] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:40:47 rui kernel: [ 460.132984] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:41:28 rui kernel: [ 500.480653] e1000: eth0 NIC Link is Down
Jun 25 08:41:28 rui kernel: [ 500.480767] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:41:30 rui kernel: [ 502.755753] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:41:40 rui kernel: [ 512.834548] e1000: eth0 NIC Link is Down
Jun 25 08:41:40 rui kernel: [ 512.834570] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:41:42 rui kernel: [ 515.008848] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:41:52 rui kernel: [ 525.031738] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:41:55 rui kernel: [ 527.668391] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:42:21 rui kernel: [ 553.953056] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:42:23 rui kernel: [ 556.033233] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:42:38 rui kernel: [ 570.848721] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:42:40 rui kernel: [ 573.025803] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:42:55 rui kernel: [ 588.001188] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:42:58 rui kernel: [ 590.402069] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:43:18 rui kernel: [ 611.040602] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:43:20 rui kernel: [ 613.153379] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:43:41 rui kernel: [ 633.825059] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:43:43 rui kernel: [ 635.936611] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:43:58 rui kernel: [ 650.980297] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:44:01 rui kernel: [ 653.377622] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:44:06 rui kernel: [ 658.918888] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:44:09 rui kernel: [ 661.319139] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:44:24 rui kernel: [ 676.832703] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:44:26 rui kernel: [ 678.944975] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:44:46 rui kernel: [ 698.848483] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:44:48 rui kernel: [ 701.024837] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 08:44:52 rui kernel: [ 705.056365] e1000: eth0 NIC Link is Down
Jun 25 08:44:52 rui kernel: [ 705.056391] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 08:44:54 rui kernel: [ 707.174980] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:28:15 rui kernel: [ 3308.128693] e1000: eth0 NIC Link is Down
Jun 25 09:28:15 rui kernel: [ 3308.128863] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:28:17 rui kernel: [ 3310.241091] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:28:28 rui kernel: [ 3321.056739] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:28:30 rui kernel: [ 3323.297966] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:28:41 rui kernel: [ 3333.856657] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:28:43 rui kernel: [ 3336.001892] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:29:08 rui kernel: [ 3360.993029] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:29:10 rui kernel: [ 3363.105257] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:29:26 rui kernel: [ 3378.912149] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:29:28 rui kernel: [ 3381.007439] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:29:40 rui kernel: [ 3393.088355] e1000: eth0 NIC Link is Down
Jun 25 09:29:40 rui kernel: [ 3393.088381] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:29:42 rui kernel: [ 3395.170789] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:39:25 rui kernel: [ 3978.160481] e1000: eth0 NIC Link is Down
Jun 25 09:39:25 rui kernel: [ 3978.160521] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:39:28 rui kernel: [ 3980.353067] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:39:38 rui kernel: [ 3991.008647] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:39:40 rui kernel: [ 3993.184977] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:40:02 rui kernel: [ 4015.073022] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:40:04 rui kernel: [ 4017.249472] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:40:15 rui kernel: [ 4027.872558] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:40:17 rui kernel: [ 4029.956157] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:40:42 rui kernel: [ 4055.008653] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:40:44 rui kernel: [ 4057.091571] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:41:06 rui kernel: [ 4079.074864] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:41:08 rui kernel: [ 4081.191157] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:41:29 rui kernel: [ 4101.856291] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:41:31 rui kernel: [ 4103.968708] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:41:51 rui kernel: [ 4123.872855] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:41:53 rui kernel: [ 4125.985169] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:42:13 rui kernel: [ 4145.888157] e1000 0000:00:03.0 eth0: Reset adapter
Jun 25 09:42:15 rui kernel: [ 4147.968831] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 25 09:43:10 rui kernel: [ 4202.976829] e1000 0000:00:03.0 eth0: Reset adapter
Parâmetros de configuração da VM do VirtualBox
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe showvminfo 9806a7eb-0045-4373-bf64-1f5d6c895041
Name: Debian
Groups: /
Guest OS: Debian (64-bit)
UUID: 9806a7eb-0045-4373-bf64-1f5d6c895041
Config file: C:\Users\Rui\VirtualBox VMs\Debian\Debian.vbox
Snapshot folder: C:\Users\Rui\VirtualBox VMs\Debian\Snapshots
Log folder: C:\Users\Rui\VirtualBox VMs\Debian\Logs
Hardware UUID: 9806a7eb-0045-4373-bf64-1f5d6c895041
Memory size: 8192MB
Page Fusion: off
VRAM size: 10MB
CPU exec cap: 100%
HPET: off
Chipset: piix3
Firmware: BIOS
Number of CPUs: 2
PAE: on
Long Mode: on
Triple Fault Reset: off
APIC: on
X2APIC: on
CPUID Portability Level: 0
CPUID overrides: None
Boot menu mode: message and menu
Boot Device (1): HardDisk
Boot Device (2): DVD
Boot Device (3): Not Assigned
Boot Device (4): Not Assigned
ACPI: on
IOAPIC: on
BIOS APIC mode: APIC
Time offset: 0ms
RTC: UTC
Hardw. virt.ext: on
Nested Paging: on
Large Pages: on
VT-x VPID: on
VT-x unr. exec.: on
Paravirt. Provider: Default
Effective Paravirt. Provider: KVM
State: powered off (since 2018-06-27T15:10:06.000000000)
Monitor count: 1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address:
Teleporter Password:
Tracing Enabled: off
Allow Tracing to Access VM: off
Tracing Configuration:
Autostart Enabled: off
Autostart Delay: 0
Default Frontend:
Storage Controller Name (0): SATA
Storage Controller Type (0): IntelAhci
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0): 30
Storage Controller Port Count (0): 2
Storage Controller Bootable (0): on
Storage Controller Name (1): IDE
Storage Controller Type (1): PIIX4
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1): 2
Storage Controller Port Count (1): 2
Storage Controller Bootable (1): on
SATA (0, 0): C:\Users\Rui\VirtualBox VMs\Debian\Debian.vmdk (UUID: 934dc586-67a5-45c9-b548-90b4f1f7bda0)
NIC 1: MAC: 080027F63222, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM , Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 1 Settings: MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
NIC 1 Rule(0): name = Rule 1, protocol = tcp, host ip = , host port = 22, guest ip = , guest port = 22
NIC 2: MAC: 080027820F24, Attachment: Host-only Interface 'VirtualBox Host-Only Ethernet Adapter #2', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 3: disabled
NIC 4: disabled
NIC 5: disabled
NIC 6: disabled
NIC 7: disabled
NIC 8: disabled
Pointing Device: USB Tablet
Keyboard Device: PS/2 Keyboard
UART 1: disabled
UART 2: disabled
UART 3: disabled
UART 4: disabled
LPT 1: disabled
LPT 2: disabled
Audio: disabled
Audio playback: disabled
Audio capture: enabled
Clipboard Mode: Bidirectional
Drag and drop Mode: disabled
VRDE: disabled
USB: enabled
EHCI: disabled
XHCI: disabled
USB Device Filters:
<none>
Bandwidth groups: <none>
Shared folders: <none>
Capturing: not active
Capture audio: not active
Capture screens: 0
Capture file: C:\Users\Rui\VirtualBox VMs\Debian\Debian.webm
Capture dimensions: 1024x768
Capture rate: 512 kbps
Capture FPS: 25
Capture options: ac_enabled=false
Guest:
Configured memory balloon size: 0 MB
Uso de memória da VM:
$ free -m
total used free shared buff/cache available
Mem: 7976 68 7780 2 128 7711
Swap: 2047 0 2047
Carga da VM:
xxxx@rui:~$ uptime
16:28:27 up 17 min, 1 user, load average: 0,00, 0,00, 0,00
Por fim, com sorte, pesquisando "perdendo a conexão aleatoriamente no vbox e os erros, me deparei com pessoas sugerindo que a emulação padrão da Intel NIC estava causando problemas de instabilidade e desempenho. Muitas pessoas aleatórias apenas sugerindo que depois de alterar a NIC virtual Intel padrão para algo caso contrário, a instabilidade foi embora (infelizmente sem nenhuma sugestão de por que isso está acontecendo).
Então eu dei uma olhada, e eis que, de fato, na interface "VM Virtualbox Manager" -> nome da VM -> Configurações-> Rede-> Avançado-> Tipo de Adaptador" eu tinha o NIC virtual padrão "Intel Pro 1000 MT Desktop ( 8254OEM)".
Como tal, desliguei a VM em questão.
Sabendo que eu tinha as ferramentas VBox já instaladas e aproveitando minha experiência em outro ambiente virtual onde NICs paravirtualizados oferecem muito mais desempenho e demandam menos esforço de CPU, mudei o tipo de NIC padrão para "Rede Paravirtualizada (virtio-net)" no as duas interfaces que eu uso.
Embora no passado o VirtIO fosse conhecido no VirtualBox por ter bugs, ele parece ter um bom desempenho nos meus testes.
A diferença de velocidade no tráfego de roteamento foi abismal, e os erros desapareceram completamente.
PS. Suspeito que seja um bug da caixa vbox na emulação de uma placa NIC Intel "física" e não tenha nada a ver com meu hardware real. Na verdade, mudei primeiro a eth0, comecei a ter problemas na eth1 também e depois mudei as duas. Parece que a emulação Intel VNIC estava dando problemas em eth0 e eth1 ao mesmo tempo. Como eu digo na pergunta agora , eth1 não está de forma alguma associada a uma NIC física.
PS2. Sim, eu sei que a paravirtualização geralmente dá um impulso. A questão central aqui era se livrar da instabilidade séria.