Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

3 Answers 3

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
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

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.

http://modelr.wordpress.com/2009/06/01/how-to-get-wireless-network-on-ubuntu-server/

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

OR

% sudo gedit /etc/network/interfaces

Make the changes as follows:

auto eth0
iface eth0 inet static
address 10.10.29.66
netmask 255.255.255.192
network 10.10.29.65
broadcast 10.10.29.127
gateway 10.10.29.65

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

 
discard

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.