Net::Address::Ethernet - find hardware ethernet address


  use Net::Address::Ethernet qw( get_address );
  my $sAddress = get_address;


The following functions will be exported to your namespace if you request :all like so:

  use Net::Address::Ethernet qw( :all );

Returns the 6-byte ethernet address in canonical form. For example, '1A:2B:3C:4D:5E:6F'.

When called in array context, returns a 6-element list representing the 6 bytes of the address in decimal. For example, (26,43,60,77,94,111).

If any non-zero argument is given, debugging information will be printed to STDERR.


Returns an array of hashrefs. Each hashref describes one Ethernet adapter found in the current hardware configuration, with the following entries filled in to the best of our ability to determine:

sEthernet -- The MAC address in canonical form.
rasIP -- A reference to an array of all the IP addresses on this adapter.
sIP -- The "first" IP address on this adapter.
sAdapter -- The name of this adapter.
iActive -- Whether this adapter is active.

For example:

   'sAdapter' => 'Ethernet adapter Local Area Connection',
   'sEthernet' => '12:34:56:78:9A:BC',
   'rasIP' => ['',],
   'sIP' => '',
   'iActive' => 1,

If any non-zero argument is given, debugging information will be printed to STDERR.


Returns a true value if its argument looks like an ethernet address.


Given a 6-byte ethernet address, converts it to canonical form. Canonical form is 2-digit uppercase hexadecimal numbers with colon between the bytes. The address to be converted can have any kind of punctuation between the bytes, the bytes can be 1-digit, and the bytes can be lowercase; but the bytes must already be hex.



arp, ifconfig, ipconfig


Please tell the author if you find any! And please show me the output of `arp <hostname>` or `ifconfig` or `ifconfig -a` from your system.


Martin 'Kingpin' Thurn, mthurn at,


This software is released under the same license as Perl itself.

#### This is an example of @ahInfo on MSWin32: ( { 'sAdapter' => 'Ethernet adapter Local Area Connection', 'sEthernet' => '00-0C-F1-EE-F0-39', 'sIP' => '', 'iActive' => 1, }, { 'sAdapter' => 'Ethernet adapter Wireless Network Connection', 'sEthernet' => '00-33-BD-F3-33-E3', 'sIP' => '', 'iActive' => 1, }, { 'sAdapter' => '{gobbledy-gook}', 'sDesc' => 'PPP adapter Verizon Online', 'sEthernet' => '00-53-45-00-00-00', 'sIP' => '', 'iActive' => 1, }, )

#### This is Solaris 8:

> /usr/sbin/arp myhost myhost ( at 03:33:ba:46:f2:ef permanent published

#### This is Solaris 8:

> /usr/sbin/ifconfig -a lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1 inet netmask ff000000 bge0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet netmask ffffff00 broadcast

#### This is Fedora Core 6:

$ /sbin/arp Address HWtype HWaddress Flags Mask Iface ether 03:53:53:e3:43:93 C eth0

#### This is amd64-freebsd:

$ ifconfig fwe0: flags=108802<BROADCAST,SIMPLEX,MULTICAST,NEEDSGIANT> mtu 1500 options=8<VLAN_MTU> ether 02:31:38:31:35:35 ch 1 dma -1 vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 inet6 fe8d::2500:bafd:fecd:cdcd%vr0 prefixlen 64 scopeid 0x2 inet netmask 0xffffff00 broadcast ether 00:53:b3:c3:3d:39 media: Ethernet autoselect (100baseTX <full-duplex>) status: active nfe0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=8<VLAN_MTU> inet6 fe8e::21e:31ef:fee1:26eb%nfe0 prefixlen 64 scopeid 0x3 ether 00:13:33:53:23:13 media: Ethernet autoselect (100baseTX <full-duplex>) status: active plip0: flags=108810<POINTOPOINT,SIMPLEX,MULTICAST,NEEDSGIANT> mtu 1500 lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5 inet netmask 0xff000000 inet netmask 0xffffffff inet netmask 0xffffffff tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1492 inet --> netmask 0xffffffff Opened by PID 268