[Q] Corrupted WiFi Mac Address - Android Q&A, Help & Troubleshooting

I have a Nexus 5 which was running 5.1 . I wanted to change my mac address and did some research and it seemed that it was very difficult on 5.1 so I downgraded to 4.4, rooted the device and ran these groups of commands (11:22:33:44:55:66 wasn't actually used, I used the actual IP address I was trying to replicate):
busybox ifconfig wlan0 hw ether 11:22:33:44:55:66
ip link set wlan0 address 11:22:33:44:55:66
ip link set wlan0 broadcast 11:22:33:44:55:66
echo -n "112233445566" > /persist/wifi/.macaddr
After all this stuff, my mac address changed, but kept changing on its own whenever I reboot the phone; 00:90:4C:XX:XX:XX the first 3 sets always the same with the last 3 sets always changing. I tried this to fix the problem and get my mac address to it's original state.
echo -ne '\x11\x22\x33\x44\x55\x66' > /persist/wifi/.macaddr
chown root:root /persist/wifi
chmod 755 /persist/wifi
chown wifi:wifi /persist/wifi/.macaddr
chmod 660 /persist/wifi/.macaddr
While that seemed to have fixed the problem, as soon as I upgraded back to 5.1, the bad mac address started appearing again. I've factory reset and flashed stock firmware several times without success.

BUMP
I have had this issue posted for two weeks now and not a single response. Is there an alternate forum that anyone can even recommend? Thanks

Related

Stealthy free USB Tether technique using IPTABLES

Ok, let me start by saying this Photon has a LOT of potential... Anyways, a little tinkering and hacking and I noticed a few interesting little tidbits.
First, the easy to use Phone Portal feature look rather interesting. Pretty interesting how we can just automagically surf a web page put out by the phone... Oh wait, that would require DHCP and a USBnet Modem wouldn't it?
Kinda. It does use a Motorola Network driver to mimick something similar to the linux usbnet drivers. So as long as you have your Motorola drivers installed on the PC, it'll still launch this portal.
Now I already knew that iptables was installed. So the question now is can this interface be NAT'ed to allow internet access through the phone without installing any software?
The answer, yes.
First root the phone and then when you're logged in you'll want to do the following:
Code:
mount -o remount,rw /dev/block/mmcblk0p12 /system
echo 1 > /proc/sys/net/ipv4/ip_forward [I]#Temporarily allow packet forwarding[/I]
[I]# Permanently allow packet forwarding[/I]
vi /etc/sysctl.conf
[I]# uncomment the line #net.ipv4.ip_forward=1[/I]
vi /etc/rc.local
[I]# Add the following lines after the line that reads iptables -A OUTPUT -p tcp --dport 8085 -d localhost -m owner ! --uid-owner adas -j REJECT[/I]
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -A FORWARD -i ppp0 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i usb0 -o ppp0 -j ACCEPT
mount -o remount,ro /dev/block/mmcblk0p12 /system
Note: You may need to set the default route of 192.168.16.2 on your computer. You'll also want to set your DNS servers to 4.4.4.4 and 8.8.8.8 (Google) so that you can do DNS queries.
DHCP config coming soon once I figure it out.
Once this modification is done, all you need to do is have your phone in the Motorola Phone Portal Mode and plug it into your computer. Your computer will automatically recognize the network connection, utilize DHCP, and establish an internet connection.
Hoozah, USB tethering with no apps, no fuss, and ... no $30 a month.
Good post, now I wonder if we can get this working with Ubuntu. I don't have the ability to try yet. But I may later tonight.
Thanks for the heads up.
These are shell commands, its not as simple as you'd think to build an aol to do this. And I would guess it only has to be done once unless the phone resets this stuff on reboot...
Sent from my MB855 using xda premium
Yep, only needs to be done once. That's why I put the "temporarily changes" and the "permanently changes" in there.
A note though, local.rc does get updated during patches, so if you take an OTA upgrade, you'll need to redo these steps to get it working again. No more or less so than you would if you needed to recover root.
One of the reasons I posted this here... that way it's documented and if I forget in the future, I can search this site to learn how it's done again.
khawk said:
Ok, let me start by saying this Photon has a LOT of potential... Anyways, a little tinkering and hacking and I noticed a few interesting little tidbits.
First, the easy to use Phone Portal feature look rather interesting. Pretty interesting how we can just automagically surf a web page put out by the phone... Oh wait, that would require DHCP and a USBnet Modem wouldn't it?
Kinda. It does use a Motorola Network driver to mimick something similar to the linux usbnet drivers. So as long as you have your Motorola drivers installed on the PC, it'll still launch this portal.
Now I already knew that iptables was installed. So the question now is can this interface be NAT'ed to allow internet access through the phone without installing any software?
The answer, yes.
First root the phone and then when you're logged in you'll want to do the following:
Code:
mount -o remount,rw /dev/block/mmcblk0p12 /system
echo 1 > /proc/sys/net/ipv4/ip_forward [I]#Temporarily allow packet forwarding[/I]
[I]# Permanently allow packet forwarding[/I]
vi /etc/sysctl.conf
[I]# uncomment the line #net.ipv4.ip_forward=1[/I]
vi /etc/rc.local
[I]# Add the following lines after the line that reads iptables -A OUTPUT -p tcp --dport 8085 -d localhost -m owner ! --uid-owner adas -j REJECT[/I]
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -A FORWARD -i ppp0 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i usb0 -o ppp0 -j ACCEPT
mount -o remount,ro /dev/block/mmcblk0p12 /system
Note: You may need to set the default route of 192.168.16.2 on your computer.
Once this modification is done, all you need to do is have your phone in the Motorola Phone Portal Mode and plug it into your computer. Your computer will automatically recognize the network connection, utilize DHCP, and establish an internet connection.
Hoozah, USB tethering with no apps, no fuss, and ... no $30 a month.
Click to expand...
Click to collapse
Hi,
I tried everything you've said and can't seem to get an internet connection via tether. First of all, what exactly do you mean, "Note: You may need to set the default route of 192.168.16.2 on your computer"? Do you mean in the IPv4 settings for the Motorola USB Modem on the laptop, to set the Default Gateway and DNS to 192.168.16.2? If so, I've tried this, and still can't see to get an internet connection.
What happens is it tries to load a page, then comes back with an error that it cannot resolve a DNS. Has anyone else had success with this? I'm pretty sure I've edited the files exactly as he's suggested here...
BallCity said:
Hi,
I tried everything you've said and can't seem to get an internet connection via tether. First of all, what exactly do you mean, "Note: You may need to set the default route of 192.168.16.2 on your computer"? Do you mean in the IPv4 settings for the Motorola USB Modem on the laptop, to set the Default Gateway and DNS to 192.168.16.2? If so, I've tried this, and still can't see to get an internet connection.
What happens is it tries to load a page, then comes back with an error that it cannot resolve a DNS. Has anyone else had success with this? I'm pretty sure I've edited the files exactly as he's suggested here...
Click to expand...
Click to collapse
I revised the original post to include DNS config. Opps, overlooked that one.
Can you please specifically show which settings to change in Windows 7 to change the default route and DNS servers? I THINK I've changed the settings in the correct place but my computer does not get an internet connection.
gollyzila said:
Can you please specifically show which settings to change in Windows 7 to change the default route and DNS servers? I THINK I've changed the settings in the correct place but my computer does not get an internet connection.
Click to expand...
Click to collapse
Something as follows:
* Put the phone into Motorola Phone Portal mode [After making the edits outlined above]
* Goto: Control Panel\Network and Internet\Network Connections
* Right-Click and Click Properties on Motorola USB Networking Driver (With a name something like Local Area Connection ##)
* Click on "Internet Protocol Version 4 (TCP/IPv4) and then click the 'Properties' Button
* Set it up to look like this:
h_ttp://i.imgur.com/8w1S0.png
[Won't let me post outside links, so you can figure out how to make that work.]
All done!
I've gotten it working now. I think the issue I had before was with the edits I made. Initially I tried editing the files using Root Explorer's built-in text editor. Since then I've just used ADB to pull them to my computer to edit, then push the edited files over to the SD card via ADB, then moved them to the /etc/ folder with Root Explorer.
Hope that helps someone... But to confirm, I've gotten it working using those edits that the OP had posted, and used the IPv4 settings posted above.
No comment yet on speed or anything. It does appear as though 4G stays connected, though.
Can anyone confirm this still works with the 2.3.4-4.5.1A-1_SUN-198_6-CM SBF? Windows 7 sees the connection but there is no internet access. Are the mount commands required or can I just make the edits to the files (root explorer) and reboot the phone?
Mahna Mahna said:
Can anyone confirm this still works with the 2.3.4-4.5.1A-1_SUN-198_6-CM SBF? Windows 7 sees the connection but there is no internet access. Are the mount commands required or can I just make the edits to the files (root explorer) and reboot the phone?
Click to expand...
Click to collapse
It doesn't seem to work for me on this update, either. Same issue, W7 sees the connection but I also don't get internet access. Using Google's DNS as well. I'm not sure what changed... Anyone else try this and/or know of a fix?
BallCity said:
It doesn't seem to work for me on this update, either. Same issue, W7 sees the connection but I also don't get internet access. Using Google's DNS as well. I'm not sure what changed... Anyone else try this and/or know of a fix?
Click to expand...
Click to collapse
Seems that they did something in the firmware to disable the packet forwarding. I haven't had a lot of time to check this more closely. Would be interesting to see what the differences in the kernel config are between this build and the previous one.

Reverse Tether

I currently run Paranoid Android on my SG5, which works well enough for my tastes. One thing I've wanted to play with is reverse tethering. Since I charge my player via the computer's usb connection, I figured it'd make sense to disable wifi and save a little power to speed up the slow usb charging and just use the pc's internet connection via usb. I also have a few apps like calibre and the compantion app which don't work correctly when I'm on a wifi connection that's been firewalled to prevent devices from communicating with each other. This bypasses the wifi connection and gives me a nice secure connection between devices.
I got it working ... mostly. I don't expect many people to find this useful, but I thought it might be an entertaining hack to poke at.
The following script sits on my linux netbooks' ~/bin directory as reverse-tether.sh
Code:
#!/bin/sh
# We need root on the host to mess with networking
if [[ $(whoami) != "root" ]]; then
echo "You must be root to run this script!"
exit 1
fi;
# We need root on the Player to mess with networking
echo 'Enabling adb root access...'
adb -d root
# Turn on usb networking
echo 'Enabling usb network interface on the Galaxy Player...'
adb -d shell 'sh /storage/sdcard0/reverse_tether.sh up &'
# adb disconnects, so we wait for the network on the player to settle before continuing on.
sleep 2
# Rename device interface as ArchLinux has annoying device names (becomes player)
IF=`ifconfig -a | grep "enp" | cut -d ':' -f 1`
ip link set dev $IF down
/usr/sbin/ifrename -i $IF -n player
ip link set dev player up
echo 'Setting Computer IP Address ...'
ifconfig player 192.168.200.1 netmask 255.255.255.0
ifconfig player up
echo 'Enabling NAT and IP Forwarding on Computer...'
# Start forwarding and nat (use existing default gw)
iptables -F -t nat
iptables -A POSTROUTING -t nat -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 'Starting dnsmasq on Computer...'
dnsmasq --interface=player --no-dhcp-interface=player
echo
echo 'Connection is ready! Press any key to shutdown.'
echo
read
echo 'Shutting down reverse tethering'
# SSH server is always running on player, with public rsa key imported for passwordless logins
# This hackery is required as adb seems to be disabled with rndis active.
# I use dropbear server II, but any of the ssh servers would probably work.
ssh [email protected] 'sh /storage/sdcard0/reverse_tether.sh down &'
killall dnsmasq
ifconfig player down
iptables -F -t nat
echo 0 > /proc/sys/net/ipv4/ip_forward
And the following script is simply stashed on the sdcard of the player. as /storage/sdcard0/reverse_tether.sh
Code:
#!/system/bin/sh
if [ "$1" = "up" ]; then
echo 1 > /sys/class/usb_composite/rndis/enable
ip addr add 192.168.200.2/24 dev usb0
ip link set usb0 up
ip route delete default
ip route add default via 192.168.200.1
setprop net.dns1 192.168.200.1
fi
if [ "$1" = "down" ]; then
sleep 2
ip route delete default
ip link set usb0 down
echo 0 > /sys/class/usb_composite/rndis/enable
fi
When I finish, sometimes I need to restart wifi on the player to get networking to work again.
The only real problem I've had is that some apps require or want wifi/3g active in order to fully function. For example, the play store works fine until you try and download an actual update. Google Maps works fine, although you get lots of warnings about having wifi turned off. I have no idea how to "emulate" 3g or wifi which I think would solve that problem.
This was fun getting running. Hope you enjoyed...
I know this is an old thread but I found this really really useful. Going to give it a try after work today. Great job.
Sent from my YP-G70 using xda app-developers app

USB WiFi OTG - wpa_supplicant / android issue

Hello, I hope an advanced user can help me with this, I want to use my usb wireless card, so far I have successfully compiled the 3.0.36+ kernel modules for the card rt2800usb.ko + support modules and i can insmod them ..etc
insmod /system/lib/modules/rt2x00lib.ko
insmod /system/lib/modules/rt2x00usb.ko
insmod /system/lib/modules/rt2800lib.ko
insmod /system/lib/modules/rt2800usb.ko
Here is my issue
I made a copy of wpa_supplicant.conf in /data/misc/wifi/ to wlan1_supplicant.conf then run
/system/bin/wpa_supplicant -B -iwlan1 -c/data/misc/wifi/wlan1_supplicant.conf -dd &
(also tried rtl_supplicant, both seem to work the same)
then
dhcpcd wlan1
(made sure the internal wifi is offline)
it connects to my access point fine and I can browse the internet, youtube (videos), remote desktop apps work but the problem is I can't download any files with the web browsers (tried chrome, boat broswer, dolphin) or download off Google play it just says "waiting for network.", I'm guessing all these programs hook into download manger or something and perhaps that's the issue.
I'm thinking its a socket problem the default wpa_supplicant.conf has wlan0 as the ctrl_interface, in wlan1_supplicant.conf I changed it to /data/misc/wifi/sockets (as well as trying other things like wlan1 ..etc) I just cant figure this out for the life of me,
I am using android 4.2.2 , pipo s1 tablet
using ps aux on the default connection android runs the normal wireless like this...
4931 1010 0:00 /system/bin/rtl_supplicant -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf -e/data/misc/wifi/entropy.bin -N -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf
4941 1014 0:00 /system/bin/dhcpcd -ABKL -f /system/etc/dhcpcd/dhcpcd.conf -h android-<randomnumber> wlan0

[Q] MAC Changing in GT-S5302

I want to change the wifi mac address of my GT-S5302. I have tried many apps like Wireless Mac Address Changer but all failed.
Also tried:
Code:
busybox ifconfig //determine device usually eth0
busybox ifconfig eth0 down //shuts down eth0
busybox ifconfig eth0 hw ether 00:00:00:00:00:00 //sets eth0's mac to 00...
busybox ifconfig eth0 up //turn eth0 back on
busybox ifconfig //check to see if eth0 is set to new mac
After changing MAC when i execute "busybox ifconfig" the new mac is reflected but it is not letting me connect to my existing network. I have to restart wifi to get connected but it resets the mac address to the original one.
And also tried editing the ".nvmac.info" , "nvram.txt" ,"nvram_mfg.txt" but all in vain.
Can any one suggest me a working method to change WIFI MAC address for GT-S5302 ?
Thanx in advance :good:
Can anyone please tell me that why I'm disconnected from my existing network after executing these commands?
Code:
busybox ifconfig //determine device usually eth0
busybox ifconfig eth0 down //shuts down eth0
busybox ifconfig eth0 hw ether 00:00:00:00:00:00 //sets eth0's mac to 00...
busybox ifconfig eth0 up //turn eth0 back on
busybox ifconfig //check to see if eth0 is set to new mac

[Q]How to Change Mac address

i used kindle fire HDX 7 with Nexus 2.0.1
other Android device can change MAC address by
using ADB shell with busybox
# ifconfig eth0 |grep HWaddr
# ifconfig wlan0 down
# ifconfig wlan0 hw ether 00:10:11:AB:CD:EF (Which i want to change MAC)
# ifconfig wlan0 up
but i doesn't work. with' SIOCSIFHWADDR : Operation net supported'
and there are no way to change Mac address?

Categories

Resources