Home  >  Article  >  Operation and Maintenance  >  What is the function of linux arp

What is the function of linux arp

藏色散人
藏色散人Original
2023-03-23 09:47:301712browse

Linux arp is used to manage the system's arp buffer, and can display, delete, and add static mac addresses; ARP manipulates the kernel's ARP cache in various ways. The main option is to clear the address mapping item and set it manually; For debugging purposes, the ARP program also allows a complete dump of the ARP cache.

What is the function of linux arp

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

What is the function of linux arp?

Linux basic command arp

arp

The arp instruction is used To manage the system's arp buffer, you can display, delete, and add static mac addresses. ARP manipulates the kernel's ARP cache in various ways. The main option is to clear the address mapping entries and set them manually. For debugging purposes, the ARP program also allows a complete dump of the ARP cache.

This command is applicable to: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1、Syntax

arp [-evn] [-H type] [-i if] -a [hostname]

arp [-v] [-i if] -d hostname [pub]

arp [-v] [-H type] [-i if] -s hostname hw_ addr [temp]

arp [-v] [-H type] [-i if] -s hostname hw_ addr [netmask nm] pub

arp [-v] [-H type] [-i if] -Ds hostname ifa [netmask nm] pub

arp [ -vnD] [-H type] [-i if] -f [filename]

2, option list

Display command versionat When setting or reading the ARP cache, this optional parameter tells ARP what types of entries it should check. The default value of this parameter is Display the contents of the local arp buffer##-d-D | -use-device-e-i -s-f filename

Options

Description

##--help

Show help document

##--version

-H

type

--hw-type

type

-t

type

ether

(which is the hardware code 0x01 for IEEE 802.3 10 Mbps Ethernet). Other possible values ​​are ARCnet(Arcnet), PROnet(PRINET), AX.25(Axis 25), and Net/ROM(Netrom).

-a

[hostname] | --all [hostname]

hostname | --deletehostname

Delete the specified address type from the buffer

Use the mac address of the specified interface

Use Linux style display

if | --device if

Display the arp buffer of the specified device

hostnamehw_addr

Set the specified host Mac address mapping

| --file

filename

Similar to the -s option, except this time the address information is set from filename. The name of the data file is usually "/etc/ether", but this is not official. If the filename "/etc/ether" is not specified as the default value. The format of the file is simple; it simply contains lines of ASCII text with the hardware address and the hostname separated by spaces. Additionally, the pub, temp, and netmask flags may be used.

-n | --numeric

Use numeric display

-v | --verbose

##Display execution process

Wherever a hostname is required, one can also enter the IP address in dotted decimal notation. As a special case of compatibility, the order of hostnames and hardware addresses can be swapped. Every complete entry in the ARP cache will be marked with the C flag. Permanent entries are marked with an M, and published entries are marked with a P.

3, Example

1) Add static mapping

[root@localhost ~]# arp -i eth0 -s 192.168.1.6 ff:ee:ee:ee:ee:ee        //将目标ip地址映射固定mac

[root@localhost ~]# arp –a                                                     //查看arp缓冲区

? (10.0.2.2) at 52:54:00:12:35:02 [ether] on eth0

? (192.168.1.6) at ff:ee:ee:ee:ee:ee [ether] PERM on eth0

2) Display digitally

[root@localhost ~]# arp -vn

Address                  HWtype  HWaddress          Flags Mask            Iface

10.0.2.2                 ether   52:54:00:12:35:02   C                     eth0

192.168.1.6              ether   ff:ee:ee:ee:ee:ee   CM                    eth0

Entries: 2 Skipped: 0Found: 2

Related recommendations: "

Linux Video Tutorial"

The above is the detailed content of What is the function of linux arp. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What does linux eq mean?Next article:What does linux eq mean?