Code:

sudo ifconfig wlan0 down sudo dhclient -r wlan0 sudo ifconfig wlan0 up # If you have WPA, doing something like the following might work, # but I haven't tested this command and it depends on the # wirelesstools package, I think. wpa_supplicant -B -Dwext -i wlan0 -c /path/to/wpa/passkey/file.conf # If you have WEP, do this: iwconfig wlan0 essid '<network name>' iwconfig wlan0 key <hex key> # or s:<ascii key> # If your network isn't encrypted, just use: iwconfig wlan0 essid '<network name>' # Whether or not your network is encrypted, type: dhclient wlan0 ping google.com