-
Notifications
You must be signed in to change notification settings - Fork 10
Wifi
In very simple terms, wifi connection is determined by the hardware (wifi dongle) the driver (which makes the hardware compatible) and the configuration files (which makes the software work) which also include the Wifi encryption settings, of which there are 4.
- WPA
- WPA2
- WEP
- Open Network
Each network has its own name called the SSID or ESSID and some of them can be hidden or invisible which leaves the last main option
- Hidden SSID
There are two main configuration files that can be edited: /etc/network/interfaces
, and /etc/wpa_supplicant/wpa_supplicant.conf
Interfaces can be used on its own, but wpa_supplicant.conf is something that requires editing of interfaces and wpa_supplicant.conf.
For wpa_supplicant conf you can either have a static list of networks or use wpa-roam which enables you to connect to multiple networks on the fly but you have to change the config variable to this iface wlan0 inet manual
instead of dhcp.
So without further ado, here is a complete list of configuration options for the 5 different types of wifi in interfaces and in wpa_supplicant.
/etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "Your Wireless Network Name"
wpa-psk "Your Wireless Network Password"
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wireless-essid NETWORK_NAME
wireless-key NETWORK_PASSWORD
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wireless-essid UR_ESSID
wireless-mode managed
wpa-ssid "UR_ESSID"
wpa-psk "Password"
wpa-scan-ssid 1
Interfaces (roaming-- Preferable because it reconnects after network drop)
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#The following line specified in /etc/network/interfaces will activate and configure each 'default' network in wpa_supplicant.conf with DHCP upon a successful connection to an access point (this line needs to be here for wpa-roam)
iface default inet dhcp
Interfaces (non-roaming)
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
#The following line specified in /etc/network/interfaces will activate and configure each 'default' network in wpa_supplicant.conf with DHCP upon a successful connection to an access point
iface default inet dhcp
Interfaces (static IP)
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#id_str is the name of the network you setup in wpa_supplicant.conf
iface id_str inet static
address 192.168.0.104
netmask 255.255.255.0
gateway 192.168.0.1
#The following line specified in /etc/network/interfaces will activate and configure each 'default' network in wpa_supplicant.conf with DHCP upon a successful connection to an access point
wpa_supplicant
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="Your SSID Here"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="YourPresharedKeyHere"
# add the following line with your chosen ID and reference it a described in interfaces
id_str="home_server"
}
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="Your SSID Here"
psk="Password"
}
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="YOURWLANSSID"
key_mgmt=NONE
wep_tx_keyidx=0 #this forces it to use wep_key0
wep_key0=YOURWEPKEY
}
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="Your SSID Here"
key_mgmt=NONE
}
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="Your SSID Here"
key_mgmt=NONE
scan_ssid=1
}
Code:
sudo iwlist wlan0 scan | awk '/IE: WPA/ || /ESSID:/ || /IE: IEEE/ || /Encryption/'
Results
#WPA
Encryption key:on
ESSID:"Network SSID"
IE:WPA Version 1
#WPA/WPA2
Encryption key:on
ESSID:"Network SSID2"
IE:WPA Version 1
IE: IEEE 802.11i/WPA2 Version 1
#WEP
Encryption key:on
ESSID:"Network SSID3"
#Open Network
Encryption key:off
ESSID:"Network SSID4"