Friday, February 12, 2010

archlinux wireless example

#!/bin/bash
## wpa2conn.sh
## @author legolas558
## automatic connection script
sudo pkill ^wpa_supplicant$
if [[ "$1" == "0" ]]; then
exit
fi
APADDR=XX:XX:XX:XX:XX:XX
ESSID=your_essid
PLAINPWD="yourplainpwd"
IPV4=192.168.1.20
IPV4GW=192.168.1.1
sudo iwconfig eth1 ap $APADDR && \
sudo iwconfig eth1 essid "$ESSID" && \
sudo iwconfig eth1 key s:$PLAINPWD && \
sudo ifconfig eth1 $IPV4 && \
sudo ifconfig eth1 up && \
sudo route add default gw $IPV4GW dev eth1 && \
sudo wpa_supplicant -B -c /etc/wpa_supplicant.conf -ieth1 -Dwext -f /var/log/wpa_supplicant.log

No comments: