How to check , add or delete arp entries in powershell

    Table of contents

    Introduction

    In this article we are going to explore how to use the windows powershell to check the arp table and also adding / deleting the entries as per the use cases 

    How to check arp entries using Powershell

    Checking all arp entries

    Using the following example command we can check all the arp entries excluding the ones that are invalid or not resolved 

    PS C:\Users\Public\Discovering-systems> arp -a
    Interface: 192.168.44.1 --- 0x9
      Internet Address      Physical Address      Type
      192.168.44.254        00-50-56-fd-53-42     dynamic
      192.168.44.255        ff-ff-ff-ff-ff-ff     static
      224.0.0.2             01-00-5e-00-00-02     static
      224.0.0.22            01-00-5e-00-00-16     static
      224.0.0.251           01-00-5e-00-00-fb     static
      224.0.0.252           01-00-5e-00-00-fc     static
    
    Interface: 169.254.19.246 --- 0x14
      Internet Address      Physical Address      Type
      169.254.255.255       ff-ff-ff-ff-ff-ff     static
      224.0.0.2             01-00-5e-00-00-02     static
      224.0.0.22            01-00-5e-00-00-16     static
      224.0.0.251           01-00-5e-00-00-fb     static
      224.0.0.252           01-00-5e-00-00-fc     static
    

    Using the following example command we can check all the arp entries including the ones that are invalid or not resolved 

    PS C:\Users\Public\Discovering-systems> arp -a -v 
    Interface: 192.168.44.1 --- 0x9
      Internet Address      Physical Address      Type
      192.168.44.200        00-00-00-00-00-00     invalid
      192.168.44.254        00-50-56-fd-53-42     dynamic
      192.168.44.255        ff-ff-ff-ff-ff-ff     static
      224.0.0.2             01-00-5e-00-00-02     static
      224.0.0.22            01-00-5e-00-00-16     static
      224.0.0.251           01-00-5e-00-00-fb     static
      224.0.0.252           01-00-5e-00-00-fc     static
    
    Interface: 169.254.19.246 --- 0x14
      Internet Address      Physical Address      Type
      169.254.255.255       ff-ff-ff-ff-ff-ff     static
      224.0.0.2             01-00-5e-00-00-02     static
      224.0.0.22            01-00-5e-00-00-16     static
      224.0.0.251           01-00-5e-00-00-fb     static
      224.0.0.252           01-00-5e-00-00-fc     static
    

    Checking arp entry only specific to an interface

    Using the following example command we can check the arp entries learned over a particular interface owning the ip add 192.168.44.1 

    PS C:\Users\Public\Discovering-systems> arp -a -N 192.168.44.1
    
    Interface: 192.168.44.1 --- 0x9
      Internet Address      Physical Address      Type
      192.168.44.254        00-50-56-fd-53-42     dynamic
      192.168.44.255        ff-ff-ff-ff-ff-ff     static
      224.0.0.2             01-00-5e-00-00-02     static
      224.0.0.22            01-00-5e-00-00-16     static
      224.0.0.251           01-00-5e-00-00-fb     static
      224.0.0.252           01-00-5e-00-00-fc     static
    

    Checking arp entry for an individual ip

    Using the following example command we can check the arp entry of a single Ip as specified 

    PS C:\Users\Public\Discovering-systems> arp  -a 192.168.44.254
    
    Interface: 192.168.44.1 --- 0x9
      Internet Address      Physical Address      Type
      192.168.44.254        00-50-56-fd-53-42     dynamic
    

    How to delete an arp entry using powershell 

    Using the following example command we can delete an arp entry from the table and we were also able to validate after deleting the entry 

    PS C:\Users\Public\Discovering-systems> arp -d 192.168.44.254
    PS C:\Users\Public\Discovering-systems> arp -a 192.168.44.254
    No ARP Entries Found.
    

    How to add a static arp entry using powershell 

    Using the following example command we can add a static arp entry to the arp table . After adding the static entry we were also able validate the added entry. Please note that the specifying the interface on which we want to add the entry like we did in the example is important otherwise it will get added to a random interface 

    PS C:\Users\Public\Discovering-systems> arp -s 192.168.44.200 00-50-56-fd-53-42 192.168.44.1
    
    PS C:\Users\Public\Discovering-systems> arp -a 192.168.44.200
    
    Interface: 192.168.44.1 --- 0x9
      Internet Address      Physical Address      Type
      192.168.44.200        00-50-56-fd-53-42     static
    
    

    Conclusion

    In this article we have explored the ways in which we can create , delete or check the arp entries in the host machine using the windows powershell. 

    If you are interested in more Windows powershell related articles , please go through our following articles 

    Leave a Comment

    Your email address will not be published. Required fields are marked *