Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've setup a VM running Ubuntu 12.04 specifically for local web development and am having some problems ensuring it has a static IP address. A static IP address is important as I'm using the IP address in my hosts file to assign a .local suffix to addresses used both in browser and to connect to the correct database on the VM.

Currently, every time I connect to a new network or my VM is assigned a new IP address I need to reconfigure my whole environment which is becoming quite a pain. It also probably doesn't help that the default-lease-time on the Ubuntu VM is set to 1800 by default.

At the moment I'm using VMWare Fusion and the Network Adapter is enabled and set to "Autodetect" under Bridged Networking.

I've tried to set a static IP address within the dhcpd.conf using the code below:

host ubuntu {
    hardware ethernet 00:50:56:35:0f:f1;

The fixed-address that I've used is also outside the range specified in the subnet block (which in this case is to

I've tried adding and removing the network adapter and restarting my Mac after each time to no avail.

Below is an ifconfig of the VM that might be of some help:

eth0  Link encap:Ethernet  HWaddr 00:50:56:35:0f:f1
      inet addr:  Bcast:  Mask:
      inet6 addr: fe80::250:56ff:fe35:ff1/64 Scope:Link
      RX packets:1624 errors:0 dropped:0 overruns:0 frame:0
      TX packets:416 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:147348 (147.3 KB)  TX bytes:41756 (41.7 KB)

lo    Link encap:Local Loopback
      inet addr:  Mask:
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:16436  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Are there any specific issues with 12.04 that I'm missing? Otherwise has anyone else got any ideas?

Thanks in advance.

share|improve this question

To achieve static IP, edit /etc/network/interfaces and add:

auto eth0
iface eth0 inet static
gateway # or whatever your gateway is

Then enable the device with sudo ifup eth0 and you should be done.

share|improve this answer

May be you edit wrongly in dhcp config file.

No need to give static ip address in dhcp config.

Open your interface file and edit this lines:

auto eth0 or eth1 or eth2 ...
iface inet eth0 static
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.