arp Command in Linux

Learn via video courses
Topics Covered

Build an AI-First Career, Master the Complete Skillset

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program
NSDC Certified

AI Forward Deployed Engineer Program

Full-stack engineering, production AI and client-facing consulting

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program

Overview

In the Linux universe, one command that is vital for network troubleshooting and configuration is the arp command. The arp command, short for 'Address Resolution Protocol', is a protocol used to find the host's MAC (Media Access Control) address given the IP address. This utility is vital for network administration and understanding the mapping between a machine's IP and MAC addresses.

Syntax of arp Command in Linux

The basic syntax of the arp command in Linux is as follows:

Where:

  • [-vn]: The -v option stands for verbose, and -n stands for numerical. The verbose option provides detailed output, while numerical gives numeric IP addresses avoiding domain name resolution.
  • [-H type] [-i if]: -H allows you to specify the hardware type. -i lets you specify the name of the network interface.
  • -a [hostname] | -d hostname [pub] | -s hostname ether_addr [temp] | -s hostname pub [only] [proxy]: -a displays the arp cache. -d deletes an entry. -s creates a new entry. The optional 'hostname', 'ether_addr', and other flags further refine these operations.
Sharpen Your Fundamentals with Free Learning

Options in arp Command in Linux

  1. -a: Displays the current ARP table entries.

    For example -

    Output:

    This command lists all entries in the ARP table. The output shows the IP address, MAC address and the interface used.

  2. -d: Deletes an entry from the ARP table.

    For example -

    This command deletes the ARP entry for the IP 192.168.1.1.

  3. -s: Creates a new entry in the ARP table.

    For example -

    This command adds a new entry to the ARP table, linking the IP address 192.168.1.2 with the MAC address 00:11:22:33:44:55.

How Scaler Transformed Careers in Different Fields

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

Example Usages

  • Display ARP table:

    Output:

    Explanation: Using 'arp' without any option displays the ARP table showing IP, MAC address, and the interface name.

  • Adding an ARP table entry:

    Explanation: Creates a new ARP entry for the IP address 192.168.1.3 and the MAC address 00:aa:bb:cc:dd.

Tips

  • ARP entries are temporary and may be deleted after a period of time or upon reboot. To create permanent entries, consider updating the ARP configuration files.

  • Incorrect use of arp command can affect network operations. Always double-check before deleting or adding entries.

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

Advanced Use Cases of arp Command in Linux

  • Delete all ARP entries:

    Explanation: This command combination deletes all entries from the ARP table. It uses awk to filter and construct delete commands, which are then executed by sh.

  • Display ARP entries for a specific interface:

    Output:

    Explanation: This command displays the ARP entries specifically for the network interface 'eth0'.

Conclusion

  • The arp command in Linux is a powerful tool for managing IP to MAC address mappings.

  • It is important for network administration and troubleshooting.

  • The command provides options for displaying, adding, and deleting ARP entries.

  • Though powerful, incorrect usage of the arp command can lead to network issues. Therefore, it's crucial to use it wisely and cautiously.