Revision [20680]

This is an old revision of HowToWifiFromCommand made by darkcity on 2012-02-18 06:06:01.

 

HomePage > ComponentHowTo Components and HowTos > Networking
text

How to configure wifi from the commandline


Puppy's Network Wizard is one of the best in the business. It supports all currently available Linux wifi drivers including the unconventional linux-wlan-ng (prism2) drivers, plus ndiswrapper. And it fully supports WPA & WPA2 encryption via wpa_supplicant, even with the Ralink drivers, which out-of-the-box are not normally compatible with wpa_supplicant.

In a DistroWatch review of Puppy 3.00 http://distrowatch.com/weekly.php?issue=20071008#review
Susan Linton said this -

Quote:
The network wizard requires several steps and clicking back and forth, but it works even with Wi-Fi Protected Access (WPA). I've tested maybe three distros with graphical network configurations that actually work for my chip. It's an amazing accomplishment.


But it's worth knowing the commands that operate behind the Wizard, especially if you need to troubleshoot a problem, or you have an unconventional setup.

First it's worth knowing what module (driver) is being used for your wifi device. The correct module is NOT determined by the manufacturer of the wifi adaptor, but by the CHIPSET contained within the wifi adaptor.

From version 2.12 onwards, Puppy Linux includes EXTENSIVE wifi driver support, including many Linux drivers written by independent development projects not aligned with the official Linux kernel.


For wifi chipsets not supported by a native Linux driver, Puppy also includes ndiswrapper, which will "wrap" a Windows driver. Obviously, you must supply the Windows driver files.

ndiswrapper is a workaround solution, but sometimes it's the ONLY solution.

Usually, Puppy will automatically detect your wifi device, and load the suitable driver from its "zdrv" compressed driver collection.

Run this command to see which modules are currently loaded
lsmod


When a wifi module loads, it creates a network interface, which will be called "eth0" "wlan0" "ra0" "ath0" or "rausb0".

But if you also have an ethernet interface, this has probably taken the interface name "eth0" so the wifi interface will be "eth1".

First check that your wifi module has created an interface, with these 2 commands

ifconfig -a

iwconfig


For the sake of this example, let's assume your wifi interface is "eth1".

It's often necessary to "bring up" the interface unconfigured with this command

fconfig eth1 up


PART 1: WEP encryption.


(To configure for WPA encryption, see PART 2.)


To configure for WEP encryption -
Code:
iwconfig eth1 essid MY_ESSID
iwconfig eth1 key open 1234567890
iwconfig eth1 mode managed

You will often see reference to these 3 parameters, essid/key/mode, being used within a single iwconfig command instead of 3 separate commands, but apparently the configuration is more reliable when the parameters are run separately.
Obviously replace "MY_ESSID" with your SSID, and "1234567890" with your WEP encryption key - as hexadecimal digits.
If you want to use your WEP password (ASCII string) instead of the true WEP hex key, then you must use the s: prefix. In this case the 2nd command would be -
Code:
iwconfig eth1 key open s:MY_WEP_PASSWORD

And if your password contains spaces, you should enclose it in quotation marks.

Most wifi routers use "open" WEP authentication, but it could be "restricted", in which case the 2nd command should be
Code:
iwconfig eth1 key restricted 1234567890

Or if your router has no encryption, the 2nd command should be
Code:
iwconfig eth1 key off


Now to obtain an automatic IP address (DHCP)
for Puppy 3.x and earlier -
Code:
rm /etc/dhcpc/*.pid
dhcpcd -t 30 -h puppypc -d eth1


for Puppy 4.0 onwards, the version of dhcpcd is different, thus -
Code:
rm -f /var/lib/dhcpcd/*.info
rm -f /var/run/*.pid
dhcpcd -t 30 -h puppypc -d eth1


If this dhcpcd command fails, try it with extra parameters which avoid any use of the new logic for ipv6-compatible Client ID, like this -
Code:
dhcpcd -I '' -t 30 -h puppypc -d eth1

That's hyphen, capital i, space, apostrophe, apostrophe (not quotation marks). Thanks to rerwin for this information.

Or to obtain a static IP address,
modify /etc/resolv.conf to include your nameservers, then
Code:
ifconfig eth1 192.168.0.xx broadcast 192.168.0.255 netmask 255.255.255.0
route add default gw 192.168.0.1 eth1

Obviously replace the appropriate IP addresses.

Puppy contains an alternative wifi configuration utility, RutilT. This is more than just a script, it's a full application, and may be useful if the Network Wizard fails, especially at the last point of setup; acquiring an IP address.
But RutilT supports WPA encryption ONLY with Ralink wifi drivers (for which RutilT was originally written) and even then, only the basic WPA/PSK-TKIP variant.

Edited_times_total

Also see
How to configure wifi from the commandline thread
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki