Linux определить mac адрес

How can I see my mac address on Ubuntu?

As described in the newer answer below, the modern solution is to run:

The MAC address is shown in the link/ether field.

Original Answer

Open a terminal and run ifconfig:

This answer needs to be deprecated given that the system doesn’t even come with ifconfig anymore. Someone like me looking for how to find the ip address without internet working can’t just intstall the obsolete utllity.

Use ip command instead of the outdated ifconfig

link/ether field of the output is the MAC address (Both for Wi-fi and ethernet connections, MAC address is represented by link/ether ). Mostly this will be present in the second line.

$ ip addr show 1: enp2s0: mtu 1500 qdisc mq state UP group default qlen 1000 link/ether a0:54:9f:53:b2:6e brd ff:ff:ff:ff:ff:ff 

In my case a0:54:9f:53:b2:6e is the MAC address.

On Ubuntu 20.04.02 LTS, there is no HWaddr in the output from ifconfig . Instead, look at ether :

Try ifconfig, and look at the «HWaddr».

okay, this is a very easy solution. 1/ Open a terminal 2/ ifconfig A list of network capable devices will be displayed. If you are using wireless, it usually is called wlan0, but can also be named pan0 wifi0 etc. A physical conection is most likely eth0. on the first line you will see your mac address. here is a sample of what you might see eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00

You can spoof your mac address too with macchanger (sudo aptitude install macchanger) just type man macchanger to learn more

You can also right-click on the GNOME Network Manager. There you choose connection information and the following window shows you the hardware address. See also NetworkManager at Ubuntus Wiki.

You must log in to answer this question.

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Читайте также:  How to open folders in linux terminal

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.14.43533

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

How to List/Get/Display/Find MAC Address in Linux Using 11 Popular Methods

CyberITHub

In this article, I will take you through different ways to List/Get/Display/Find MAC Address in Linux. You might be aware of Ethernet Card/Network Card/NIC Controller which works at Network level and is responsible for communicating with other network devices in a Network Topology. It is used in Layer-2 Communication. You can find the usage of MAC address in wide range of Network Devices currently in use. This is typically in-line with IEEE 802 Network technologies.

What is MAC Address

MAC is abbreviated as Media Access Control. It is a unique 48 bit(6-byte) address assigned to a Network Interface. It is almost used in all the Network Devices which has network controller in it. It will always show in this form 00:07:Y7:1C:6L:03.

How to List/Get/Display/Find MAC Address in Linux Using 11 Popular Methods 1

Find MAC Address in Linux

Method 1: How to find MAC Address in Linux Using ifconfig command

If you want to check MAC Address of all the network interfaces in Linux using our traditional ifconfig command then you need to use ifconfig -a command as shown below.

[root@localhost ~]# ifconfig -a enp0s3: flags=4163 mtu 1500 inet 192.168.0.103 netmask 255.255.255.0 broadcast 192.168.0.255 ether 08:00:27:1d:8e:54 txqueuelen 1000 (Ethernet) RX packets 191611 bytes 240718576 (229.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 85455 bytes 10105585 (9.6 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Please note that here I am using root user to run all the below commands.You can use any user with sudo access to run all these commands. For more information Please check Step by Step: How to Add User to Sudoers to provide sudo access to User.

Method 2: How to find an ethernet MAC Address in Linux Using ifconfig command

If you want to check the MAC Address of a specific network interface using ifconfig command then you need to use network interface name with ifconfig command as shown below. Here we are checking MAC Address of interface enp0s3 using ifconfig enp0s3 command.

[root@localhost ~]# ifconfig enp0s3 enp0s3: flags=4163 mtu 1500 inet 192.168.0.103 netmask 255.255.255.0 broadcast 192.168.0.255 ether 08:00:27:1d:8e:54 txqueuelen 1000 (Ethernet) RX packets 33568 bytes 12062979 (11.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 20124 bytes 4406857 (4.2 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Please note that you might find eth0 network interface in your system instead of enp0s3 . Hence Please use the network interface name with all the mentioned commands as per your system interface name or else none of the command will work.

Method 3: How to find MAC Address in Linux Using ip addr sh command

If you want to check the MAC address of all the network interfaces then you need to simply use ip addr sh command and check the MAC address from ether field as shown below.

[root@localhost ~]# ip addr sh 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp0s3: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 08:00:27:1d:8e:54 brd ff:ff:ff:ff:ff:ff inet 192.168.0.103/24 brd 192.168.0.255 scope global dynamic enp0s3 valid_lft 2947sec preferred_lft 2947sec

Method 4: How to find an ethernet MAC Address in Linux using ip addr sh command

If you want to check the MAC address of some specific network interface then you need to use the interface name with ip addr sh command and check the MAC address from ether field as shown below. In this example we are checking MAC address of enp0s3 network interface.

[root@localhost ~]# ip addr sh enp0s3 2: enp0s3: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 08:00:27:1d:8e:54 brd ff:ff:ff:ff:ff:ff inet 192.168.0.103/24 brd 192.168.0.255 scope global dynamic enp0s3 valid_lft 2610sec preferred_lft 2610sec

Method 5: How to find MAC Address in Linux Using ip link show command

If you want to check the MAC address of all the network interfaces then you can use another useful ip link show command and check the MAC address from link/ether field as shown below.

[root@localhost ~]# ip link show 1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: enp0s3: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 08:00:27:1d:8e:54 brd ff:ff:ff:ff:ff:ff

Method 6: How to find an ethernet MAC Address in Linux using ip link show command

If you want to check the MAC address of some specific network interface then you need to use the interface name with ip link show command and check the MAC address from ether field as shown below. In this example we are checking MAC address of enp0s3 network interface.

[root@localhost ~]# ip link sh enp0s3 2: enp0s3: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 08:00:27:1d:8e:54 brd ff:ff:ff:ff:ff:ff

Method 7: How to find MAC Address in Linux using ethtool command

You can also use another useful linux tool called ethtool to find MAC address in Linux as shown below. Here I am checking MAC address of my ethernet card enp0s3 using ethtool command hence you need to mention your Interface name before running below command.

[root@localhost ~]# ethtool -P enp0s3 | awk '< print $NF >;' 08:00:27:1d:8e:54

Method 8: How to find MAC Address in Linux using Regex with ifconfig command

You can use a simple grep regular expression with ifconfig command to find the MAC Address of an ethernet card in Linux as shown below. Like above example, Here I am using regular expression on my System enp0s3 interface so you need to change and mention your interface name instead of enp0s3 before running below command.

[root@localhost ~]# ifconfig enp0s3 | grep -o -E '([[:xdigit:]]:)[[:xdigit:]]' 08:00:27:1d:8e:54

Method 9: How to find MAC Address in Linux using SYS Files

If you want to check MAC address in Linux using SYS files you need to check network address file using below cat command. As mentioned below SYS file is a text file so its contents can always be seen through Linux cat command.

[root@localhost ~]# cat /sys/class/net/enp0s3/address 08:00:27:1d:8e:54

Method 10: How to find MAC Address in Linux using AWK Regex with ifconfig command

You can also use AWK regular expression with ifconfig command to find MAC Address in Linux as shown below. Here we are grepping ether keyword from ifconfig command and then piping to awk to get first and second column output separated by tab.

[root@localhost ~]# ifconfig enp0s3 | grep -i ether | awk '' ether 08:00:27:1d:8e:54 

Method 11: How to find MAC Address in Linux using Sed Regex with ifconfig command

Like above example, you can also use Sed Regular expressions with ifconfig command to find MAC Address in Linux as shown below.

[root@localhost ~]# ifconfig -a enp0s3 | grep ether | sed '/^.*ether */!d; s///;q' 08:00:27:1d:8e:54 txqueuelen 1000 (Ethernet)

Popular Recommendations:-

Читайте также:  Linux ping размер пакета

Источник

Как узнать mac адрес компьютера в Linux

mac

Для каждой сетевой карты дистрибутива Linux существует свой аппаратный адрес. Однако мало кто из новичков знает, где добыть эту информацию на своём ПК. Труднее всего это дается пользователям, которые привыкли работать с Windows. Но трудности в этом вопросе не так велики, как кажутся на первый взгляд. Чтобы узнать Mac-адрес, можно воспользоваться специальными утилитами, о которых вы узнаете прямо сейчас.

Утилита IP

IP не нужно устанавливать вручную – она наличествует в Линукс по умолчанию. Пользователю лишь остается её вызвать: $ ip a В открывшемся окне указаны те же самые интерфейсы, только в иной поочередности. Далее нужно повторить конструкцию предыдущей команды с небольшими коррективами: $ ip a | grep ether | gawk ‘’ Более подробно о команде IP написано в другой статье как пользоваться ip в линукс

Сетевая программа ifconfig

Консольная утилита ifconfig считается слегка устарелой на сегодняшний день. Ей можно подобрать замену в виде утилиты ip. Примечательно, что она функционирует примерно так же, как и её предшественница. ifconfig позволяет быстро получить нужную информацию, как только пользователь установит её на свой ПК. Чтобы становить нужный пакет с программами, необходимо ввести в окне терминала специальную команду: $ sudo pacman -S net-tools Если есть необходимость установить утилиту в Debian или Ubuntu, попробуйте следующий способ: $ sudo apt install net-tools Теперь попробуйте найти Mac-адрес Linux в перечне интерфейсов. Введите в терминале: $ ifconfig -a В открывшемся окне вы увидите 2 различных интерфейса. Они подписаны следующим образом: «enp0s7» и «lo». Вам потребуется первый блок с данными. Mac-адрес карты будет прописан напротив слова «ether». Для полного отображения адреса задайте следующее: $ ifconfig -a | grep ether | gawk ’’ Более подробно о команде ifconfig написано в другой статье: www.vseprolinux.ru/ifconfig

Читайте также:  Программное обеспечение simply linux

Заключение

Поиск информации относительно Mac-адреса в операционной системе Линукс осуществляется посредством двух альтернативных и очень похожих между собой программ. Их отличия между собой действительно незначительны. Тем не менее, владельцы дистрибутива Linux получили от разработчиков выбор. Новые версии системы по умолчанию оснащены утилитой ip. Старые версии имеют в своем арсенале утилиту ifconfig, отошедшую на второй план в обновленных версиях операционной системы. Если таковой не имеется изначально, но очень хочется заполучить её для нового компьютера, пользователь должен установить данную утилиту самостоятельно. О том, как инсталлировать программу, говорилось выше.

Источник

Оцените статью
Adblock
detector