O'Reilly logo

Linux Shell Scripting Cookbook by Sarath Lakshman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting up an Ethernet and wireless LAN with script

An Ethernet is simple to configure. Since it uses physical cables, there are no special requirements such as authentication. However, a wireless LAN requires authentication—for example, a WEP key as well as the ESSID of the wireless network to connect. Let's see how to connect to a wireless as well as a wired 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...

In order to connect to a network from a wired interface, execute the following script: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required