Connecting to a wireless network
An Ethernet connection is simple to configure, since it is connected through wired cables with no special requirements like authentication. However, wireless LAN may require authentication like a secret key as well as ESSID of the wireless network to connect. ESSID , or Extended Service Set Identification, is the name of the network. Let's see how to connect to a wireless network by writing a shell script.
Getting ready
To connect to a wired network, we need to assign an IP address and subnet mask by using the ifconfig
utility. But for a wireless network connection, it will require additional utilities such as iwconfig
and iwlist
to configure more parameters.
How to do it...
Let's write a script for connecting to a wireless LAN with WEP (Wired Equivalent Privacy):
#!/bin/bash #Filename: wlan_connect.sh #Description: Connect to Wireless LAN #Modify the parameters below according to your settings ######### PARAMETERS ########### IFACE=wlan0 IP_ADDR=192.168.1...