public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] How to find the MAC address
@ 2012-04-19 19:40 Alex Schuster
  2012-04-19 19:45 ` Michael Mol
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Alex Schuster @ 2012-04-19 19:40 UTC (permalink / raw
  To: gentoo-user

Hi there!

How am I supposed to find the MAC address of an ethernet interface? I used
to call ifconfig and grep for HWaddr, but this does not work any more.

I found the 'old-output' USE flag for sys-apps/net-tools, which brings
back the old behaviour in order not to break old scripts, but I'd like to
know what the new method is that scripts should use.

Here's how the output looked before and now:

Old output:
eth0      Link encap:Ethernet  HWaddr bc:5f:f4:19:ad:18  
          inet addr:192.168.2.42  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::be5f:f4ff:fe19:ad18/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11027476 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8002728 errors:0 dropped:0 overruns:0 carrier:1
          collisions:0 txqueuelen:1000 
          RX bytes:11763889583 (10.9 GiB)  TX bytes:1006570663 (959.9 MiB)
          Interrupt:49 

New output:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.42  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::be5f:f4ff:fe19:ad18  prefixlen 64  scopeid 0x20<link>
        ether bc:5f:f4:19:ad:18  txqueuelen 1000  (Ethernet)
        RX packets 10791981  bytes 11413935608 (10.6 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7867427  bytes 996505563 (950.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 1  collisions 0
        device interrupt 49  

	Wonko



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-19 19:40 [gentoo-user] How to find the MAC address Alex Schuster
@ 2012-04-19 19:45 ` Michael Mol
  2012-04-19 20:01   ` Alex Schuster
  2012-04-19 19:48 ` [gentoo-user] " Michael Orlitzky
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 20+ messages in thread
From: Michael Mol @ 2012-04-19 19:45 UTC (permalink / raw
  To: gentoo-user

On Thu, Apr 19, 2012 at 3:40 PM, Alex Schuster <wonko@wonkology.org> wrote:
> Hi there!
>
> How am I supposed to find the MAC address of an ethernet interface? I used
> to call ifconfig and grep for HWaddr, but this does not work any more.
>
> I found the 'old-output' USE flag for sys-apps/net-tools, which brings
> back the old behaviour in order not to break old scripts, but I'd like to
> know what the new method is that scripts should use.
>
> Here's how the output looked before and now:
>
> Old output:
> eth0      Link encap:Ethernet  HWaddr bc:5f:f4:19:ad:18
>          inet addr:192.168.2.42  Bcast:192.168.2.255  Mask:255.255.255.0
>          inet6 addr: fe80::be5f:f4ff:fe19:ad18/64 Scope:Link
>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>          RX packets:11027476 errors:0 dropped:0 overruns:0 frame:0
>          TX packets:8002728 errors:0 dropped:0 overruns:0 carrier:1
>          collisions:0 txqueuelen:1000
>          RX bytes:11763889583 (10.9 GiB)  TX bytes:1006570663 (959.9 MiB)
>          Interrupt:49
>
> New output:
> eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>        inet 192.168.2.42  netmask 255.255.255.0  broadcast 192.168.2.255
>        inet6 fe80::be5f:f4ff:fe19:ad18  prefixlen 64  scopeid 0x20<link>

>        ether bc:5f:f4:19:ad:18  txqueuelen 1000  (Ethernet)

There it is.

>        RX packets 10791981  bytes 11413935608 (10.6 GiB)
>        RX errors 0  dropped 0  overruns 0  frame 0
>        TX packets 7867427  bytes 996505563 (950.3 MiB)
>        TX errors 0  dropped 0 overruns 0  carrier 1  collisions 0
>        device interrupt 49
>
>        Wonko
>



-- 
:wq



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-19 19:40 [gentoo-user] How to find the MAC address Alex Schuster
  2012-04-19 19:45 ` Michael Mol
@ 2012-04-19 19:48 ` Michael Orlitzky
  2012-04-19 19:56   ` Michael Mol
  2012-04-19 20:40   ` Alex Schuster
  2012-04-19 19:50 ` Neil Bothwick
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 20+ messages in thread
From: Michael Orlitzky @ 2012-04-19 19:48 UTC (permalink / raw
  To: gentoo-user

On 04/19/12 15:40, Alex Schuster wrote:
> Hi there!
> 
> How am I supposed to find the MAC address of an ethernet interface? I used
> to call ifconfig and grep for HWaddr, but this does not work any more.
> 
> I found the 'old-output' USE flag for sys-apps/net-tools, which brings
> back the old behaviour in order not to break old scripts, but I'd like to
> know what the new method is that scripts should use.

`ip link`

Learning a new command for something so fundamental was annoying, but
now I'm much happier.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-19 19:40 [gentoo-user] How to find the MAC address Alex Schuster
  2012-04-19 19:45 ` Michael Mol
  2012-04-19 19:48 ` [gentoo-user] " Michael Orlitzky
@ 2012-04-19 19:50 ` Neil Bothwick
  2012-04-19 20:14   ` Alex Schuster
  2012-04-20 15:22 ` [gentoo-user] " James
  2012-04-23 12:49 ` [gentoo-user] " Kfir Lavi
  4 siblings, 1 reply; 20+ messages in thread
From: Neil Bothwick @ 2012-04-19 19:50 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

On Thu, 19 Apr 2012 21:40:02 +0200, Alex Schuster wrote:

> How am I supposed to find the MAC address of an ethernet interface? I
> used to call ifconfig and grep for HWaddr, but this does not work any
> more.

> Here's how the output looked before and now:
> 
> Old output:
> eth0      Link encap:Ethernet  HWaddr bc:5f:f4:19:ad:18  
                                        ~~~~~~~~~~~~~~~~~

> New output:
> eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST mtu 1500
> ether bc:5f:f4:19:ad:18  txqueuelen 1000  (Ethernet)
        ~~~~~~~~~~~~~~~~~

here?


-- 
Neil Bothwick

"I need your clothes, your boots, and your tagline!"

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-19 19:48 ` [gentoo-user] " Michael Orlitzky
@ 2012-04-19 19:56   ` Michael Mol
  2012-04-19 23:29     ` Peter Humphrey
  2012-04-19 20:40   ` Alex Schuster
  1 sibling, 1 reply; 20+ messages in thread
From: Michael Mol @ 2012-04-19 19:56 UTC (permalink / raw
  To: gentoo-user

On Thu, Apr 19, 2012 at 3:48 PM, Michael Orlitzky <michael@orlitzky.com> wrote:
> On 04/19/12 15:40, Alex Schuster wrote:
>> Hi there!
>>
>> How am I supposed to find the MAC address of an ethernet interface? I used
>> to call ifconfig and grep for HWaddr, but this does not work any more.
>>
>> I found the 'old-output' USE flag for sys-apps/net-tools, which brings
>> back the old behaviour in order not to break old scripts, but I'd like to
>> know what the new method is that scripts should use.
>
> `ip link`
>
> Learning a new command for something so fundamental was annoying, but
> now I'm much happier.
>

I'll second this. The 'ip' command is far and away a nicer tool than
ifconfig, once you get a handle on it.

-- 
:wq



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-19 19:45 ` Michael Mol
@ 2012-04-19 20:01   ` Alex Schuster
  2012-04-19 20:12     ` Michael Mol
  0 siblings, 1 reply; 20+ messages in thread
From: Alex Schuster @ 2012-04-19 20:01 UTC (permalink / raw
  To: gentoo-user

Michael Mol writes:

> On Thu, Apr 19, 2012 at 3:40 PM, Alex Schuster <wonko@wonkology.org>
> wrote:

> > New output:
> > eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
> >        inet 192.168.2.42  netmask 255.255.255.0  broadcast
> > 192.168.2.255 inet6 fe80::be5f:f4ff:fe19:ad18  prefixlen 64  scopeid
> > 0x20<link>
> 
> >        ether bc:5f:f4:19:ad:18  txqueuelen 1000  (Ethernet)
> 
> There it is.

Wow. Now I feel really stupid. Because I am. I have no idea why I have
overlooked this.

Sorry for the noise!

	Wonko



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-19 20:01   ` Alex Schuster
@ 2012-04-19 20:12     ` Michael Mol
  2012-04-20 10:43       ` Joost Roeleveld
  0 siblings, 1 reply; 20+ messages in thread
From: Michael Mol @ 2012-04-19 20:12 UTC (permalink / raw
  To: gentoo-user

On Thu, Apr 19, 2012 at 4:01 PM, Alex Schuster <wonko@wonkology.org> wrote:
> Michael Mol writes:
>
>> On Thu, Apr 19, 2012 at 3:40 PM, Alex Schuster <wonko@wonkology.org>
>> wrote:
>
>> > New output:
>> > eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>> >        inet 192.168.2.42  netmask 255.255.255.0  broadcast
>> > 192.168.2.255 inet6 fe80::be5f:f4ff:fe19:ad18  prefixlen 64  scopeid
>> > 0x20<link>
>>
>> >        ether bc:5f:f4:19:ad:18  txqueuelen 1000  (Ethernet)
>>
>> There it is.
>
> Wow. Now I feel really stupid. Because I am. I have no idea why I have
> overlooked this.
>
> Sorry for the noise!

I didn't see it right away, either. I found it by noticing your MAC in
your old output, and searched for a substring of it in your new
output.

Incidentally, you can derive it from your IPv6 LL address, but that's
a bit of a roundabout way, and may not work if you've disabled IPv6.

-- 
:wq



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-19 19:50 ` Neil Bothwick
@ 2012-04-19 20:14   ` Alex Schuster
  0 siblings, 0 replies; 20+ messages in thread
From: Alex Schuster @ 2012-04-19 20:14 UTC (permalink / raw
  To: gentoo-user

Neil Bothwick writes:

> On Thu, 19 Apr 2012 21:40:02 +0200, Alex Schuster wrote:

> > eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST mtu 1500
> > ether bc:5f:f4:19:ad:18  txqueuelen 1000  (Ethernet)
>         ~~~~~~~~~~~~~~~~~
> 
> here?

Aaaaaaah!

	Wonko



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-19 19:48 ` [gentoo-user] " Michael Orlitzky
  2012-04-19 19:56   ` Michael Mol
@ 2012-04-19 20:40   ` Alex Schuster
  2012-04-19 21:04     ` Michael Orlitzky
  1 sibling, 1 reply; 20+ messages in thread
From: Alex Schuster @ 2012-04-19 20:40 UTC (permalink / raw
  To: gentoo-user

Michael Orlitzky writes:

> On 04/19/12 15:40, Alex Schuster wrote:
> > Hi there!
> > 
> > How am I supposed to find the MAC address of an ethernet interface? I
> > used to call ifconfig and grep for HWaddr, but this does not work any
> > more.
> > 
> > I found the 'old-output' USE flag for sys-apps/net-tools, which brings
> > back the old behaviour in order not to break old scripts, but I'd
> > like to know what the new method is that scripts should use.
> 
> `ip link`
> 
> Learning a new command for something so fundamental was annoying, but
> now I'm much happier.

Thanks, that's a nice one. But can I expect this command to be available
per default on typical Linux distributions? Some other systems I have
access to have it, but here on Gentoo it belongs to sys-apps/iproute2,
which depends on nothing I have installed, I do not even know why I
emerged it in the first place. So maybe I better use ifconfig which is
always available, although sometimes in /bin and sometimes in /sbin, and
I have to check the output to see which version it is.

	Wonko



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-19 20:40   ` Alex Schuster
@ 2012-04-19 21:04     ` Michael Orlitzky
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Orlitzky @ 2012-04-19 21:04 UTC (permalink / raw
  To: gentoo-user

On 04/19/12 16:40, Alex Schuster wrote:
> 
> Thanks, that's a nice one. But can I expect this command to be available
> per default on typical Linux distributions? Some other systems I have
> access to have it, but here on Gentoo it belongs to sys-apps/iproute2,
> which depends on nothing I have installed, I do not even know why I
> emerged it in the first place. So maybe I better use ifconfig which is
> always available, although sometimes in /bin and sometimes in /sbin, and
> I have to check the output to see which version it is.
> 

Gentoo prefers it over net-tools, and a few of the conf files mention
that, which explains how it could have wound up installed.

(Google says) iproute2 was introduced to replace net-tools around the
time of kernel-2.2, and (I says) they're needed to do anything remotely
complicated with the networking stack. So, they're probably pretty
standard these days.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-19 19:56   ` Michael Mol
@ 2012-04-19 23:29     ` Peter Humphrey
  2012-04-20 10:11       ` Alex Schuster
  0 siblings, 1 reply; 20+ messages in thread
From: Peter Humphrey @ 2012-04-19 23:29 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 190 bytes --]

On Thursday 19 April 2012 20:56:59 Michael Mol wrote:

> The 'ip' command is far and away a nicer tool than ifconfig, once you
> get a handle on it.

Which package is it in?

-- 
Rgds
Peter

[-- Attachment #2: Type: text/html, Size: 2127 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-19 23:29     ` Peter Humphrey
@ 2012-04-20 10:11       ` Alex Schuster
  2012-04-20 16:58         ` Peter Humphrey
  2012-04-23  1:47         ` Walter Dnes
  0 siblings, 2 replies; 20+ messages in thread
From: Alex Schuster @ 2012-04-20 10:11 UTC (permalink / raw
  To: gentoo-user

Peter Humphrey writes:

> On Thursday 19 April 2012 20:56:59 Michael Mol wrote:
> 
> > The 'ip' command is far and away a nicer tool than ifconfig, once you
> > get a handle on it.
> 
> Which package is it in?

sys-apps/iproute2

	Wonko



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-19 20:12     ` Michael Mol
@ 2012-04-20 10:43       ` Joost Roeleveld
  2012-04-20 14:14         ` [gentoo-user] " Grant Edwards
  0 siblings, 1 reply; 20+ messages in thread
From: Joost Roeleveld @ 2012-04-20 10:43 UTC (permalink / raw
  To: gentoo-user

On Thursday, April 19, 2012 04:12:35 PM Michael Mol wrote:
> On Thu, Apr 19, 2012 at 4:01 PM, Alex Schuster <wonko@wonkology.org> wrote:
> > Michael Mol writes:
> >> On Thu, Apr 19, 2012 at 3:40 PM, Alex Schuster <wonko@wonkology.org>
> >> 
> >> wrote:
> >> > New output:
> >> > eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
> >> >        inet 192.168.2.42  netmask 255.255.255.0  broadcast
> >> > 192.168.2.255 inet6 fe80::be5f:f4ff:fe19:ad18  prefixlen 64  scopeid
> >> > 0x20<link>
> >> > 
> >> >        ether bc:5f:f4:19:ad:18  txqueuelen 1000  (Ethernet)
> >> 
> >> There it is.
> > 
> > Wow. Now I feel really stupid. Because I am. I have no idea why I have
> > overlooked this.
> > 
> > Sorry for the noise!
> 
> I didn't see it right away, either. I found it by noticing your MAC in
> your old output, and searched for a substring of it in your new
> output.
> 
> Incidentally, you can derive it from your IPv6 LL address, but that's
> a bit of a roundabout way, and may not work if you've disabled IPv6.

How do you derive it?
I don't see the mac-address in the inet6 address.

--
Joost



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [gentoo-user] Re: How to find the MAC address
  2012-04-20 10:43       ` Joost Roeleveld
@ 2012-04-20 14:14         ` Grant Edwards
  0 siblings, 0 replies; 20+ messages in thread
From: Grant Edwards @ 2012-04-20 14:14 UTC (permalink / raw
  To: gentoo-user

On 2012-04-20, Joost Roeleveld <joost@antarean.org> wrote:
> On Thursday, April 19, 2012 04:12:35 PM Michael Mol wrote:
>> On Thu, Apr 19, 2012 at 4:01 PM, Alex Schuster <wonko@wonkology.org> wrote:
>> > Michael Mol writes:
>> >> On Thu, Apr 19, 2012 at 3:40 PM, Alex Schuster <wonko@wonkology.org>
>> >> 
>> >> wrote:
>> >> > New output:
>> >> > eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>> >> >        inet 192.168.2.42  netmask 255.255.255.0  broadcast
>> >> > 192.168.2.255 inet6 fe80::be5f:f4ff:fe19:ad18  prefixlen 64  scopeid
>> >> > 0x20<link>
>> >> > 
>> >> >        ether bc:5f:f4:19:ad:18  txqueuelen 1000  (Ethernet)
>> >> 
>> >> There it is.
>> > 
>> > Wow. Now I feel really stupid. Because I am. I have no idea why I have
>> > overlooked this.
>> > 
>> > Sorry for the noise!
>> 
>> I didn't see it right away, either. I found it by noticing your MAC in
>> your old output, and searched for a substring of it in your new
>> output.
>> 
>> Incidentally, you can derive it from your IPv6 LL address, but that's
>> a bit of a roundabout way, and may not work if you've disabled IPv6.
>
> How do you derive it?
> I don't see the mac-address in the inet6 address.

$ ip addr show dev eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000
    link/ether 00:16:17:84:a7:b3 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.1/8 brd 10.255.255.255 scope global eth1
    inet 192.168.250.1/24 brd 192.168.250.255 scope global eth1
    inet 169.254.1.1/16 brd 169.254.255.255 scope global eth1
    inet6 fe80::216:17ff:fe84:a7b3/64 scope link 
       valid_lft forever preferred_lft forever


fe80::0216:17ff:fe84:a7b3

      0216 17     84 a7b3
  xor 0200 00     00 0000      
      -------------------
      0016 17     84 a7b3
  
      00:16:17:84:a7:b3

And that's the interfaces MAC address.
      
See RFC2464 Sections 4 and 5

The tricky part is that you invert bit 1 of the first byte of the MAC
address.

-- 
Grant Edwards               grant.b.edwards        Yow! Someone in DAYTON,
                                  at               Ohio is selling USED
                              gmail.com            CARPETS to a SERBO-CROATIAN




^ permalink raw reply	[flat|nested] 20+ messages in thread

* [gentoo-user] Re: How to find the MAC address
  2012-04-19 19:40 [gentoo-user] How to find the MAC address Alex Schuster
                   ` (2 preceding siblings ...)
  2012-04-19 19:50 ` Neil Bothwick
@ 2012-04-20 15:22 ` James
  2012-04-20 18:43   ` Mick
  2012-04-23 12:49 ` [gentoo-user] " Kfir Lavi
  4 siblings, 1 reply; 20+ messages in thread
From: James @ 2012-04-20 15:22 UTC (permalink / raw
  To: gentoo-user

Alex Schuster <wonko <at> wonkology.org> writes:


> How am I supposed to find the MAC address of an ethernet interface?

nmap -sP 192.168.2.0/24

might be of interest too,

ymmv,
James




^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-20 10:11       ` Alex Schuster
@ 2012-04-20 16:58         ` Peter Humphrey
  2012-04-23  1:47         ` Walter Dnes
  1 sibling, 0 replies; 20+ messages in thread
From: Peter Humphrey @ 2012-04-20 16:58 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

On Friday 20 April 2012 11:11:08 Alex Schuster wrote:
> Peter Humphrey writes:
> > Which package is it in?
> 
> sys-apps/iproute2

Of course. I should have thought of that - thanks.

-- 
Rgds
Peter

[-- Attachment #2: Type: text/html, Size: 2271 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] Re: How to find the MAC address
  2012-04-20 15:22 ` [gentoo-user] " James
@ 2012-04-20 18:43   ` Mick
  2012-04-20 20:39     ` Michael Mol
  0 siblings, 1 reply; 20+ messages in thread
From: Mick @ 2012-04-20 18:43 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: Text/Plain, Size: 486 bytes --]

On Friday 20 Apr 2012 16:22:10 James wrote:
> Alex Schuster <wonko <at> wonkology.org> writes:
> > How am I supposed to find the MAC address of an ethernet interface?
> 
> nmap -sP 192.168.2.0/24
> 
> might be of interest too,
> 
> ymmv,
> James

Hmmm ... current versions use -sn instead of -sP for no port scan.

BTW, this would only work if you scan (as root) the target from another box.  
It will not reveal a MAC address if you scan localhost.
-- 
Regards,
Mick

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] Re: How to find the MAC address
  2012-04-20 18:43   ` Mick
@ 2012-04-20 20:39     ` Michael Mol
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Mol @ 2012-04-20 20:39 UTC (permalink / raw
  To: gentoo-user

On Fri, Apr 20, 2012 at 2:43 PM, Mick <michaelkintzios@gmail.com> wrote:
> On Friday 20 Apr 2012 16:22:10 James wrote:
>> Alex Schuster <wonko <at> wonkology.org> writes:
>> > How am I supposed to find the MAC address of an ethernet interface?
>>
>> nmap -sP 192.168.2.0/24
>>
>> might be of interest too,
>>
>> ymmv,
>> James
>
> Hmmm ... current versions use -sn instead of -sP for no port scan.
>
> BTW, this would only work if you scan (as root) the target from another box.
> It will not reveal a MAC address if you scan localhost.

'localhost' resolves to either 127.0.0.1 or ::1, which is almost
invariably assigned to the 'lo' interface.

It *might* work if you ran it against a public IP of the machine
you're on. Depends on how much optimization there is in the network
stack, I suppose.

-- 
:wq



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-20 10:11       ` Alex Schuster
  2012-04-20 16:58         ` Peter Humphrey
@ 2012-04-23  1:47         ` Walter Dnes
  1 sibling, 0 replies; 20+ messages in thread
From: Walter Dnes @ 2012-04-23  1:47 UTC (permalink / raw
  To: gentoo-user

On Fri, Apr 20, 2012 at 12:11:08PM +0200, Alex Schuster wrote
> Peter Humphrey writes:
> 
> > On Thursday 19 April 2012 20:56:59 Michael Mol wrote:
> > 
> > > The 'ip' command is far and away a nicer tool than ifconfig, once you
> > > get a handle on it.
> > 
> > Which package is it in?
> 
> sys-apps/iproute2

  It's also a built-in for busybox, which is part of the system package.
On my machine...

waltdnes@d531 ~ $ busybox ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1454 qdisc pfifo_fast qlen 1000
    link/ether 00:1d:09:96:6c:1c brd ff:ff:ff:ff:ff:ff

waltdnes@d531 ~ $ busybox ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1454 qdisc pfifo_fast qlen 1000
    link/ether 00:1d:09:96:6c:1c brd ff:ff:ff:ff:ff:ff
    inet 192.168.123.251/29 brd 192.168.123.255 scope global eth0
    inet 169.254.1.4/16 brd 169.254.255.255 scope global eth0:1

-- 
Walter Dnes <waltdnes@waltdnes.org>



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [gentoo-user] How to find the MAC address
  2012-04-19 19:40 [gentoo-user] How to find the MAC address Alex Schuster
                   ` (3 preceding siblings ...)
  2012-04-20 15:22 ` [gentoo-user] " James
@ 2012-04-23 12:49 ` Kfir Lavi
  4 siblings, 0 replies; 20+ messages in thread
From: Kfir Lavi @ 2012-04-23 12:49 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1733 bytes --]

On Thu, Apr 19, 2012 at 10:40 PM, Alex Schuster <wonko@wonkology.org> wrote:

> Hi there!
>
> How am I supposed to find the MAC address of an ethernet interface? I used
> to call ifconfig and grep for HWaddr, but this does not work any more.
>
> I found the 'old-output' USE flag for sys-apps/net-tools, which brings
> back the old behaviour in order not to break old scripts, but I'd like to
> know what the new method is that scripts should use.
>
> Here's how the output looked before and now:
>
> Old output:
> eth0      Link encap:Ethernet  HWaddr bc:5f:f4:19:ad:18
>          inet addr:192.168.2.42  Bcast:192.168.2.255  Mask:255.255.255.0
>          inet6 addr: fe80::be5f:f4ff:fe19:ad18/64 Scope:Link
>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>          RX packets:11027476 errors:0 dropped:0 overruns:0 frame:0
>          TX packets:8002728 errors:0 dropped:0 overruns:0 carrier:1
>          collisions:0 txqueuelen:1000
>          RX bytes:11763889583 (10.9 GiB)  TX bytes:1006570663 (959.9 MiB)
>          Interrupt:49
>
> New output:
> eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>        inet 192.168.2.42  netmask 255.255.255.0  broadcast 192.168.2.255
>        inet6 fe80::be5f:f4ff:fe19:ad18  prefixlen 64  scopeid 0x20<link>
>        ether bc:5f:f4:19:ad:18  txqueuelen 1000  (Ethernet)
>        RX packets 10791981  bytes 11413935608 (10.6 GiB)
>        RX errors 0  dropped 0  overruns 0  frame 0
>        TX packets 7867427  bytes 996505563 (950.3 MiB)
>        TX errors 0  dropped 0 overruns 0  carrier 1  collisions 0
>        device interrupt 49
>
>        Wonko
>
>
You can grab mac of eth0 with this command:
ip link show eth0 | grep 'link/ether' | awk '{print $2}'

Kfir

[-- Attachment #2: Type: text/html, Size: 2273 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2012-04-23 12:52 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-19 19:40 [gentoo-user] How to find the MAC address Alex Schuster
2012-04-19 19:45 ` Michael Mol
2012-04-19 20:01   ` Alex Schuster
2012-04-19 20:12     ` Michael Mol
2012-04-20 10:43       ` Joost Roeleveld
2012-04-20 14:14         ` [gentoo-user] " Grant Edwards
2012-04-19 19:48 ` [gentoo-user] " Michael Orlitzky
2012-04-19 19:56   ` Michael Mol
2012-04-19 23:29     ` Peter Humphrey
2012-04-20 10:11       ` Alex Schuster
2012-04-20 16:58         ` Peter Humphrey
2012-04-23  1:47         ` Walter Dnes
2012-04-19 20:40   ` Alex Schuster
2012-04-19 21:04     ` Michael Orlitzky
2012-04-19 19:50 ` Neil Bothwick
2012-04-19 20:14   ` Alex Schuster
2012-04-20 15:22 ` [gentoo-user] " James
2012-04-20 18:43   ` Mick
2012-04-20 20:39     ` Michael Mol
2012-04-23 12:49 ` [gentoo-user] " Kfir Lavi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox