0

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?

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

3 Answers 3

2

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

ifconfig -a

of

ip address show
0

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.

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .