
VMWare workstation is in many ways a great product. It allows you to do all kinds of nifty set-ups that let multiple virtual machines talk to each other and the rest of the world, within the confines of your local PC.
However, there are some problems with it. I have a couple of virtual machines that I use as a sandbox for developing networked applications at work. These are hosted inside a Dell Inspiron XPS 1330 laptop. The laptop travels between networks frequently. At work, it's usually plugged in, but sometimes gets un-plugged and goes on wireless-G. On the train, it goes on a Sprint WAN card. At home, it generally goes on another wireless-G network.
The way that virtual networking is set up in VMWare is to treat the VMWare Workstation host as a NAT gateway. Each virtual machine's network card gets a DHCP address from VMWare. VMWare also tells these machines that the local gateway is the DNS server of record. The machines will then send DNS requests to the local machine, and VMWare will, theoretically, forward the requests to the DNS servers configured on the host itself.
Unfortunately, this doesn't work right. Specifically, the VMWare host (192.168.126.1 in this case) will send a DNS Refused reply to the first two requests from the hosted machines, which adds 5 seconds each of timeout to the DNS request. The virtual machine (running Ubuntu 10.04) will then re-try, adding "localdomain" to the requested DNS host name, at which point VMWare suddenly manages to properly resolve the name.
Here's a Wireshark trace of the exchange, when trying to "ping www.google.com" from within the virtual Ubuntu machine:
No. Time Source Destination Protocol Info
1 0.000000 192.168.126.129 192.168.126.1 DNS Standard query A www.google.com
Frame 1: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)
Ethernet II, Src: Vmware_07:49:96 (00:0c:29:07:49:96), Dst: Vmware_ea:17:be (00:50:56:ea:17:be)
Internet Protocol, Src: 192.168.126.129 (192.168.126.129), Dst: 192.168.126.1 (192.168.126.1)
User Datagram Protocol, Src Port: 54344 (54344), Dst Port: domain (53)
Domain Name System (query)
[Response In: 6]
Transaction ID: 0x8518
Flags: 0x0100 (Standard query)
Questions: 1
Answer RRs: 0
Authority RRs: 0
Additional RRs: 0
Queries
No. Time Source Destination Protocol Info
2 0.008295 192.168.126.1 192.168.126.129 DNS Standard query response, Refused
Frame 2: 54 bytes on wire (432 bits), 54 bytes captured (432 bits)
Ethernet II, Src: Vmware_ea:17:be (00:50:56:ea:17:be), Dst: Vmware_07:49:96 (00:0c:29:07:49:96)
Internet Protocol, Src: 192.168.126.1 (192.168.126.1), Dst: 192.168.126.129 (192.168.126.129)
User Datagram Protocol, Src Port: domain (53), Dst Port: 54344 (54344)
Domain Name System (response)
[Request In: 5]
[Time: -5.552192000 seconds]
Transaction ID: 0x8518
Flags: 0x8185 (Standard query response, Refused)
Questions: 0
Answer RRs: 0
Authority RRs: 0
Additional RRs: 0
No. Time Source Destination Protocol Info
3 5.551449 Vmware_07:49:96 Vmware_ea:17:be ARP Who has 192.168.126.1? Tell 192.168.126.129
Frame 3: 42 bytes on wire (336 bits), 42 bytes captured (336 bits)
Ethernet II, Src: Vmware_07:49:96 (00:0c:29:07:49:96), Dst: Vmware_ea:17:be (00:50:56:ea:17:be)
Address Resolution Protocol (request)
No. Time Source Destination Protocol Info
4 5.551476 Vmware_ea:17:be Vmware_07:49:96 ARP 192.168.126.1 is at 00:50:56:ea:17:be
Frame 4: 42 bytes on wire (336 bits), 42 bytes captured (336 bits)
Ethernet II, Src: Vmware_ea:17:be (00:50:56:ea:17:be), Dst: Vmware_07:49:96 (00:0c:29:07:49:96)
Address Resolution Protocol (reply)
No. Time Source Destination Protocol Info
5 5.560487 192.168.126.129 192.168.126.1 DNS Standard query A www.google.com
Frame 5: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)
Ethernet II, Src: Vmware_07:49:96 (00:0c:29:07:49:96), Dst: Vmware_ea:17:be (00:50:56:ea:17:be)
Internet Protocol, Src: 192.168.126.129 (192.168.126.129), Dst: 192.168.126.1 (192.168.126.1)
User Datagram Protocol, Src Port: 54344 (54344), Dst Port: domain (53)
Domain Name System (query)
[Response In: 6]
Transaction ID: 0x8518
Flags: 0x0100 (Standard query)
Questions: 1
Answer RRs: 0
Authority RRs: 0
Additional RRs: 0
Queries
No. Time Source Destination Protocol Info
6 5.569798 192.168.126.1 192.168.126.129 DNS Standard query response, Refused
Frame 6: 54 bytes on wire (432 bits), 54 bytes captured (432 bits)
Ethernet II, Src: Vmware_ea:17:be (00:50:56:ea:17:be), Dst: Vmware_07:49:96 (00:0c:29:07:49:96)
Internet Protocol, Src: 192.168.126.1 (192.168.126.1), Dst: 192.168.126.129 (192.168.126.129)
User Datagram Protocol, Src Port: domain (53), Dst Port: 54344 (54344)
Domain Name System (response)
[Request In: 5]
[Time: 0.009311000 seconds]
Transaction ID: 0x8518
Flags: 0x8185 (Standard query response, Refused)
Questions: 0
Answer RRs: 0
Authority RRs: 0
Additional RRs: 0
No. Time Source Destination Protocol Info
7 11.121709 192.168.126.129 192.168.126.1 DNS Standard query A www.google.com.localdomain
Frame 7: 86 bytes on wire (688 bits), 86 bytes captured (688 bits)
Ethernet II, Src: Vmware_07:49:96 (00:0c:29:07:49:96), Dst: Vmware_ea:17:be (00:50:56:ea:17:be)
Internet Protocol, Src: 192.168.126.129 (192.168.126.129), Dst: 192.168.126.1 (192.168.126.1)
User Datagram Protocol, Src Port: 56733 (56733), Dst Port: domain (53)
Domain Name System (query)
[Response In: 8]
Transaction ID: 0xd048
Flags: 0x0100 (Standard query)
Questions: 1
Answer RRs: 0
Authority RRs: 0
Additional RRs: 0
Queries
No. Time Source Destination Protocol Info
8 11.122442 192.168.126.1 192.168.126.129 DNS Standard query response CNAME www.l.google.com A 74.125.19.103
Frame 8: 132 bytes on wire (1056 bits), 132 bytes captured (1056 bits)
Ethernet II, Src: Vmware_ea:17:be (00:50:56:ea:17:be), Dst: Vmware_07:49:96 (00:0c:29:07:49:96)
Internet Protocol, Src: 192.168.126.1 (192.168.126.1), Dst: 192.168.126.129 (192.168.126.129)
User Datagram Protocol, Src Port: domain (53), Dst Port: 56733 (56733)
Domain Name System (response)
[Request In: 7]
[Time: 0.000733000 seconds]
Transaction ID: 0xd048
Flags: 0x8400 (Standard query response, No error)
Questions: 1
Answer RRs: 2
Authority RRs: 0
Additional RRs: 0
Queries
Answers
No. Time Source Destination Protocol Info
9 11.123004 192.168.126.129 74.125.19.103 ICMP Echo (ping) request
Frame 9: 98 bytes on wire (784 bits), 98 bytes captured (784 bits)
Ethernet II, Src: Vmware_07:49:96 (00:0c:29:07:49:96), Dst: Vmware_ea:17:be (00:50:56:ea:17:be)
Internet Protocol, Src: 192.168.126.129 (192.168.126.129), Dst: 74.125.19.103 (74.125.19.103)
Internet Control Message Protocol
No. Time Source Destination Protocol Info
10 11.124734 74.125.19.103 192.168.126.129 ICMP Echo (ping) reply
Frame 10: 98 bytes on wire (784 bits), 98 bytes captured (784 bits)
Ethernet II, Src: Vmware_ea:17:be (00:50:56:ea:17:be), Dst: Vmware_07:49:96 (00:0c:29:07:49:96)
Internet Protocol, Src: 74.125.19.103 (74.125.19.103), Dst: 192.168.126.129 (192.168.126.129)
Internet Control Message Protocol
No. Time Source Destination Protocol Info
11 11.125085 192.168.126.129 192.168.126.1 DNS Standard query PTR 103.19.125.74.in-addr.arpa
Frame 11: 86 bytes on wire (688 bits), 86 bytes captured (688 bits)
Ethernet II, Src: Vmware_07:49:96 (00:0c:29:07:49:96), Dst: Vmware_ea:17:be (00:50:56:ea:17:be)
Internet Protocol, Src: 192.168.126.129 (192.168.126.129), Dst: 192.168.126.1 (192.168.126.1)
User Datagram Protocol, Src Port: 60756 (60756), Dst Port: domain (53)
Domain Name System (query)
[Response In: 14]
Transaction ID: 0xb516
Flags: 0x0100 (Standard query)
Questions: 1
Answer RRs: 0
Authority RRs: 0
Additional RRs: 0
Queries
No. Time Source Destination Protocol Info
12 11.133396 192.168.126.1 192.168.126.129 DNS Standard query response, Refused
Frame 12: 54 bytes on wire (432 bits), 54 bytes captured (432 bits)
Ethernet II, Src: Vmware_ea:17:be (00:50:56:ea:17:be), Dst: Vmware_07:49:96 (00:0c:29:07:49:96)
Internet Protocol, Src: 192.168.126.1 (192.168.126.1), Dst: 192.168.126.129 (192.168.126.129)
User Datagram Protocol, Src Port: domain (53), Dst Port: 60756 (60756)
Domain Name System (response)
[Request In: 13]
[Time: -5.548992000 seconds]
Transaction ID: 0xb516
Flags: 0x8185 (Standard query response, Refused)
Questions: 0
Answer RRs: 0
Authority RRs: 0
Additional RRs: 0
No. Time Source Destination Protocol Info
13 16.682388 192.168.126.129 192.168.126.1 DNS Standard query PTR 103.19.125.74.in-addr.arpa
Frame 13: 86 bytes on wire (688 bits), 86 bytes captured (688 bits)
Ethernet II, Src: Vmware_07:49:96 (00:0c:29:07:49:96), Dst: Vmware_ea:17:be (00:50:56:ea:17:be)
Internet Protocol, Src: 192.168.126.129 (192.168.126.129), Dst: 192.168.126.1 (192.168.126.1)
User Datagram Protocol, Src Port: 60756 (60756), Dst Port: domain (53)
Domain Name System (query)
[Response In: 14]
Transaction ID: 0xb516
Flags: 0x0100 (Standard query)
Questions: 1
Answer RRs: 0
Authority RRs: 0
Additional RRs: 0
Queries
No. Time Source Destination Protocol Info
14 16.691571 192.168.126.1 192.168.126.129 DNS Standard query response, Refused
Frame 14: 54 bytes on wire (432 bits), 54 bytes captured (432 bits)
Ethernet II, Src: Vmware_ea:17:be (00:50:56:ea:17:be), Dst: Vmware_07:49:96 (00:0c:29:07:49:96)
Internet Protocol, Src: 192.168.126.1 (192.168.126.1), Dst: 192.168.126.129 (192.168.126.129)
User Datagram Protocol, Src Port: domain (53), Dst Port: 60756 (60756)
Domain Name System (response)
[Request In: 13]
[Time: 0.009183000 seconds]
Transaction ID: 0xb516
Flags: 0x8185 (Standard query response, Refused)
Questions: 0
Answer RRs: 0
Authority RRs: 0
Additional RRs: 0
Now, read through this, and tell me that ain't crazy!?