VMWare Server and NAT.

Posted by Joshua Schmidlkofer Wed, 31 Oct 2007 19:56:00 GMT

I setup VMWare Server on Gentoo the other day. It was pretty much easy. After install, cleanup all the .vmware folders in various home directories. Assign users with priv's to the 'vmware' group.

User Setup

gpasswd -a vmadmin vmware
Run the vmware-config.pl - Note the network numbers.

Network Setup

e.g.
  • Host-only: 172.16.42.0/24
  • NAT: 10.51.1.0/24
Vmware will NAT on the 10.51.1.0 network. Linux will have something like:
  • vmnet0 172.16.42.1
  • vmnet8 10.51.1.1
Next, fixup /etc/xinetd.d/vmware-authd
--- vmware-authd~       2007-10-13 13:26:18.830128814 -0700
+++ vmware-authd        2007-10-13 13:36:42.833942428 -0700
@@ -10,5 +10,5 @@
     user            = root
     server          = /opt/vmware/server/sbin/vmware-authd
     type            = unlisted
-    only_from      =
+    only_from      = 0.0.0.0/0
 }

Firewall Setup

Once you get a guest running, you discover that DHCP on the NAT network provides a gateway of 10.51.1.2. That is great for VMWare-based NAT setup. See /etc/vmware/vmnetX/nat/nat.conf to tweak the NAT settings. I wanted to use shorewall, complete with NAT and port forwarding. I installed/configured shorewall. After that, I setup the NAT and port-forwarding rules. Finally, I connected to the Guest OSs which I wanted to expose, assigned static IPs and set thier default gateway to .1 instead of .2. This effectively removed them from the control of VMware nat. And that was is awesome.

Stupid Cooking Tricks on Windows.

Posted by Joshua Schmidlkofer Wed, 15 Feb 2006 05:02:00 GMT

I have used Python to do many things. However, I was debugging some code for a friend and we had the strangest side effect. We were using PyCURL to read a file from a webserver, and save it to disk as part of a wxPython app that he is writing. The whole app works perfectly on Linux, but on Windows it was crashing.


Cliff tried a number of things, but he has had occasional issues w/ file writes under VMware (Which is where he runs Windows). He suspected he was hitting a write issue due to VMware, and had hit a dead end solving the problem.


I finally had an opportunity to review the problem, and I stumbled across the solution while reading the pycurl multi-file retriever. It turns out that on sane platforms (e.g. Linux) the python file object defaults to binary files. Under uber-magical windows, the file object defaults to ASCII. What a suprise. The entire problem of cooked zip files was solved by:


file('foo.zip','wb').write(data.getvalue())

Woo-hoo.
Tech Notes:
  • 'data' is a StringIO object.
  • We are using standard crap w/ pycurl.