6

I have a machine that I just installed Ubuntu Server on. The only problem is that I do not know how to connect it to a wireless network, and I cannot use a network cable to connect it to my router.

When trying to list the network cards, only the loopback interface showed up:

$ ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric 1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

which was unexpected, as both my Ethernet network interface (eth0) and wireless network interface (wlan0) showed up when doing the same in a fresh installation of Ubuntu Desktop 10.10.

So, my two questions are:

  • how can I install the wireless drivers (and packages I could download etc.) and/or set up the wireless network interface to work properly, and
  • how can I connect to a WPA-encrypted wireless network from the command line?

EDIT:

I ended up uninstalling Ubuntu Server and installing Ubuntu Desktop instead, then configuring the wireless network through the GUI and making it boot into command line instead of GNOME.

Frxstrem
  • 4,231

3 Answers3

4

If you don't have wireless drivers, then you will have to figure out a way to get those first, because you obviously will not be able to use your wireless card to get those ;) you can look them up on another computer and install the binaries. More than likely, though, you do already have drivers, but you need to edit your /etc/network/interfaces (as root), which contains interface declarations. It should register your cards once you add the following lines to it:

auto eth0
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp

This will should make ubuntu recognize the cards once you hit /etc/init.d/networking restart and ifup -a.

Once you have the wireless card up, you can type iwlist scan to list wireless networks in range. I have only dealt with open and WEP-secured networks, and it works perfectly for those. For those networks, you can use

iwconfig wlan0 essid "network-name" ap any key <wep-key>

I know WPA is possible, but it's a lot more configuration than just using iwconfig.

shroff
  • 549
1

Take a look at this guide for connecting to the network: http://ubuntuforums.org/showthread.php?t=571188

  • This seems to be partly what I'm looking for, but I still do not get the network interfaces to work, so the problem is still not completely solved. – Frxstrem Dec 09 '10 at 19:05
0

I hope I can give you some ideas for your first question, but I only have a definite answer for the second one.

  1. Driver installation: for that, you need to know your wireless interface chipset. First, you need to know the model of the interface you have. (If you don't, run lspci or lsusb and google the line which looks like a wireless device). Then go to http://linuxwireless.org/en/users/Devices and find your device model in the appropriate list. There you can find instructions how to install the driver.

If this site tells you that the driver is already part of the kernel, then you have some issue you must troubleshoot. For example, there are two drivers for Ralink, both included with Ubuntu, and when you plug the card in, both drivers try to steer it, so it doesn't work. The solution is to blacklist one of both. For this kind of problem, you will probably have to google something like "[chipset] wireless card does not work on ubuntu", this gets you a result much quicker than if you google it without the chipset name.

  1. Connect from the command line

Edit (or create) the file /etc/wpa_supplicant/wpa_supplicant.conf

It needs following code:

    network={
        ssid="networkname"
        scan_ssid=1
        proto=WPA
        key_mgmt=WPA-PSK
        pairwise=CCMP
        group=TKIP
        psk="networkpassword"
}

Depending on the router settings, you may need to try out different combinations for pairwise and group (e. g. both CCMP or both TKIP).

This solution assumes that you are using the older WPA encryption. If you have WPA 2, it changes to proto=RSN.

Then connect using the line

sudo wpa_supplicant -i wlan0 -D wext -c /etc/wpa_supplicant/wpa_supplicant.conf 

here you need to write the name of your interface after -i and the name of your driver after -D (you should know both after you have solved 1.)

I can vouch that this method worked with Intrepid, but haven't used it since. If there is a problem with it, you can look at how to set it up in the man file here.

rumtscho
  • 1,051