8

Connecting to the wireless is relatively simple.

After some struggle, you have wifi in your installer. You can install Ubuntu Server and everything is alright. You are ready to boot your new system.

After setup finished, wifi settings disappeared.

tl;dr: How do I connect to a wireless (WPA2 Personal) network from Ubuntu Server 12.10?

What I have tried so far:

Connected with iw* commands. Obtained IP address with dhclient. Put these commands to etc/rc.local.

On boot, the server waits 120 seconds with message "Waiting for network to come up"

To fix this, I removed everything /etc/network/interfaces (wpa-psk and wpa-ssid).
This did not work. It was still waiting. I found an answer, which said I could just remove the /etc/... (the file that was in charge of the 120 second wait time.)

I did that, and kept a backup of it. Now the server waits ~3 seconds (modified sleep within the file) and boots up. However, there's no network connection available. It's some dhcp error.

As I was out of options, I tried using the one in comment. The one that used "tee".
Turns out it does not work either.

How can this whole thing be so inconsistent? How can they not install the firmwares on the ISO while it would perfectly fit (673+~10MB = 683). How can the installer NOT copy the necessary files and set up the connection to be used later? (Or ask if the user wants to use it.)

Olli
  • 8,971
Apache
  • 5,030
  • Possible duplicate of http://askubuntu.com/questions/8568/can-ubuntu-server-connect-to-a-wpa2-encrypted-wireless-network (look at the second answer, not the accepted one) or http://askubuntu.com/questions/172473/connecting-to-the-wirelesswpa-from-commandline – guntbert Mar 22 '13 at 21:59
  • @guntbert - Thanks for the fast response (sorry I was on the other display which is connected to the server). Trying the second answer as you suggested, please refrain from downvoting/closing the Q until then. (I'll re-work it with more information if this fails as well.) – Apache Mar 22 '13 at 22:25
  • @guntbert: Alright, I'll attach the file in a few hours (can't reach now the server as I couldn't fix this wifi thing.) | btw. it's a stock 12.10 x64 install. – Apache Mar 26 '13 at 07:42
  • Don't bother please, my comment was intended for a different problem, my client/this person botched the thing :-)) – guntbert Mar 28 '13 at 22:03
  • 1
    @guntbert - Alright. Guess there is no solution either. It's broken it seems. Well, who would use Wifi on a server? (Besides me.) I'll just get a long cable. – Apache Mar 29 '13 at 16:01
  • I'm having a real hard time understanding what your problem is and what you are asking. Please edit your question to remove extraneous comments and be more clear about what exactly you have done and what results each step produced. – virtualxtc Feb 03 '14 at 01:51
  • @virtualxtc: " How do I connect to a wireless (WPA2 Personal) network from Ubuntu Server 12.10?". This is the question. And I listed all the steps. But I will rework my Q tomorrow. But it's already outdated. (Not that the wifi setup got fixed in the server version... lol) – Apache Feb 03 '14 at 21:52
  • @virtualxtc: As you can see, it wasn't me who added the bounty. But I agree with the bounty adder, this is an important thing... like ...how comes no one uses this? How comes this is not "official"? ... Oh well. I will rework Q and remove comments tomorrow. (5 days will be still left to figure this mistery out.) – Apache Feb 03 '14 at 21:58
  • @Shiki I don't know why, but I never seem notice when someone different than the OP bounties; I'll try to be more careful. – virtualxtc Feb 03 '14 at 21:59
  • have you tried wpa-supplicant? http://askubuntu.com/questions/138472/how-do-i-connect-to-a-wpa-wifi-network-using-the-command-line – virtualxtc Feb 03 '14 at 22:02

3 Answers3

12

1) Install the package wpasupplicant.

2) Then write:

sudo su
wpa_passphrase [SSID] >> /etc/wpa_supplicant.conf
exit

Where [SSID] is SSID of point where you want to connect. After entering this command, you have to write password for that acces point.

3) Run wpa_suplicant with new config file.

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

Make sure that your interface is wlan0, or change it if needed!

-B is for background running.

-D is used driver.

-i is interface.

4) You should be connected now :)

NGRhodes
  • 9,490
HELU
  • 326
  • 2
  • 6
  • This worked great. In my case I missed of the -D <your_adapter> as I figured it's enough time since my laptop was released that it'd auto-detect, and it did. Also this only joined the wifi, it didn't request an IP address so I ran dhclient wlan0 afterwards to fix that. – Forbesmyester May 12 '15 at 16:35
  • In my case wifi is not well connected. I got "Access point: Not-Associated" after run iwconfig... – ZecKa May 15 '22 at 20:39
  • I restart my router and now it's working... – ZecKa May 15 '22 at 21:05
6

I used instructions from https://wiki.debian.org/WiFi/HowToUse#WPA-PSK_and_WPA2-PSK.

Don't forget to remove anything you added in etc/rc.local as it could conflict

First, make sure you have installed (can't remember if its installed by default or not) the package "wpasupplicant"

Then you need to edit the "/etc/network/interfaces" file.

The stanza used was based on the example from the above link (reproduced below):

auto wlan0
iface wlan0 inet dhcp
    wpa-ssid mynetworkname
    wpa-psk mysecretpassphrase

You will need to check which interface your Wifi card is (its usually wlan0) and you need the key and ssid of your wireless network.

NGRhodes
  • 9,490
1

Here are my notes for connecting to an

Android portable hotspot

/etc/network/interfaces

iface wlan1 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant_android.conf

/etc/wpa_supplicant/wpa_supplicant_android.conf

network={
    ssid="AndroidAP"
    psk="password"
}

Notes

  • use $ ifup wlan1 to bring the interface up. Insert 'auto wlan1' in the line before 'iface wlan1 inet dhcp' to have linux automatically bring up the interface
  • $ip link is a useful bash command to identify the wireless identifier (wlan*).

iPad/MAC personal hotspot/wifi

/etc/network/interfaces

iface wlan1 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant_ipad.conf

/etc/wpa_supplicant/wpa_supplicant_ipad.conf

network={
    ssid="Hamish’s iPad"
    psk="myPassword"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP
    auth_alg=OPEN
}

Notes

  • Beware the "’" character, it is not the same as "'"
  • Unlike with the Android network, wpa supplicant requires additional paparameters to connect to the MAC based wifi...
hamish
  • 171