Just a followup as I've got things working.
I'm gonna assume that everyone has their drivers installed and configured
put this in a script
Code:
/sbin/iwconfig ath0 channel 1
/sbin/iwconfig ath0 rate 11M
/sbin/iwconfig ath0 essid youressid
/sbin/iwconfig ath0 key 1234567890
/sbin/ifconfig ath0 1.1.1.117 #<comment this out if you are using dhcp>
/sbin/route add default ath0
/sbin/route add default gw 1.1.1.1 #<comment this out if you are using dhcp
/sbin/ifconfig ath0 down
sleep 2 # for some reason you need a little delay for changes to be updated
/sbin/ifconfig ath0 up
/sbin/dhcpcd ath0 # of course if you're not using dhcp comment this out
It generally seems that you need to manually specify the rate and channel for ad-hoc networks to negotiate reliably.
You all may notice that I've left of specifying '/sbin/iwconfig ath0 mode ad-hoc'
The reason being for madwifi drivers you have to create the card for the operation type BEFORE doing the above commands eg I've made the following script ng-adhoc.sh
Code:
wlanconfig ath0 create wlandev wifi0 wlanmode adhoc
/sbin/ifconfig ath0 up
iwconfig ath0 mode ad-hoc
as opposed to 'wlanconfig ath0 create wlandev wifi0 wlanmode sta' for a infrastructure mode.
People using ndiswrapper will
1-replace 'ath0' with 'wlan0' <this should be obvious>
2-place '/sbin/iwconfig wlan0 mode ad-hoc' BEFORE you set the channel
Good Luck, hope this helps