The past days i got a wireless adapter and setup an ad hoc network to be able to use some wireless devices. There’s still the matter of WEP vs WAP(2) thing but nevertheless with a good password you’re good to go in both cases. Also there’s the option to increase/decrease the signal strength so security is just a matter of usage.
Anyway, i made a small console script for WEP and a bit of configuration for WAP(wpa_supplicant) and :
# TODO: Option to set signal strength
echo "Create Ad-Hoc Network"
echo -n "Type prefered ESSID (e.g. My Network, Conan's home, etc): "
echo -n "Insert prefered Mode (e.g. ad-hoc, master, managed etc): "
echo -n "Channel (e.g.auto, 3, etc) : "
echo -n "Desired pass key : "
echo -n "IP Address : "
echo -n "Netmask : "
ifconfig $INTERFACE up
ifconfig $INTERFACE $IP_ADDRESS netmask $NETMASK
iwconfig $INTERFACE mode $MODE
iwconfig $INTERFACE essid $ESSID
iwconfig $INTERFACE channel $CHANNEL
echo "Setting up key passphrase.."
iwconfig $INTERFACE key $KEY
echo -n "Seems that all is good.."
echo -n "Press any key to continue..."
Yeah i know its very simple but it works for me 😛 If one of the steps fails you ll see an indication.
As for WPA i changed a bit my wpa_supplicant.conf to look like this:
# By default, only root (group 0) may use wpa_cli
# WPA protected network, supply your own ESSID and WPAPSK here:
group=CCMP TKIP #WEP104 WEP40
# Plaintext connection (no WPA, no IEEE 802.1X),
# nice for hotel/airport types of WiFi network.
and just issued the below (in a script)
ifconfig wlan0 down
ifconfig wlan0 up
iwconfig wlan0 essid "CONAN-DUDE" channel auto
iwconfig wlan0 mode ad-hoc
wpa_supplicant -D wext -iwlan0 -dd -Bw -c /etc/wpa_supplicant.conf
I have the intel 3945 wireless adapter so wext is the option for it.
For testing i run
iwlist wlan0 scan
I still have a masochistic preference for wired networks though ;p