Server Fault is a question and answer site for system and network administrators. 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

I am trying to figure out how to create a static IP address for my Ubuntu server. So far, I have scoured the internet and have only found how to do it with eth0, when I am using a PCI adapter for my main send/receive. This may not be as efficient as Ethernet, but this is simply for learning web structure, if you will.

Is there a difference between setup for wlan0 and eth0 static IP? If not, can I be referred to a site that explains how to do this in the fullest manner?

Thank you.

share|improve this question

The short answer is yes, do it the same way. By the time wlan0 is working (which is generally the tricky part in Linux), it is being treated the same as eth0 and you can use identical directives to configure wlan0 however you wish.

EDIT: Instructions

Open /etc/network/interfaces using your favorite text editor (I use vim):

vim /etc/networking/interfaces

It will look something like this:

auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet dhcp

Make it look like this instead (using your own values for address, netmask, etc):

auto lo
iface lo inet loopback
iface wlan0 inet static

Bring down the interface (simplest way to release DHCP IP):

ifdown wlan0

Bring it back up (simplest way to effect new setting):

ifup wlan0
share|improve this answer
Okay, but this does not explain how I should set it up... – nmagerko Nov 29 '11 at 21:49

Here is a decent write up.

It's pretty likely you don't need the ndiswrapper part of this. That is only useful if you need to pull the windows drivers to make your nic work.

share|improve this answer
Very decent indeed. – nmagerko Nov 29 '11 at 22:02
But what is this used for? It does not set a static ip – nmagerko Nov 29 '11 at 22:07
I just tried this and it made matters worse. – nmagerko Nov 29 '11 at 22:15

Use the following steps to set a static ip in Ubuntu :

/etc/network/interfaces configuration file. You need to open this file using a text editor such as vi or gedit.

Open terminal, and type the following command:

% sudo vi /etc/network/interfaces


% sudo gedit /etc/network/interfaces

Make the changes as follows:

auto eth0
iface eth0 inet static

Save and close the file. Restart networking:

% sudo /etc/init.d/networking restart

Yes, a little difference between Wlan0 and eth0. Use this link to learn more details about wlan0 and eth0.

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.