Skip to content

Instantly share code, notes, and snippets.

@legap
Last active May 6, 2016 11:12
Show Gist options
  • Save legap/dc576c00293b2ed76fc2d122e37bf65d to your computer and use it in GitHub Desktop.
Save legap/dc576c00293b2ed76fc2d122e37bf65d to your computer and use it in GitHub Desktop.

Installing Wifi from the command line

Finding the Acces Point (AP)

With the following command you can see a list of available Access Points (AP).

$ iwlist wlan0 scan

Find the one you want to use and pick the ESSID, i.e. ESSID: "my_network"

Preparing the Preshared Key (PSK) for Wi-Fi Protected Access (WPA)

When using Wi-Fi Protected Access (WPA) you will need to generate the Pre-shared key (PSK) with your (E)SSID you picked before and the PASSWORD used to connect to the Access Point:

$ wpa_passphrase ESSID PASSWORD

$ wpa_passphrase my_network 123456789

network={
	ssid="my_network"
	#psk="123456789"
	psk=1aff74de016d74e09ece8d09db76478f20bc1032e3b52d5c0053f655a279a880
}

Adding the Wifi credentials to wpa_supplicant.conf

Open the wpa_supplicant.conf file as root with the editor of your choice:

$ sudo vi /etc/wpa_supplicant/wpa_supplicant.conf
$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Insert the network informations you created with wpa_passphrase, i.e:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
	ssid="my_network"
	#psk="123456789"
	psk=1aff74de016d74e09ece8d09db76478f20bc1032e3b52d5c0053f655a279a880
}

Launching the new network connection

To see you actual network interfaces you can use these tools:

# see the actual configured interfaces
$ ifconfig

# see the configuration for wireless interfaces
$ iwconfig

Pick your wireless interface and try to start it, i.e. wlan0:

$ sudo ifup wlan0

Eventually you will need to get an IP-adress:

$ dhclient wlan0

After a restart your wireless network should start automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment