Date: Wed, 13 Apr 2005 13:48:37 +0800 From: FreeBSD Daemon <free.bsd@gmx.net> To: freebsd-questions@freebsd.org Cc: Ben Pratt <ben@thegeekzone.com> Subject: Re: Can't change MAC address of my WAG311 Message-ID: <425CB2B5.5090402@gmx.net> In-Reply-To: <425C0AE7.8090701@thegeekzone.com> References: <425BFC0C.9040508@gmx.net> <425C0AE7.8090701@thegeekzone.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Ben Pratt wrote: > I would forward this to the list but I don't want to get the bounces > for 3 days because I can't get reverse lookup going. > > I've attached a script that you should try. > > Ben > > FreeBSD Daemon wrote: > >> dear list, >> >> I am operating a Netgear WAG311 (Atheros AR5212) under FBSD 5.3 Release. >> >> I tried to change the MAC address of the device using >> >> root# ifconfig ath0 ether aa:bb:cc:dd:ee:ff >> >> which changed the MAC address in the ifconfig ath0 output. But >> wicontrol -i ath0 still showed the old (original) MAC address and >> that MAC address also is being used on the network. >> >> Trying to change the MAC address using >> >> root# wicontrol -i ath0 -m aa:bb:cc:dd:ee:ff >> >> results in a >> >> wicontrol: SIOCSWAVELAN: Invalid Argument >> >> error message. >> >> Am I doing something wrong? >> >> TIA >> >> zheyu >> _______________________________________________ >> freebsd-questions@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >> To unsubscribe, send any mail to >> "freebsd-questions-unsubscribe@freebsd.org" > >------------------------------------------------------------------------ > >#!/usr/local/bin/bash ># Version 2.1 ># By Ben > ># Thanks to Venom for suggesting Apple and joining FreeBSD and Linux > >echo "What interface? [ath0]" >read interface > >if [ "$interface" = "" ] >then > interface="ath0" >fi > >company=0 > >until [ "$company" -eq 1 -o "$company" -eq 2 -o "$company" -eq 3 -o "$company" -eq 4 -o "$company" -eq 5 -o "$company" -eq 6 ]; do > echo "Card Company to impersonate?" > echo " 1) 3Com" > echo " 2) Apple" > echo " 3) D-Link" > echo " 4) Intel" > echo " 5) Linksys" > echo " 6) Netgear" > read company >done > >front="" >back="" >new="" > >case "$company" in >'1') > # Random 3Com Card > number=0 > while [ "$number" -le 0 ] > do > number=$RANDOM > let "number %= 14" > done > echo "Number: $number" > > case "$number" in > '1') > front="00:01:02:" > ;; > '2') > front="00:01:03:" > ;; > '3') > front="00:10:4B:" > ;; > '4') > front="00:10:5A:" > ;; > '5') > front="00:20:AF:" > ;; > '6') > front="00:50:04:" > ;; > '7') > front="00:50:DA:" > ;; > '8') > front="00:60:08:" > ;; > '9') > front="00:60:8C:" > ;; > '10') > front="00:60:97:" > ;; > '11') > front="00:A0:24:" > ;; > '12') > front="02:60:8C:" > ;; > '13') > front="02:C0:8C:" > ;; > * ) > echo "Error" > exit 0 > ;; > esac > ;; >'2') > # Random Apple Card > number=0 > while [ "$number" -le 0 ] > do > number=$RANDOM > let "number %= 6" > done > echo "Number: $number" > > case "$number" in > '1') > front="00:05:02:" > ;; > '2') > front="00:30:65:" > ;; > '3') > front="00:50:E4:" > ;; > '4') > front="00:A0:40:" > ;; > '5') > front="08:00:07:" > ;; > * ) > echo "Error" > exit 0 > ;; > esac > ;; >'3') > # Random D-Link Card > front="00:05:5D:" > ;; >'4') > # Random Intel Card > number=0 > while [ "$number" -le 0 ] > do > number=$RANDOM > let "number %= 9" > done > echo "Number: $number" > > case "$number" in > '1') > front="00:02:B3:" > ;; > '2') > front="00:03:47:" > ;; > '3') > front="00:04:23:" > ;; > '4') > front="00:07:E9:" > ;; > '5') > front="00:0C:F1:" > ;; > '6') > front="00:0E:0C:" > ;; > '7') > front="00:11:11:" > ;; > '8') > front="00:20:7B:" > ;; > * ) > echo "Error" > exit 0 > ;; > esac > ;; >'5') > # Random Linksys Card > number=0 > while [ "$number" -le 0 ] > do > number=$RANDOM > let "number %= 4" > done > echo "Number: $number" > > case "$number" in > '1') > front="00:04:5A:" > ;; > '2') > front="00:06:25:" > ;; > '3') > front="00:0C:41:" > ;; > * ) > echo "Error" > exit 0 > ;; > esac > ;; >'6') > # Random Netgear Card > front="00:09:5B:" > ;; >'7') > # Random Card > ;; >esac > >count=0 >colon=0 >colons=1 > >while [ "$count" -lt 6 ] >do > >Numbers="0 >1 >2 >3 >4 >5 >6 >7 >8 >9 >A >B >C >D >E >F" > ># Read into array variable. >number=($Numbers) > ># Count how many elements. >num_numbers=${#number[*]} > >new="${number[$((RANDOM%num_numbers))]}" > >back=$back$new > >if [ $colon -gt 0 ] && [ $colons -lt 3 ] >then > new=":" > back=$back$new > let "colon-=1" > let "colons+=1" >else > let "colon+=1" >fi > >let "count+=1" > >done > >address="$front$back" > >OS=0 > >until [ "$OS" -eq 1 -o "$OS" -eq 2 ]; do > echo "What OS??" > echo " 1) FreeBSD" > echo " 2) Linux" > read OS >done > >case "$OS" in >'1') > ifconfig $interface down > ifconfig $interface link $address > ifconfig $interface up > ;; >'2') > ifconfig $interface down > ifconfig $interface ether $address > ifconfig $interface up > ;; >* ) > exit 0 > ;; >esac > >echo "Your new MAC is: $address" > >exit 0 > > Well, thanks for the script, BUT as I wrote ifconfig is "working". The misunderstanding was probably cause by me not explicitly pointing out that "aa:bb:cc:dd:ee:ff" stands for a real MAC (00:01:f4:xx:yy:zz) and is not to be taken literally. SORRY! Again, ifconfig is "working" and the MAC changes in the ifconfig output ... athough the card doesn't honour the change and keeps on using the old (original) MAC. wicontrol dosn't even hounour the change in its output and keeps displaying the Old (original) MAC. And trying to change the MAC using wicontrol results in the error "wicontrol: SIOCSWAVELAN: Invalid Argument". zheyu
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?425CB2B5.5090402>