FreeBSD VMware Interfaces

A site hosting news on FreeBSD 7.0 also included several great tips for FreeBSD under VMware. One tip talked about the lnc network interface standard under VMware.

You can see lnc0 in this sample VM. Here's dmesg output:

lnc0: <PCNet/PCI Ethernet adapter> port 0x1400-0x147f
irq 18 at device 17.0 on pci0
lnc0: Attaching PCNet/PCI Ethernet adapter
lnc0: Ethernet address: 00:0c:29:38:7d:ea
lnc0: if_start running deferred for Giant
lnc0: PCnet-PCI

This is what the interface looks like in VMware:

taosecurity:/root# ifconfig lnc0
NEEDSGIANT> mtu 1500
inet6 fe80::20c:29ff:fe38:7dea%lnc0 prefixlen 64 scopeid 0x1
inet netmask 0xffff0000 broadcast
ether 00:0c:29:38:7d:ea

The fact that lnc is GIANT-locked is bad for network performance. Furthermore, lnc is deprecated in FreeBSD 7.0, replaced by le.

The site included a tip to replace the lnc0 driver with an emulated em0 driver. I modified my .vmx file by adding the second line.

Ethernet0.present = "TRUE"

With that option, I see em0 in dmesg output:

em0: <Intel(R) PRO/1000 Network Connection Version - 3.2.18>
port 0x1070-0x1077
mem 0xec820000-0xec83ffff,0xec800000-0xec80ffff irq 18
at device 17.0 on pci0
em0: Memory Access and/or Bus Master bits were not set!
em0: Ethernet address: 00:0c:29:fd:f6:1d

Here is the device in ifconfig output:

kbld:/root# ifconfig em0
inet6 fe80::20c:29ff:fefd:f61d%em0 prefixlen 64 scopeid 0x1
inet netmask 0xffff0000 broadcast
ether 00:0c:29:fd:f6:1d
media: Ethernet autoselect (1000baseTX <full-duplex>)
status: active

That's really cool, especially since em0 doesn't need the GIANT lock. Performance should be improved. The site I mentioned said this with respect to replacing lnc with le:

le is still a SIMPLEX device but at least it's not GIANT-locked.

It's true that le is not GIANT locked, but I think SIMPLEX is really irrelevant. You'll see SIMPLEX everywhere, like in the above em0 output. As I mentioned here, SIMPLEX "has nothing to do with half or full duplex. SIMPLEX refers to the NIC not being able to transmit and receive while operating on true CSMA/CD Ethernet, which is really not the case with switched networks."

On a related note, you don't have to recompile your kernel to use le. You can load it as a kernel module during boot by entering if_le_load="YES" in /boot/loader.conf as noted in the le man page. In my tests this did not result in using the le driver instead of lnc however, so those wishing to use an lnc0 replacement should use em0.

I also concur with the recommendation to use kern.hz="100" in /boot/loader.conf to deal with VMware timing issues. That helps immensely and doesn't require VMware Tools installation.


dusty said…
I found the same thing loading le from loader.conf with lnc still in my kernel.

However, when I commented out the lnc driver from the kernel config and added the le driver, then recompiled, it worked.

I got le instead of lnc.
Anonymous said…
Running 6.1-RELEASE and 6.2-RELEASE as guest OSs under vmware-server 1.01 on CentOS 4.4 x86_64. The hardware is dual dual-core Opterons.

I get em0 by default, with vanilla VMware and FBSD kernel configs. Yay.
How did you get those defaults? Can you post your .vmx files?
Anonymous said…
VMware Workstation 6 appears to default to using the em1000 ethernet adapter when "FreeBSD 64-bit" is selected as the operating system during the initial New VM Configuration wizard.
Anonymous said…
VMware Workstation 6.5 now defaults to the e1000 ethernet adapter when either "FreeBSD" or "FreeBSD 64-bit" is selected as the Guest operating system during the New Virtual Machine Wizard.
Anonymous said…
Do you use device_polling in your kernel with vmware em?
No I doubt it.

Popular posts from this blog

Zeek in Action Videos

New Book! The Best of TaoSecurity Blog, Volume 4

MITRE ATT&CK Tactics Are Not Tactics