xxbeanxx Posted February 11, 2005 Report Share Posted February 11, 2005 Hey guys.. I just managed to get on my wireless network with wpa_supplicant.. I would like to know how to do the following commands automatically when I do an "ifup ath0" 1) wpa_supplicant -Bwi ath0 -c /etc/wpa_supplicant.conf -D madwifi 2) /sbin/dhclient -1 -q -lf /var/lib/dhcp/dhclient-ath0.leases-pf /var/run/dhclient-ath0.pid -cf /etc/dhcli The dhcp thing already gets called, but it won't work unless I do the wpa_supplicant first. My question is this: can I add anything to ifcfg-ath0 or somewhere similar that will do the wpa_supplicant command before the dhcp command? I noticed a directory in /etc/sysconfig/network-scripts called ifup.d and ifdown.d .. Perhaps I can stick something in there....but I don't know the format of the files to go in there. I *can* run the wpa_supplicant by hand, but where's the fun in that? I'd like it all to be automated so I can just type "set-netprofile Wireless" and have my wireless working. Thanks for any help. Quote Link to comment Share on other sites More sharing options...
coverup Posted February 16, 2005 Report Share Posted February 16, 2005 1. Put this line in /etc/sysconfig/network-scripts/ifcfg-ath1 or whatever device you are using - the locations of the files may be different, you'll need to figure out: WPA=y 2, Add at the end of /etc/sysconfig/network-scripts/ifup.wireless if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then /usr/local/bin/wpa_supplicant -Bw -c/etc/wpa_supplicant.conf -i$DEVICE fi 3. Create /etc/sysconfig/network-scripts/ifdown-wireless, and put in it #!/bin/bash killall wpa_supplicant That should o the trick Quote Link to comment Share on other sites More sharing options...
xxbeanxx Posted February 17, 2005 Author Report Share Posted February 17, 2005 (edited) Worked like a charm.. Thanks a lot!! This is awesome! EDIT:: actually, the ifup command does start wpa_supplicant.. But the ifdown doesn't stop it.. (I chmod'd to execute).. Also, when I switch profiles, (ie: set-netprofile Wireless) it doesn't work. :( Looking at the set-netprofile script, it does a network restart... Looking at /etc/init.d/network, it does run ifup ath0.. But it doesn't start.. :( Oh well, I'll keep picking at it.. Thanks again.. Edited February 17, 2005 by xxbeanxx Quote Link to comment Share on other sites More sharing options...
coverup Posted February 18, 2005 Report Share Posted February 18, 2005 Sorry, mate. Forgot to tell you that the ifdown script needs to be modified as well. Locate these lines DEVICETYPE=`echo $DEVICE | sed "s/[0-9]*$//"` [ -z "$REALDEVICE" ] && REALDEVICE=`echo ${DEVICE} | sed 's/:.*//g'` and add below them these lines # is the device wireless? is_wireless_device ${DEVICE} && . ./ifdown-wireless Edit: set-netprofile copies net scripts here and there before actually running them. That is, if you switch from profile A to profile B, first all files from /etc/sysconfig/network-scripts/ will be copied to /etc/netprofile/profiles/A/files/etc/sysconfig/network-scripts/, then all files from /etc/netprofile/profiles/B/files/etc/sysconfig/network-scripts/ will be copied to /etc/sysconfig/network-scripts/, then network will be restarted. So, the first thing to check is whether the dir for profile Wireless contains correct scripts. Secondly, whether they have been copied into /etc/sysconfig/network-scripts/ I think, MCC (MDK9.2) has a bug (or is it a feature?) in setting netprofiles. If I hit OK, it screws up network settings for one of the profiles. So usually, when I switch profiles, I wait untill MCC finishes its business, and then close MCC without hitting OK. Alternatively, you can run set-netprofile as root from the console (in MDK this may work differently then in MDK9.2 though), or boot into profile of your choice from lilo, these methods work fine for me. Quote Link to comment Share on other sites More sharing options...
coverup Posted February 18, 2005 Report Share Posted February 18, 2005 What AP do you use by the way? I had trouble getting my wireless working with SSID broadcast disabled - tried dlink 624+ and netgear WGT624 (I think), the latter was a nightmare... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.