See "PART 2: WPA encryption" on the first page of this threadSpaccafumo wrote:How to replace this wep-128 (ascii) command:
iwconfig eth0 key s:asciipassword
with a wpa2 analogous command?
http://www.murga-linux.com/puppy/viewto ... 336#159336
See "PART 2: WPA encryption" on the first page of this threadSpaccafumo wrote:How to replace this wep-128 (ascii) command:
iwconfig eth0 key s:asciipassword
with a wpa2 analogous command?
Code: Select all
#!/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
Code: Select all
...
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
...
Code: Select all
ifconfig wlan0 down
modprobe rtl8187
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!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.
Code: Select all
$ 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
Code: Select all
#!/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
Code: Select all
#!/bin/sh
case $2 in
CONNECTED)
udhcpc -i $1 -h `hostname`
;;
DISCONNECTED)
;;
*)
;;
esac
Code: Select all
#!/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
Something like this (UNTESTED! CAUTION! YOU PROBABLY WILL NEED TO DEBUG AND CHANGE THIS!):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.
Code: Select all
#!/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
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.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.
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.edwin.evans wrote:I think only if I run rc.network. I'm rebooting now to check for sure.Semme wrote:Does iwconfig list an interface?
OK, it seems I just need to run "modprobe ndiswrapper".edwin.evans wrote: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.edwin.evans wrote:I think only if I run rc.network. I'm rebooting now to check for sure.Semme wrote:Does iwconfig list an interface?
Hmm, couldn't manage to debug that ^, but I wrote this from scratch (many thanks to the Arch Linux Wiki):Ibidem wrote:Something like this (UNTESTED! CAUTION! YOU PROBABLY WILL NEED TO DEBUG AND CHANGE THIS!):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.This assumes that the WPA config is in /etc/wpa.conf (probably not true for you!)Code: Select all
#!/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
Code: Select all
#!/bin/sh
killall wpa_supplicant
rfkill unblock 0
modprobe carl9170
rm /run/wpa_supplicant/wlan0
ip link set wlan0 up
wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf
ip addr add 192.168.2.64/24 dev wlan0
ip route add default via 192.168.2.1
Code: Select all
wpa_passphrase "Your_Wifi_SSID" "v3ry_g00d_p@$$phr@$3" >> /etc/wpa_supplicant.conf
It's not necessary to go through the entire post. The complete instructions are in the 11th post on the first page of this thread - "PART 2: WPA encryption."der-schutzhund wrote:I vainly trying to configure a wireless connection.
Went through the entire post and tried a lot but it does not work!
Code: Select all
ifconfig wlan0 up
rm /var/run/wpa_supplicant/*
wpa_supplicant -i wlan0 -D wext -c /etc/network-wizard/wireless/wpa_profiles/wpa_supplicant2.conf -B
sleep 15
rm -f /var/lib/dhcpcd/*.info
rm -f /var/run/*.pid
dhcpcd -t 30 -h puppypc -d wlan0