Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a linux system for which I want to create my own udev rules for the nic. Currently there are no rules, so no ethX is configured. I can't do ifconfig (it is not showing any interfaces besides lo) or grep eth in /var/log/*. Is there a way I can find out the mac address from within my system without looking at the hardware?

share|improve this question
1  
Load the relevant driver with modprobe, then it'll show up in ifconfig output. –  MadHatter Jun 28 '13 at 15:30
    
Have you tried ifconfig -a? –  slimsuperhero Jun 28 '13 at 17:11
    
Blush - the -a Option is what I was looking for –  Isaac Jul 1 '13 at 6:15

3 Answers 3

up vote 1 down vote accepted

Just try (ifconfig does not display interfaces which are down otherwise)

ifconfig -a

of

ip address show
share|improve this answer

install lshw in your system first. then sudo lshw and examine the output. look for the network sections. mac address is called serial: in the output. or you can look for Ethernet. the nics may not be called ethX (logical name) depending on your distribution, however.

share|improve this answer

The proper way to find the MAC of your devices is to use the ip(8) command. They'll show up regardless its current configuration status.

Avoid the use of ifconfig.

# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DORMANT qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
4: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
5: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff

As @MadHatter noted in a comment, the required modules for the device must be present and loaded in the kernel.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.