Gentoo Archives: gentoo-user

From: Kfir Lavi <lavi.kfir@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] How to find the MAC address
Date: Mon, 23 Apr 2012 12:52:58
Message-Id: CAHNvW1JKzw_YFgS9nLOzTaKKqdd+iA+Ykh8a4AQf6p7NGusjug@mail.gmail.com
In Reply to: [gentoo-user] How to find the MAC address by Alex Schuster
1 On Thu, Apr 19, 2012 at 10:40 PM, Alex Schuster <wonko@×××××××××.org> wrote:
2
3 > Hi there!
4 >
5 > How am I supposed to find the MAC address of an ethernet interface? I used
6 > to call ifconfig and grep for HWaddr, but this does not work any more.
7 >
8 > I found the 'old-output' USE flag for sys-apps/net-tools, which brings
9 > back the old behaviour in order not to break old scripts, but I'd like to
10 > know what the new method is that scripts should use.
11 >
12 > Here's how the output looked before and now:
13 >
14 > Old output:
15 > eth0 Link encap:Ethernet HWaddr bc:5f:f4:19:ad:18
16 > inet addr:192.168.2.42 Bcast:192.168.2.255 Mask:255.255.255.0
17 > inet6 addr: fe80::be5f:f4ff:fe19:ad18/64 Scope:Link
18 > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
19 > RX packets:11027476 errors:0 dropped:0 overruns:0 frame:0
20 > TX packets:8002728 errors:0 dropped:0 overruns:0 carrier:1
21 > collisions:0 txqueuelen:1000
22 > RX bytes:11763889583 (10.9 GiB) TX bytes:1006570663 (959.9 MiB)
23 > Interrupt:49
24 >
25 > New output:
26 > eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
27 > inet 192.168.2.42 netmask 255.255.255.0 broadcast 192.168.2.255
28 > inet6 fe80::be5f:f4ff:fe19:ad18 prefixlen 64 scopeid 0x20<link>
29 > ether bc:5f:f4:19:ad:18 txqueuelen 1000 (Ethernet)
30 > RX packets 10791981 bytes 11413935608 (10.6 GiB)
31 > RX errors 0 dropped 0 overruns 0 frame 0
32 > TX packets 7867427 bytes 996505563 (950.3 MiB)
33 > TX errors 0 dropped 0 overruns 0 carrier 1 collisions 0
34 > device interrupt 49
35 >
36 > Wonko
37 >
38 >
39 You can grab mac of eth0 with this command:
40 ip link show eth0 | grep 'link/ether' | awk '{print $2}'
41
42 Kfir