Wiki source for HowToWifiFromCommandWPA
[[HomePage]] > [[ComponentHowTo Components and HowTos]] > [[Networking]]
{{include pagesHowToWifi}}
====How to configure wifi from the commandline====
==PART 2: WPA encryption.==
""
<br/>
For WPA encryption the "iwconfig" utility cannot be used at all. Instead, the "wpa_supplicant" utility is needed, and this is the utility which is used by Puppy's Network Wizard to configure WPA connections.
<br/>
<br/>
Exception:
<br/>
Ralink drivers in Puppy versions older than ver 4.1 can be set up for WPA encryption with unique "iwpriv" commands. See -
<br/>
"PART 3: WPA encryption with Ralink devices"
<br/>
<a class="postlink" target="_blank" href="http://www.murga-linux.com/puppy/viewtopic.php?p=159339#159339">http://www.murga-linux.com/puppy/viewtopic.php?p=159339#159339</a>
""
wpa_supplicant needs to have a "-D" (driver) parameter specified, depending on which wifi driver is being used;
Compatible drivers using the "hostap" parameter:
hostap
Compatible drivers using the "ipw" parameter:
r8180
r8187
Compatible drivers using the "wext" (generic) parameter:
||acx
ath5k
ath_pci
b43
b43legacy
bcm43xx
ipw2100
ipw2200
ipw3945
iwl3945
||iwl4965
libertas_cs
libertas_sdio
ndiswrapper
p54pci
p54usb
rndis_wlan (Broadcom USB)
||rt2400pci
rt2500pci
rt2500usb
rt2860sta
rt2870sta
rt61pci
rt73usb
rtl8180
rtl8187
usb8xxx
zd1211
zd1211b
zd1211rw||
""
Compatible drivers using the "ralink" parameter:
<br/>
rt61
<br/>
rt73
<br/>
<br/>
INSTRUCTIONS
<br/>
Use Geany to modify the WPA configuration file to include your SSID and Personal Security Key (PSK).
<br/>
Puppy already contains 2 different configuration files;
<br/>
/etc/network-wizard/wireless/wpa_profiles/wpa_supplicant.conf - for WPA encryption
<br/>
/etc/network-wizard/wireless/wpa_profiles/wpa_supplicant2.conf - for WPA2 encryption
<br/>
<br/>
As an example, let's assume your wifi driver is the ipw2200 (so the -D parameter will be "wext") and this driver has created the network interface "eth1", and your wifi router is set for WPA2 encryption. First you must load your driver if Puppy has not automatically done so already
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">modprobe ipw2200</td> </tr></tbody></table><span class="postbody">
<br/>
It's often necessary to "bring up" the interface unconfigured
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">ifconfig eth1 up</td> </tr></tbody></table><span class="postbody">
<br/>
Remove stale wpa_supplicant file if it exists
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">rm /var/run/wpa_supplicant/*</td> </tr></tbody></table><span class="postbody">
<br/>
Start wpa_supplicant with debugging enabled (-dd) in case of problems
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">wpa_supplicant -i eth1 -D wext -c /etc/network-wizard/wireless/wpa_profiles/wpa_supplicant2.conf -dd</td> </tr></tbody></table><span class="postbody">
<br/>
wpa_supplicant may take about 30 seconds to negotiate the connection.
<br/>
Hopefully you will see a connection reported, then you can open a second console and proceed to obtain an IP address (DHCP).
<br/>
It's possible to background the wpa_supplicant process in order to keep using the same xterminal by adding "-B" to the command
<br/>
... but do this only once you know that the wpa_supplicant command is successful, because once backgrounded you won't see any error messages.
<br/>
<br/>
Now for DHCP with Puppy 3.x and earlier -
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">rm /etc/dhcpc/*.pid
<br/>
dhcpcd -t 30 -h puppypc -d eth1</td> </tr></tbody></table><span class="postbody">
<br/>
<br/>
for Puppy 4.0 onwards, the version of dhcpcd is different, thus -
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">rm -f /var/lib/dhcpcd/*.info
<br/>
rm -f /var/run/*.pid
<br/>
dhcpcd -t 30 -h puppypc -d eth1</td> </tr></tbody></table><span class="postbody">
<br/>
<br/>
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 -
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">dhcpcd -I '' -t 30 -h puppypc -d eth1</td> </tr></tbody></table><span class="postbody">
<br/>
That's hyphen, capital i, space, apostrophe, apostrophe (not quotation marks). Thanks to rerwin for this information.
<br/>
<br/>
or to obtain a static IP address,
<br/>
modify /etc/resolv.conf to include your nameservers, then
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">ifconfig eth1 192.168.0.xx broadcast 192.168.0.255 netmask 255.255.255.0
<br/>
route add default gw 192.168.0.1 eth1</td> </tr></tbody></table><span class="postbody">
<br/>
Obviously replace the appropriate IP addresses.
""
==Further reading==
[[HowToWifiFromCommandWEP PART 1 WEP encryption]]
[[http://www.murga-linux.com/puppy/viewtopic.php?p=159339#159339 PART 3: WPA encryption with Ralink devices (pre-Puppy 4.1 ONLY)]]
==Also see==
[[http://www.murga-linux.com/puppy/viewtopic.php?t=22469 How to configure wifi from the commandline thread]]
{{include pagesHowToWifi}}
====How to configure wifi from the commandline====
==PART 2: WPA encryption.==
""
<br/>
For WPA encryption the "iwconfig" utility cannot be used at all. Instead, the "wpa_supplicant" utility is needed, and this is the utility which is used by Puppy's Network Wizard to configure WPA connections.
<br/>
<br/>
Exception:
<br/>
Ralink drivers in Puppy versions older than ver 4.1 can be set up for WPA encryption with unique "iwpriv" commands. See -
<br/>
"PART 3: WPA encryption with Ralink devices"
<br/>
<a class="postlink" target="_blank" href="http://www.murga-linux.com/puppy/viewtopic.php?p=159339#159339">http://www.murga-linux.com/puppy/viewtopic.php?p=159339#159339</a>
""
wpa_supplicant needs to have a "-D" (driver) parameter specified, depending on which wifi driver is being used;
Compatible drivers using the "hostap" parameter:
hostap
Compatible drivers using the "ipw" parameter:
r8180
r8187
Compatible drivers using the "wext" (generic) parameter:
||acx
ath5k
ath_pci
b43
b43legacy
bcm43xx
ipw2100
ipw2200
ipw3945
iwl3945
||iwl4965
libertas_cs
libertas_sdio
ndiswrapper
p54pci
p54usb
rndis_wlan (Broadcom USB)
||rt2400pci
rt2500pci
rt2500usb
rt2860sta
rt2870sta
rt61pci
rt73usb
rtl8180
rtl8187
usb8xxx
zd1211
zd1211b
zd1211rw||
""
Compatible drivers using the "ralink" parameter:
<br/>
rt61
<br/>
rt73
<br/>
<br/>
INSTRUCTIONS
<br/>
Use Geany to modify the WPA configuration file to include your SSID and Personal Security Key (PSK).
<br/>
Puppy already contains 2 different configuration files;
<br/>
/etc/network-wizard/wireless/wpa_profiles/wpa_supplicant.conf - for WPA encryption
<br/>
/etc/network-wizard/wireless/wpa_profiles/wpa_supplicant2.conf - for WPA2 encryption
<br/>
<br/>
As an example, let's assume your wifi driver is the ipw2200 (so the -D parameter will be "wext") and this driver has created the network interface "eth1", and your wifi router is set for WPA2 encryption. First you must load your driver if Puppy has not automatically done so already
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">modprobe ipw2200</td> </tr></tbody></table><span class="postbody">
<br/>
It's often necessary to "bring up" the interface unconfigured
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">ifconfig eth1 up</td> </tr></tbody></table><span class="postbody">
<br/>
Remove stale wpa_supplicant file if it exists
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">rm /var/run/wpa_supplicant/*</td> </tr></tbody></table><span class="postbody">
<br/>
Start wpa_supplicant with debugging enabled (-dd) in case of problems
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">wpa_supplicant -i eth1 -D wext -c /etc/network-wizard/wireless/wpa_profiles/wpa_supplicant2.conf -dd</td> </tr></tbody></table><span class="postbody">
<br/>
wpa_supplicant may take about 30 seconds to negotiate the connection.
<br/>
Hopefully you will see a connection reported, then you can open a second console and proceed to obtain an IP address (DHCP).
<br/>
It's possible to background the wpa_supplicant process in order to keep using the same xterminal by adding "-B" to the command
<br/>
... but do this only once you know that the wpa_supplicant command is successful, because once backgrounded you won't see any error messages.
<br/>
<br/>
Now for DHCP with Puppy 3.x and earlier -
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">rm /etc/dhcpc/*.pid
<br/>
dhcpcd -t 30 -h puppypc -d eth1</td> </tr></tbody></table><span class="postbody">
<br/>
<br/>
for Puppy 4.0 onwards, the version of dhcpcd is different, thus -
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">rm -f /var/lib/dhcpcd/*.info
<br/>
rm -f /var/run/*.pid
<br/>
dhcpcd -t 30 -h puppypc -d eth1</td> </tr></tbody></table><span class="postbody">
<br/>
<br/>
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 -
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">dhcpcd -I '' -t 30 -h puppypc -d eth1</td> </tr></tbody></table><span class="postbody">
<br/>
That's hyphen, capital i, space, apostrophe, apostrophe (not quotation marks). Thanks to rerwin for this information.
<br/>
<br/>
or to obtain a static IP address,
<br/>
modify /etc/resolv.conf to include your nameservers, then
<br/>
</span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tbody><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code">ifconfig eth1 192.168.0.xx broadcast 192.168.0.255 netmask 255.255.255.0
<br/>
route add default gw 192.168.0.1 eth1</td> </tr></tbody></table><span class="postbody">
<br/>
Obviously replace the appropriate IP addresses.
""
==Further reading==
[[HowToWifiFromCommandWEP PART 1 WEP encryption]]
[[http://www.murga-linux.com/puppy/viewtopic.php?p=159339#159339 PART 3: WPA encryption with Ralink devices (pre-Puppy 4.1 ONLY)]]
==Also see==
[[http://www.murga-linux.com/puppy/viewtopic.php?t=22469 How to configure wifi from the commandline thread]]