Skip to content

Instantly share code, notes, and snippets.

@airtheva
Created May 21, 2014 12:11
Show Gist options
  • Save airtheva/2386226af6a38554d58d to your computer and use it in GitHub Desktop.
Save airtheva/2386226af6a38554d58d to your computer and use it in GitHub Desktop.
# An example of enabling WIFI and connecting to WEP/WPA/WPA2 wireless network.
# Here setup your network information.
ESSID=
KEY=
# Enable WLAN.
ifconfig wlan0 up
# Scan wireless networks.
iwlist wlan0 scan
# Connect to specified wireless network.
# For WEP network:
#iwconfig wlan0 essid $ESSID key $KEY
# For WPA/WPA2 network:
wpa_passphrase $ESSID key $KEY > $ESSID.wpa
wpa_supplicant -B -Dwext -iwlan0 -c$ESSID.wpa
# Fetch DHCP information.
dhclient wlan0
# Check if the WIFI is correctly setup.
ifconfig wlan0
ping 114.114.114.114
# Disable WLAN.
#ifconfig wlan0 down
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment