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.

Would like a script, when run, it should connect to a hidden wireless network with these details:

SSID is "Wireless" Network is not broadcasting its SSID above (is hidden) WPA2-PSK, AES, password is "password" Static IP: 192.168.1.1 Def. gateway: 192.168.1.254 DNS: 192.168.1.254

No idea how to do this. But I do know the wireless interface is called wlan0 and I'm on Ubuntu 10.10. I don't want to use the built in Network Manager as it never auto-connects on startup. WICD doesn't work either.

Any ideas most welcome.

share|improve this question
    
This question appears to be abandoned, if you are experiencing a similar issue please ask a new question with details pertaining to your problem. If you feel this question is not abandoned, please flag the question explaining that. :) –  Seth Dec 29 '12 at 4:34
add comment

4 Answers 4

Check out this page on the Arch wiki about using WPA supplicant: https://wiki.archlinux.org/index.php/WPA_supplicant#Classic_method:_wpa_supplicant.conf

Once you've set the password in wpa_supplicant.conf, you should be able to connect using the 2 commands below. Just save those in a script. Other settings are saved.

ifconfig wlan0 up
iwconfig wlan0 essid <hiddenname>

Edit your IP address and gateway in /etc/network/interfaces

share|improve this answer
add comment

If network-manager and wicd fail, then it is possible that you have a somewhat broken driver like rt2860sta that refuses point blank to connect to hidden essid (but at least rt2800pci works for me in this case).

You can try to do it using /etc/network/interfaces and /etc/wpa_supplicant/wpa_supplicant.conf something like (modulo the broken driver, so it still won't work):

/etc/network/interfaces
~~~~~~~~~~~~~~~~~~~~~~~

auto wlan0
iface wlan0 inet static
 address 192.168.1.1
 network 192.168.1.0
 netmask 255.255.255.0
 broadcast 192.168.1.255
 gateway 192.168.1.254
 wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

/etc/wpa_supplicant/wpa_supplicant.conf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0

eapol_version=1
ap_scan=1
fast_reauth=1

network={
        ssid="Wireless"
        key_mgmt=WPA-PSK
        scan_ssid=1
        psk="password"
}

and set the DNS in /etc/resolv.conf

man pages for interfaces, wpa_supplicant.conf and resolv.conf may help.

share|improve this answer
add comment

Have managed to fix my original problem of Network Manager not connecting so won't need the script now (but thanks to everyone for your help).

The problem was that in my wireless settings I had ticked the box to apply this wireless network to all users. That makes it require root access. When I turn on the laptop, it would not connect to the wireless network. It didn't even prompt for a password. All I've done is untick that box and apply this wireless network to each user manually. It now connects immediately upon startup.

share|improve this answer
add comment

Add the line wpa-scan_ssid 1 after iface wlan0 inet dhcp in the file /etc/network/interfaces.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.