Gentoo Archives: gentoo-user

From: Grant Edwards <grant.b.edwards@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: How to find the MAC address
Date: Fri, 20 Apr 2012 14:16:39
Message-Id: jmrqvm$i64$1@dough.gmane.org
In Reply to: Re: [gentoo-user] How to find the MAC address by Joost Roeleveld
1 On 2012-04-20, Joost Roeleveld <joost@××××××××.org> wrote:
2 > On Thursday, April 19, 2012 04:12:35 PM Michael Mol wrote:
3 >> On Thu, Apr 19, 2012 at 4:01 PM, Alex Schuster <wonko@×××××××××.org> wrote:
4 >> > Michael Mol writes:
5 >> >> On Thu, Apr 19, 2012 at 3:40 PM, Alex Schuster <wonko@×××××××××.org>
6 >> >>
7 >> >> wrote:
8 >> >> > New output:
9 >> >> > eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
10 >> >> > inet 192.168.2.42 netmask 255.255.255.0 broadcast
11 >> >> > 192.168.2.255 inet6 fe80::be5f:f4ff:fe19:ad18 prefixlen 64 scopeid
12 >> >> > 0x20<link>
13 >> >> >
14 >> >> > ether bc:5f:f4:19:ad:18 txqueuelen 1000 (Ethernet)
15 >> >>
16 >> >> There it is.
17 >> >
18 >> > Wow. Now I feel really stupid. Because I am. I have no idea why I have
19 >> > overlooked this.
20 >> >
21 >> > Sorry for the noise!
22 >>
23 >> I didn't see it right away, either. I found it by noticing your MAC in
24 >> your old output, and searched for a substring of it in your new
25 >> output.
26 >>
27 >> Incidentally, you can derive it from your IPv6 LL address, but that's
28 >> a bit of a roundabout way, and may not work if you've disabled IPv6.
29 >
30 > How do you derive it?
31 > I don't see the mac-address in the inet6 address.
32
33 $ ip addr show dev eth1
34 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
35 state UP qlen 1000
36 link/ether 00:16:17:84:a7:b3 brd ff:ff:ff:ff:ff:ff
37 inet 10.0.0.1/8 brd 10.255.255.255 scope global eth1
38 inet 192.168.250.1/24 brd 192.168.250.255 scope global eth1
39 inet 169.254.1.1/16 brd 169.254.255.255 scope global eth1
40 inet6 fe80::216:17ff:fe84:a7b3/64 scope link
41 valid_lft forever preferred_lft forever
42
43
44 fe80::0216:17ff:fe84:a7b3
45
46 0216 17 84 a7b3
47 xor 0200 00 00 0000
48 -------------------
49 0016 17 84 a7b3
50
51 00:16:17:84:a7:b3
52
53 And that's the interfaces MAC address.
54
55 See RFC2464 Sections 4 and 5
56
57 The tricky part is that you invert bit 1 of the first byte of the MAC
58 address.
59
60 --
61 Grant Edwards grant.b.edwards Yow! Someone in DAYTON,
62 at Ohio is selling USED
63 gmail.com CARPETS to a SERBO-CROATIAN