Network switches or Layer 2 technology Ethernet protocol uses MAC addresses in order to transfer frames between systems. MAC addresses are 48-bit value. This 48-bit value contains the device manufacturer ID as the first 24 bit. In this tutorial we will learn how to look, search and find the Organizationally Unique Identifier in Linux distributions like Ubuntu, Debian, Mint, Kali, Fedora, CentOS, RHEL, etc.
网络交换机或第2层技术以太网协议使用MAC地址以便在系统之间传输帧。 MAC地址是48位值。 此48位值包含设备制造商ID作为前24位。 在本教程中,我们将学习如何在Linux发行版(如Ubuntu,Debian,Mint,Kali,Fedora,CentOS,RHEL等)中查找,搜索和找到组织唯一标识符。
MAC地址 (Mac Address)
As stated in the previous part MAC address is used to address and route Ethernet frames. MAC address consists of a 48-bit value and simply expressed as the hexadecimal format. Here is an example of MAC Address.
如前所述,MAC地址用于寻址和路由以太网帧。 MAC地址由48位值组成,并简单表示为十六进制格式。 这是MAC地址的示例。
00:50:56:c0:00:4b
OUI(组织唯一标识符) (OUI (Organizationally Unique Identifier))
OUI or Organizationally Unique Identifier is the first 24 bit or 6 hexadecimal value of the MAC address. IEEE is responsible for the OUI in MAC addresses. They provide the Ethernet card manufacturer company. In the previous example 00:50:56
is OUI of the MAC address.
OUI或组织唯一标识符是MAC地址的第一个24位或6个十六进制值。 IEEE负责MAC地址中的OUI。 他们提供了以太网卡制造商公司。 在前面的示例中, 00:50:56
是MAC地址的OUI。
打印MAC地址 (Print MAC Address)
First, we will start by printing the MAC address of the system. There are a lot of commands those have used to print MAC address but the ip link
command is the easiest way.
首先,我们将从打印系统的MAC地址开始。 有很多命令用于打印MAC地址,但是ip link
命令是最简单的方法。
$ ip link
使用get-oui命令查找OUI(Find OUI with get-oui Command)
get-oui
command is the most popular way to learn OUI . It is provided by arp-scan
package. We can install arp-scan
package like below.
get-oui
命令是学习OUI的最流行方法。 它由arp-scan
软件包提供。 我们可以安装如下的arp-scan
软件包。
Ubuntu,Debian,Mint,Kali (Ubuntu, Debian, Mint, Kali)
$ sudo apt install arp-scan -y
Fedora,CentOS,RHEL (Fedora, CentOS, RHEL)
$ sudo yum install arp-scan
使用ieee-data查找OUI (Find OUI with ieee-data)
ieee-data
is another package which provides the oui.txt
file . We can install this with the following commands
ieee-data
是另一个提供oui.txt
文件的软件包。 我们可以使用以下命令安装它
Ubuntu,Debian,Mint,Kali(Ubuntu, Debian, Mint, Kali)
$ sudo apt install ieee-data/bionic
Fedora,CentOS,RHEL (Fedora, CentOS, RHEL)
$ sudo yum install ieee-data
在oui.txt中搜索并查找OUI (Search and Look For OUI In oui.txt)
Installing previously explianed commands will create a file named oui.txt
in the /usr/share/ieee-data/oui.txt
this file provides the OUI data.
安装先前解释的命令将在/usr/share/ieee-data/oui.txt
创建一个名为oui.txt
的文件,该文件提供OUI数据。
Lets look into oui.txt
file to learn its format.
让我们查看oui.txt
文件以了解其格式。
$ less /usr/share/ieee-data/oui.txt
As we can see the first column is about OUI and the second column provides the organization name and the address of the organization. OUI is written in two formats first one is dash-separated and the other is without a separator.
我们可以看到,第一列是关于OUI的,第二列是组织的名称和组织的地址。 OUI以两种格式编写,一种是破折号,另一种是没有分隔符。
B4-99-BA (hex)
B499BA (base 16)
使用更少的查询 (Lookup Using Less)
We will lookup using less
command provided by Linux system. We will open the oui.txt
file and search with /
我们将使用Linux系统提供的less
命令来查找。 我们将打开oui.txt
文件,并使用/
搜索
$ less /usr/share/ieee-data/oui.txt
AND then put the OUI . In this example we search for 00179A or 00-17-9A
然后放OUI。 在此示例中,我们搜索00179A或00-17-9A
/00179A
OR
要么
/00-17-9A
使用Grep查找 (Lookup Using Grep)
We can also use grep
command to search and filter OUI. We will provide the OUI part and the oui.txt file as below. In this example, we will search for 00179A
or 00-17-9A
我们还可以使用grep
命令来搜索和过滤OUI。 我们将提供OUI部分和oui.txt文件,如下所示。 在此示例中,我们将搜索00179A
或00-17-9A
$ grep 00179A /usr/share/ieee-data/oui.txt
OR
要么
$ grep 00-17-9A /usr/share/ieee-data/oui.txt
使用Nmap Mac前缀文件查找(Lookup Using Nmap Mac Prefixes File)
nmap
is a popular network scanner which provides a lot of features. One of them is the OUI information. OUI information is stored in a file /usr/share/nmap/nmap-mac-prefixes
. We can search for a given OUI in this file with the grep command. First we need to install nmap
package if it is not installed.
nmap
是一种流行的网络扫描仪,具有许多功能。 其中之一是OUI信息。 OUI信息存储在文件/usr/share/nmap/nmap-mac-prefixes
。 我们可以使用grep命令在此文件中搜索给定的OUI。 首先,我们需要安装nmap
软件包(如果尚未安装)。
Ubuntu,Debian,Mint,Kali: (Ubuntu, Debian, Mint, Kali:)
$ sudo apt install nmap
Fedora,CentOS,RHEL: (Fedora, CentOS, RHEL:)
$ sudo yum install nmap
Now we will search with grep
the OUI 0024A5
in this case.
现在,在这种情况下,我们将使用grep
搜索OUI 0024A5
。
$ grep 0024A5 /usr/share/nmap/nmap-mac-prefixes
翻译自: https://www.poftut.com/how-to-lookup-oui-organizationally-unique-identifier-in-linux/