I have function for read MAC address in java:
for(Enumeration<NetworkInterface> enm = NetworkInterface.getNetworkInterfaces(); enm.hasMoreElements();){ NetworkInterface network = (NetworkInterface) enm.nextElement(); if(null != network.getHardwareAddress()){ System.out.print(network.getDisplayName()); byte[] mac = network.getHardwareAddress(); StringBuilder sb = new StringBuilder(18); for (byte b : mac) { if (sb.length() > 0) sb.append(':'); sb.append(String.format("%02x", b & 0xff)); } System.out.print(sb.toString()); return null; } }
This result: wlan0: 00:25:d3:9c:ad:7a But when I do: iwconfig, I reveive: 00:0D:F3:0D:DD:DC for wlan0
Question, why ?
EDIT: I am sorry for question, When I run ifconfig (not iwconfig) it responds:
wlan0 Link encap:Ethernet HWaddr 00:25:d3:9c:ad:7a
inet addr:192.168.50.100 Bcast:192.168.50.255 Mask:255.255.255.0 inet6 addr: fe80::225:d3ff:fe9c:ad7a/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2417546 errors:0 dropped:0 overruns:0 frame:0 TX packets:1608679 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3099222889 (3.0 GB) TX bytes:183978636 (183.9 MB)
So it's okay, thank you anyway.