You get a bonus - 1 coin for daily activity. Now you have 1 coin

How to find the MAC address of a network card in Debian, CentOS, FreeBSD (or Ubuntu, RedHat)

Practice



Task: find the MAC address of a network interface.


For FreeBSD:

$ sudo ifconfig
xl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=80008<VLAN_MTU,LINKSTATE>
ether 00:60:97:5b:3c:fd
inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255
media: Ethernet autoselect (100baseTX)
status: active

Now look at the output for the network card you need, in the "ether" field, and you'll see the MAC address.


For Debian (Ubuntu):

$ sudo ifconfig -a
eth0 Link encap:Ethernet HWaddr fe:16:3e:68:fc:95
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::fc16:3eff:fe68:fc95/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:239525695 errors:0 dropped:0 overruns:0 frame:0
TX packets:95288283 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1706073511 (1.5 GiB) TX bytes:669868294 (638.8 MiB)
Interrupt:246

We used the -a flag here to see all network interfaces, including those that currently don't have an IP configured.

The MAC address is on the first line of the output, after the phrase "HWaddr".


For CentOS (RedHat):

$ sudo /sbin/ifconfig -a
eth0 Link encap:Ethernet HWaddr FE:16:3E:68:FC:FC
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:287136 errors:0 dropped:0 overruns:0 frame:0
TX packets:132466 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:69584534 (66.3 MiB) TX bytes:9595586 (9.1 MiB)
Interrupt:177 Base address:0xc000

The MAC address is on the first line of the output after the phrase "HWaddr".

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Computer networks"

Terms: Computer networks