Ubuntu – Script to connect to hidden wireless network with static IP

wireless

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.

Best Answer

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

Related Question