Saturday, July 11, 2009

Troubleshooting network issues in VirtualBox

VirtualBox comes with built-in facility to trace the network packets. To enable tracing, you must first shutdown your VM. Then find out the VM's name or uuid. Please refer to my earlier post to find how to find uuid. Once you have the uuid of the VM, give the following command:

vboxmanage modifyvm a27473c0-d690-4c95-a48a-1c49d69a20e6
--nictrace1 on --nictracefile1 c:\temp\nictrace1.pcap

Replace my uuid with yours. I am enabling tracing on the NIC1. You will have to change the parameters appropriately if you would like to trace some other NIC. To make sure that your VM's tracing is enabled on the specified interface, give the following command:

vboxmanage showvminfo a27473c0-d690-4c95-a48a-1c49d69a20e6
VirtualBox Command Line Management Interface Version 2.2.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Name: Ubuntu8.10
Guest OS: Ubuntu
UUID: a27473c0-d690-4c95-a48a-1c49d69a20e6
Config file: C:\Documents and Settings\xxxx\.VirtualBox\Machines\Ubuntu8.10\Ubuntu8.10.xml
Memory size: 512MB
VRAM size: 12MB
Boot menu mode: message and menu
ACPI: on
IOAPIC: off
PAE: off
Time offset: 0 ms
Hardw. virt.ext: on
Nested Paging: off
VT-x VPID: off
State: powered off (since 2009-07-11T18:45:41.000000000)
Monitor count: 1
3D Acceleration: off
Floppy: empty
SATA: disabled
IDE Controller: PIIX4
Primary master: D:\xxxx\VM\Ubuntu8.10-desktop-xVM\VDI\ubuntu-8.10-x86.vdi (UUID: 58a58064-e589-47c0-baba-de38fa62
1c80)
DVD: C:\PROGRA~1\Sun\XVMVIR~1\VBoxGuestAdditions.iso (UUID: 60b22ad4-50d1-4fb7-8097-862ce763df52)
NIC 1: MAC: 080027AC3BCE, Attachment: NAT, Cable connected: on,
Trace: on (file: c:\temp\nictrace1.pcap)
, Type: Am79C973, Reported speed: 0 Mbps
NIC 2: disabled
NIC 3: disabled
NIC 4: disabled
NIC 5: disabled
NIC 6: disabled
NIC 7: disabled
NIC 8: disabled
UART 1: disabled
UART 2: disabled
Audio: enabled (Driver: DSOUND, Controller: AC97)
Clipboard Mode: Bidirectional
VRDP: disabled
USB: enabled


Once done, start your VM. The trace would be written to the file you have specified. You can use tcpdump or Wireshark to analyze the packets.

Make sure you disable the trace once you are done. Give the following command to disable tracing:
vboxmanage modifyvm a27473c0-d690-4c95-a48a-1c49d69a20e6 --nictrace1 off

The only limitation of using the trace facility is that you cannot turn on or off tracing while the VM is up and running. Thats a very serious thing if you run into some network issue in the middle of a session in your VM.

No comments: