Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Need to configure an static IP address, I'm doing tests with WordPress in a Virtual Machine with Linux (on VMWare Player) and I want a static IP on that VM and internet connection. I tried configurin the file /etc/network/interfaces like this:

auto eth0
iface eth0 inet static

I need to set up a gateway too? And how I need to do this? My laptop is always changing from networks like home or school

What I need to configure VMware? NAT or Bridged? I discard Host-only because I need internet connection too.

share|improve this question
up vote 1 down vote accepted

Since you change your network connection often, it makes little sens to use a static IP configuration. You see, when you change configuration in /etc/network/interfaces, you certainly need to specify the network and the gateway, besides mask and your own address (plus, if you wish, broadcast and dns-nameservers). The first three specs (gateway, network, mask) change from LAN to LAN, so it is possible that your chosen IP address belongs to a completely different network: in this case, you would be left incommunicado.

Also, it is possible that your chosen address is already taken, which would cause a number of difficult-to-diagnose malfunctions (just try it once, for pure fun, you'll see it).

As for syntax, a correct, simple configuration is:

 auto eth0
 iface eth0 inet static

to which you may add pre-up/post-up/pre-down/post-down to specify actions to be executed before/after connection/disconnection.

If however you insist on retaining your address, you will have to learn how to listen to a network without having a proper IP address, to discover whether a 145 address has been given to someone already.

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.