Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Okay, so I've recently set up a server with Ubuntu Server 12.10 to run as a headless server. When I ran the OS installer/setup it gave me an option to immediately connect to a wireless network (this box has a wireless card), and so I connected to my home network. Since then I've turned the server on/off multiple times and it's always automatically connected to the wireless network until yesterday.

Usually I would SSH into the server, but yesterday I couldn't, so I hooked a keyboard and a monitor back up and learned that it wasn't connected to the wireless network. Yesterday and today I attempted countless efforts to reconnect to the network from the command line based on advice from threads I found on google, but have been unsuccessful.

This is extremely frustrating: surely it shouldn't be this difficult? I'm tired of trying to edit my interfaces file. Many of the threads I've found seem to date back quite a while. Can anyone please help out?

share|improve this question
    
Can you post your interfaces file? –  Eric Carvalho Mar 5 '13 at 1:06
    
Sure! Here's my interfaces file # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto wlan0 iface wlan0 inet dhcp wpa-ssid <Wireless Network SSID> wpa-driver wext # wpa-psk <non-hex password> wpa-ap-scan 1 wpa-pairwise TKIP CCMP wpa-group TKIP CCMP wpa-proto WPA RSN wpa-key-mgmt WPA-PSK wpa-psk <hex password> #auto eth0 #iface eth0 inet dhcp –  Price Mar 5 '13 at 2:03
    
Well that formatted itself terribly... Let me try that again # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto wlan0 iface wlan0 inet dhcp wpa-ssid <Wireless Network> wpa-driver wext wpa-ap-scan 1 wpa-pairwise TKIP CCMP wpa-group TKIP CCMP wpa-proto WPA RSN wpa-key-mgmt WPA-PSK wpa-psk <hex key> #auto eth0 #iface eth0 inet dhcp –  Price Mar 5 '13 at 2:38
    
Any help? What could be causing this problem? –  Price Mar 5 '13 at 4:18
    
You may need to look at dmesg | grep wlan0 for clues. Please don't dump the output into a comment, add it to the question with proper formatting, or use pastebin.com. –  mikewhatever Mar 5 '13 at 9:44
add comment

1 Answer 1

First of all, confirm you have a working wireless card and driver:

sudo iwlist wlan0 scan

Does it scan and see your network? Good. Next, if this is a server and you want to ssh into it, I wouldn't use DHCP, I suggest static. Then, I'd simplify your interfaces file quite a bit:

auto lo
iface lo inet loopback


auto wlan0
iface wlan0 inet static
address 192.168.1.110  <--an address outside the range of the DHCP server in the router
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1 8.8.8.8
wpa-essid your_router
wpa-psk your_key

Of course, use the details appropriate to your network. Now restart the interface

sudo ifdown wlan0 && sudo ifup wlan0

Did it get the address?

ifconfig

Can it connect?

ping -c3 www.google.com
share|improve this answer
    
Okay, so this was very helpful. Made changes to my interfaces file and now the computer automatically connects to the network on startup, and when i try ifconfig, it says that it has been assigned the correct IP address. iwconfig tells me it's connected to the network, however, it doesn't seem like DNS lookup is working. When I try to ping google.com, I instead get the message ping: unknown host google.com. Now what? –  Price Mar 6 '13 at 4:42
    
Am I embarrassed! I hope you corrected my mistake above: dns-nameservers and not the ham-handed dns-nameserers. Yikes. Please correct if not already. Can you ping by number? ping -c3 192.168.1.1 (or whatever your router address is) or ping -c3 8.8.8.8 –  chili555 Mar 6 '13 at 14:17
    
I did correct the typo without even noticing; I suppose it's true that the brain only reads the first and last letters and then makes an educated guess. I cannot ping by number... –  Price Mar 6 '13 at 15:39
    
When trying to ping by number I get the response connect: Network is unreachable –  Price Mar 6 '13 at 15:40
    
Is your wireless card working correctly? sudo iwlist wlan0 scan If so, please double-check your interfaces file. You might also change to DHCP and check the address and route. If not, that's a separate question to troubleshoot the wireless. –  chili555 Mar 6 '13 at 15:49
show 7 more comments

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.