Can I have a stable IP address for a virtual machine under VMWare?

I'm using VMWare to emulate Ubuntu on my Leopard Mac OS X.

The IP address changes everytime I put the Mac to sleep.

I was wondering if I can avoid that.


You can do this -- just configure the Ubuntu virtual machine with a static IP. The choice of IP will depend on the network you're connecting to... You didn't mention if you were using a NAT or Bridged connection, and the choice of IP will different based on that. I can provide specific instructions if you like, but, they'll be all things you do within the Ubuntu VM, not within the Mac environment. (So you may find better luck asking on http://askubuntu.com or https://unix.stackexchange.com/)

You could also install the "avahi-daemon" package in Ubuntu and then you won't need to remember the VM's IP address, you can use vm-hostname.local as if it were a Mac with Bonjour.

EDIT: I see you're using a NAT interface. I typed up a long list of instructions only got get stuck on the final step. I'll do more research into this, but in the meantime, here's some instructions which I have not tested, but might work on the Mac side...

Here's incomplete instructions, I will finish them up shortly:

VMware Susion starts assigning IPs via DHCP at .128 (at least on my machine). The first three octets of the IPs are defined by a network probe which happened when you installed VMware, so you'll want to determine what network VMware chose for you, and then choose an IP underneath the range VMware assigns via DHCP to avoid conflicts:

  1. Determine what network VMware chose: In the Ubuntu Virtual Machine, choose System > Administration > Network Tools. In the window that appears, under "Network Device", choose "Ethernet Interface (eth0)". In the list below, look for "IPv4". Look at the IP address in the right hand column, and make note of the first three octets (numbers between the dots). On my machine, this is: 172.16.1

  2. Choose a new static IP: You can make up any number from 2 to 127 which will be appended to the network from step 1, as long as it doesn't conflict with any other static IPs you have assigned. Let's say you choose 15, because I like the number 15. In my example your static IP would then be 172.16.1.15.

  3. Configure Ubuntu to use a static IP: Go to System > Preferences > Network Connections in the Ubuntu VM. Under "Wired" choose "Auto eth0" and click "edit". Go to "IPv4 Settings" and set "Method:" to "Manual". Next to "Addresses", click the "Add" button. In the new row that appears, under "Address", enter the IP you close (172.16.1.15 in my example). Under Netmask, enter 255.255.255.0. Under gateway, enter the first three octets of your IP, followed by .1. (In my example, the gateway would be 172.16.1.1). Under DNS Servers, enter... oh, crap, this is being provided by DHCP. Let me figure out a way to make this work :-/