Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 25 Oct 2014, 18:29
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to configure wifi from the commandline
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 11 of 13 Posts_count   Goto page: Previous 1, 2, 3, ..., 9, 10, 11, 12, 13 Next
Author Message
tempestuous

Joined: 10 Jun 2005
Posts: 5271
Location: Australia

PostPosted: Wed 21 Dec 2011, 22:08    Post_subject:  

Spaccafumo wrote:
How to replace this wep-128 (ascii) command:
iwconfig eth0 key s:asciipassword
with a wpa2 analogous command?

See "PART 2: WPA encryption" on the first page of this thread
http://www.murga-linux.com/puppy/viewtopic.php?p=159336#159336
Back to top
View user's profile Send_private_message 
renketsu0

Joined: 14 Jun 2012
Posts: 3

PostPosted: Thu 14 Jun 2012, 15:03    Post_subject:  

I had a startup script working perfectly until a few weeks ago when all of a sudden it gets stuck in some loop during the 4 way handshake. I didn't change any configuration files on router or within puppy so I'm not sure what caused this change.

In addition to being stuck in an infinite 4-way handshake loop, after I halt the command my router goes nuts and refuses to connect any other client until I reset it.

I should note that I can connect via net-setup.sh for some reason, even though it appears to issue the same command and points to the same config file I am pointing to.

My script is
Code:

#!/bin/sh

ifconfig wlan0 down
modprobe rtl8187
sleep 3s
ifconfig wlan0 up

rm /var/run/wpa_supplicant/*

wpa_supplicant -B -i wlan0 -D wext -c /etc/network-wizard/wireless/wpa_profiles/wpa_supplicant2.conf
rm -f /var/lib/dhcpcd/*.info
rm -f /var/run/*.pid

# start dhcp
dhcpcd -t 30 -h myhost -d wlan0

# start the firewall
/etc/rc.d/rc.firewall


I remove -B and add -dd to see a bunch of stuff I don't understand, but I do notice

Code:

...
Cancelling authentication timeout
State: GROUP_HANDSHAKE -> COMPLETED
CTRL-EVENT-CONNECTED - Connection to MAC:ADD completed (auth) [id=0 id_str=]
wpa_driver_wext_set_operstate: operstate 0->1 (UP)
netlink: Operstate: linkmode=-1, operstate=6
EAPOL: External notification - portValid=1
EAPOL: External notification - EAP success=1
EAPOL: SUPP_PAE entering state AUTHENTICATING
EAPOL: SUPP_BE entering state SUCCESS
EAP: EAP entering state DISABLED
EAPOL: SUPP_PAE entering state AUTHENTICATED
EAPOL: Supplicant port status: Authorized
EAPOL: SUPP_BE entering state IDLE
EAPOL authentication completed successfully
RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
Wireless event: cmd=0x8b15 len=20
Wireless event: new AP: MAC:ADD
State: COMPLETED -> ASSOCIATED
wpa_driver_wext_set_operstate: operstate 1->0 (DORMANT)
netlink: Operstate: linkmode=-1, operstate=5
Associated with MAC:ADD
WPA: Association event - clear replay counter
WPA: Clear old PTK
EAPOL: External notification - portEnabled=0
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
EAPOL: SUPP_BE entering state INITIALIZE
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - portValid=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - EAP success=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - portEnabled=1
EAPOL: SUPP_PAE entering state CONNECTING
...


with MAC:ADD substituting for the real MAC addresses. It seems it actually is connecting, but then disconnecting and retrying for some reason.

Any ideas on how I can fix this? I'd even be satisfied if I could just script whatever net-setup.sh is doing when I click the "use this profile" button to execute at boot since that apparently works.[/code]
Back to top
View user's profile Send_private_message 
tempestuous

Joined: 10 Jun 2005
Posts: 5271
Location: Australia

PostPosted: Fri 15 Jun 2012, 00:17    Post_subject:  

At the outset I reiterate that manual wifi configuration is only necessary if the Puppy Network Wizard does not work, or you have some special requirement.

First up, I see a problem with your script -
Code:
ifconfig wlan0 down
modprobe rtl8187

Puppy will almost certainly have automatically loaded the rtl8187 driver, so it appears that you're forcibly loading this same driver a second time! This will most likely corrupt the driver (and the wifi device).
If you feel that the rtl8187 driver needs to be reloaded, it's important that you unload the driver, first. It's not good enough just to take down the interface with "ifconfig wlan0 down".


renketsu0 wrote:
I'd even be satisfied if I could just script whatever net-setup.sh is doing when I click the "use this profile" button to execute at boot since that apparently works.

Once you have run the Network Wizard, and click the "save" button, you have enabled the net-setup.sh script to run at each boot up. And since it works, great ... but you appear to be still running your own separate script - so the two will be fighting each other! Which one wins depends on where in the boot sequence you have located your script!

I suspect the best solution would be to forget about your script, and just use the Network Wizard.
Don't use the Simple Network Wizard - this has a relatively high failure rate, especially with WPA encryption.
Back to top
View user's profile Send_private_message 
renketsu0

Joined: 14 Jun 2012
Posts: 3

PostPosted: Fri 15 Jun 2012, 01:37    Post_subject:  

Actually network wizard doesn't connect me on boot, not even right after install and only running the wizard once with net-setup.sh. That's the only reason I wanted to script it.

I'm glad you mentioned driver corruption though, as it caused me to take a close look at the drivers. It turns out puppy was using the r8180 for my card and not rtl8187 (even though my card is an 8187). My fault for not looking to see what it detected first. After removing that line everything works fine. Thanks!
Back to top
View user's profile Send_private_message 
renketsu0

Joined: 14 Jun 2012
Posts: 3

PostPosted: Mon 18 Jun 2012, 13:44    Post_subject:  

I have a new problem. Getting wireless running is working fine but it seems my wireless router for whatever reason disconnects all clients whenever a new client connects. Or rather when I look at the router's log it shows that the previously connected clients are stuck in some reauthentication loop and connection on the client-side is shown as dropped. This will go on until I manually disconnect and reconnect. While I know it's really time for a new router I can't help but think there's a way to code reauthentication into my script. But I have no idea how I would go about doing that. Any ideas?
Back to top
View user's profile Send_private_message 
tempestuous

Joined: 10 Jun 2005
Posts: 5271
Location: Australia

PostPosted: Thu 06 Dec 2012, 08:52    Post_subject:  

I urge all newcomers only to resort to ndiswrapper as a last resort! The success rate of ndiswrapper is low, and you will generally get a more reliable wifi connection by using a true Linux driver.
Back to top
View user's profile Send_private_message 
Ibidem

Joined: 25 May 2010
Posts: 501
Location: State of Jefferson

PostPosted: Wed 02 Jan 2013, 00:02    Post_subject: Poking at sysfs  

I found out the basics of this reading SNS-retro, then poked around a little more.

All interfaces are symlinks under /sys/class/net/; these symlinks point to "../../class/<bus id>/net/<interface>".
So /sys/class/net/$INTERFACE/../../ is the directory for the device.

Within this directory, there are several files:
uevent contains the information passed at hotplug, more-or-less
For example:
Code:

$ cat /sys/class/net/wlan0/../../uevent
DRIVER=rtl8192se
PCI_CLASS=28000
PCI_ID=10EC:8172
PCI_SUBSYS_ID=10EC:E020
PCI_SLOT_NAME=0000:03:00.0
MODALIAS=pci:v000010ECd00008172sv000010ECsd0000E020bc02sc80i00

DRIVER is the module name; MODALIAS is how it got loaded...
driver/module/parameters/ contains all module parameters.
If you have a wireless device, wireless/ contains several files:
beacon
crypt
fragment
level
link (I think this tells signal strenth)
misc
noise
nwid
retries
status

To find all network devices and identify the driver:
Code:

#!/bin/sh
cd /sys/class/net
INTERFACES="`ls`"

WL=""
ETH=""
LO=""
for IFACE in $INTERFACES
do
   if [ -e $IFACE/wireless ]
   then
      echo "wireless ${IFACE} `grep DRIVER ${IFACE}/../../uevent`"
      WL="$WL $IFACE"
   elif [ -e $IFACE/../../uevent ]
   then
      echo "wired ${IFACE} `grep DRIVER ${IFACE}/../../uevent`"
      ETH="$ETH $IFACE"
   else
      echo "virtual $IFACE"
      LO="$LO $IFACE"
   fi
done
Back to top
View user's profile Send_private_message 
Ibidem

Joined: 25 May 2010
Posts: 501
Location: State of Jefferson

PostPosted: Sat 05 Jan 2013, 01:44    Post_subject:  

I've mentioned the basic concept for this here, but I figured I'd cover it here...

wpa_cli -a <script> makes wpa_cli run as a daemon, and it automatically executes the script with interface name and CONNECTED or DISCONNECTED whenever wpa_supllicant connects or disconnects.
This can be used to run a dhcp client at the right time:
Code:
#!/bin/sh
case $2 in
CONNECTED)
udhcpc -i $1 -h `hostname`
;;
DISCONNECTED)
;;
*)
;;
esac


Some extensions:
Add a "manual terminate" feature
Run the DHCP client in the foreground, then cleanup the PID file on exit.
Kill the DHCP client on disconnect (may make flakey connections worse?)
rescan/reassociate on disconnect (likewise?)
Bring up VPN connection.

And a partial implementation:
Code:
#!/bin/sh
export PIDFILE=/var/run/udhcpc/${1}.pid
dhcp_lease()(
[ -e $PIDFILE ] && ( kill `cat $PIDFILE` ; rm $PIDFILE ; )
udhcpc -i $1 -h `hostname` -p $PIDFILE
rm $PIDFILE
)
case $2 in
CONNECTED)
dhcp_lease $1 &
;;
DISCONNECTED)
#kill `cat $PIDFILE`
wpa_cli -i $1  scan
;;
stop)
wpa_cli -i $1 disconnect
wpa_cli -i $1 terminate
;;
*)
echo "Use this script as a wpa_cli action script or $0 iface1 stop to leave iface1 ready for manual configuration"
;;
esac
Back to top
View user's profile Send_private_message 
JamesTheAwesomeDude


Joined: 29 Jan 2013
Posts: 99
Location: Classified

PostPosted: Sat 23 Feb 2013, 03:53    Post_subject:    

Okay, I can't figure out what to do:

Wi-Fi adapter, wlan0
Connecting to wireless router with WPA2 encryption
Using the carl9170usb driver
Static (custom) local IP
Custom DNS settings

What do I need to type? The stupid carl9170 driver is really crashy, and I hate having to make 40 clicks every 5 minutes to repair the internet, so I'm just gonna stick a script on the desktop labeled "Kick the Wi-Fi adapter" or something like that, that will auto-reconnect everything.

_________________
Version 27. Dotpet. Click here.
(SFS available too!)

Back to top
View user's profile Send_private_message 
Ibidem

Joined: 25 May 2010
Posts: 501
Location: State of Jefferson

PostPosted: Tue 26 Feb 2013, 00:32    Post_subject:  

JamesTheAwesomeDude wrote:
Okay, I can't figure out what to do:

Wi-Fi adapter, wlan0
Connecting to wireless router with WPA2 encryption
Using the carl9170usb driver
Static (custom) local IP
Custom DNS settings

What do I need to type? The stupid carl9170 driver is really crashy, and I hate having to make 40 clicks every 5 minutes to repair the internet, so I'm just gonna stick a script on the desktop labeled "Kick the Wi-Fi adapter" or something like that, that will auto-reconnect everything.

Something like this (UNTESTED! CAUTION! YOU PROBABLY WILL NEED TO DEBUG AND CHANGE THIS!):
Code:
#!/bin/sh
IF=wlan0
#You probably want to change these.
IP=10.0.0.100
GW=0.0.0.0
#DNS: saved in /etc/resolv.conf, which should be static.

#modalias is a not-really-readable hw-specific ID that identifies one module.
read MOD </sys/class/net/${IF}/../../modalias
export MOD IF IP
start(){
wpa_supplicant -Dwext -B -c /etc/wpa.conf -i $IF
#I'm guessing the IP needs to be set after the interface is up.
#Really, this should be called via an action script, instead of dhcp
sleep 5
ifconfig $IF $IP
route add default gw $GW dev $IF
}
reload(){
wpa_cli -i $IF terminate
ifconfig $IF down
#Disable hardware encryption. Known to be desirable for AR9170 chips:
# http://linuxwireless.org/en/users/Drivers/carl9170
modprobe -r $MOD && modprobe $MOD nohwcrypt=1
}
reload && start

This assumes that the WPA config is in /etc/wpa.conf (probably not true for you!)
Back to top
View user's profile Send_private_message 
edwin.evans

Joined: 15 Nov 2012
Posts: 60

PostPosted: Wed 06 Mar 2013, 13:02    Post_subject: Problem getting wifi module to load  

tempestuous wrote:
I urge all newcomers only to resort to ndiswrapper as a last resort! The success rate of ndiswrapper is low, and you will generally get a more reliable wifi connection by using a true Linux driver.


I'm trying to start my WiFi adapter and then config it, all using scripts. I have the iwconfig/ifconfig all working but it seems I need to run modprobe also. Currently the only way I know how to get my adapter to start blinking is to run rc.network but that does a lot of stuff that I don't want to do.

I'm using ndiswrapper when I load it in the Wizard and I think it is using a realtek driver. The module I'm using is http://www.amazon.com/gp/product/B003MTTJOY.

Any suggestion?

Thanks!
Back to top
View user's profile Send_private_message 
Semme

Joined: 07 Aug 2011
Posts: 3972
Location: World_Hub

PostPosted: Wed 06 Mar 2013, 13:10    Post_subject:  

Does iwconfig list an interface?
Back to top
View user's profile Send_private_message 
edwin.evans

Joined: 15 Nov 2012
Posts: 60

PostPosted: Wed 06 Mar 2013, 13:30    Post_subject:  

Semme wrote:
Does iwconfig list an interface?


I think only if I run rc.network. I'm rebooting now to check for sure.
Back to top
View user's profile Send_private_message 
edwin.evans

Joined: 15 Nov 2012
Posts: 60

PostPosted: Wed 06 Mar 2013, 13:42    Post_subject:  

edwin.evans wrote:
Semme wrote:
Does iwconfig list an interface?


I think only if I run rc.network. I'm rebooting now to check for sure.


If I run iwconfig, it doesn't list any wireless interface. Just lo and eth0. And the light on my adapter is not blinking. If I run rc.network at this point then the light starts blinking soon after the script starts.
Back to top
View user's profile Send_private_message 
edwin.evans

Joined: 15 Nov 2012
Posts: 60

PostPosted: Wed 06 Mar 2013, 16:10    Post_subject:  

edwin.evans wrote:
edwin.evans wrote:
Semme wrote:
Does iwconfig list an interface?


I think only if I run rc.network. I'm rebooting now to check for sure.


If I run iwconfig, it doesn't list any wireless interface. Just lo and eth0. And the light on my adapter is not blinking. If I run rc.network at this point then the light starts blinking soon after the script starts.


OK, it seems I just need to run "modprobe ndiswrapper".

But when I try this in my script in /etc/init.d it doesn't work. It only works if it call it manually after bootup. Is there something else I need to do first or wait for? Thanks!
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 11 of 13 Posts_count   Goto page: Previous 1, 2, 3, ..., 9, 10, 11, 12, 13 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1156s ][ Queries: 13 (0.0074s) ][ GZIP on ]