Sun Apr 27th 2008 @ 2:10 pm
So, as it turns out, there's not much documentation on setting up a wireless connection with a static IP address for Ubuntu. As I solved this little dilemma of mine, I though it would be a good opportunity to write an entry to help others out there with the same problem (if there are any).
Part of the problem is that it seems the application NetworkManager is great for using wireless connections over DHCP, but it chokes on static IPs. One of the first things I tried was removing NetworkManager altogether. Having solved the problem, it may be unnecessary to keep it around, but I ended up getting everything working with it so let's leave it alone.
While digging around through forums and posts, I found out that NetworkManager seems to ignore interfaces that have been set up in the /etc/network/interfaces file. Initially after editing this file to configure my wireless interface (usually wlan0, which was the case for me) it looked like this:
auto wlan0 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
Note that in the snippet above I have excluded the configuration for the loopback interface (lo0); you probably want to leave that alone. Now, regarding the configuration for wlan0, ifconfig told me that i indeed had the IP address 192.168.1.100 for the wlan0 interface, but i had no apparent active connection: no web, no network, I couldn't even ping the router. I looked in the man page for interfaces,
$ man interfaces
but I couldn't find anything I missed. After a few more minutes of googling, I came across an unrelated forum post which revealed I was indeed missing a line in the /etc/network/interfaces file:
So now my /etc/network/interfaces entry for wlan0 looked like this:
auto wlan0 iface wlan0 inet static wireless-essid <MYWIRELESSAP> 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
where <MYWIRELESSAP> is the name of my wireless access point. After saving /etc/network/interfaces, I ran:
$ sudo /etc/init.d/networking restart
and connectivity was restored, this time using the wireless connection with the static IP address of 192.168.1.100.