Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How do I set my computer to have a static IP in Ubuntu 11.04? The only two lines in /etc/network/interfaces are:

auto lo
iface lo inet loopback

I think usually when people do this they have a wired connection and just edit the eth0 settings, however I'm using a wireless adapter.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You can use Network Manager with a static IP address.

If you want a system-wide setting, you can use /etc/network/interfaces for a wireless adapter. The only difference with a wired adapter is that you'll need extra settings for the encryption (unless your wifi network is unencrypted).

For WPA (any supported variant), use wpa-supplicant Install wpasupplicant.

auto wlan0
iface wlan0 inet static
    address 192.0.2.3
    netmask 255.255.255.0
    broadcast 192.0.2.255
    gateway 192.0.2.1
    dns-nameservers 192.0.2.2
    wpa-ssid chez-jackson
    wpa-psk swordfish

The wpa- parameters are those you could put in a block in wpa_supplicant.conf, with wpa- prefixed.

For WEP, the wireless-tools Install wpasupplicant package has all you need. Instead of the wpa- settings, put wireless- settings, e.g.

    wireless-essid chez-jackson
    wireless-key 0123456789abcdef
share|improve this answer
    
Great answer, thanks. –  Jackson Walters Jul 10 '11 at 21:59

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.