ip neighbour

Neighbour/arp tables management.
neighbour can be abbreviated to n or neigh

ip neighbour add - Add a new neighbour entry
ip neighbour change - Change an existing entry
ip neighbour replace - Add a new entry or change an existing one
ip neighbour delete - Delete a neighbour entry
ip neighbour flush - Flush neighbour entries
ip neighbour show - List neighbour entries

      ip neighbour { add | del | change | replace } { ADDR [ lladdr LLADDR ]
                  [ nud { permanent | noarp | stale | reachable } ] | proxy ADDR } [ dev DEV ]

      ip neighbour { show | flush } [ to PREFIX ] [ dev DEV ] [ nud STATE ]

   to ADDRESS (default)
      The protocol address of the neighbour. It is either an IPv4 or IPv6 address.

   dev NAME
      The interface to which this neighbour is attached.

   lladdr LLADDRESS
      The link layer address of the neighbour. LLADDRESS can also be null.

   nud NUD_STATE
      the state of the neighbour entry. nud is an abbreviation for 'Neighbour Unreachability Detection'.
      for 'ip neigh show' this option may be given more than once.
      (If this option is absent, ip lists all entries except for none and noarp.)

      The state can take one of the following values: 

         permanent - the neighbour entry is valid forever and can be only be removed administratively.

         noarp - the neighbour entry is valid.
                 No attempts to validate this entry will be made but it can be removed when its lifetime expires.

         reachable - the neighbour entry is valid until the reachability timeout expires.

         stale - the neighbour entry is valid but suspicious.
                 This option to ip neigh does not change the neighbour state if it was
                 valid and the address is not changed by this command.

         all  -  List all states (ip neigh show only)

Warning: Attempts to delete or manually change a noarp entry created by the kernel may result in unpredictable behaviour. Particularly, the kernel may try to resolve this address even on a NOARP interface or if the address is multicast or broadcast.

The arguments for 'del' are the same as with 'add', except that lladdr and nud are ignored. flush has the same arguments as show. The differences are that it does not run when no arguments are given, and that the default neighbour states to be flushed do not include permanent and noarp.

With the -statistics option, the command becomes verbose. It prints out the number of deleted neighbours and the number of rounds made to flush the neighbour table. If the option is given twice, ip neigh flush also dumps all the deleted neighbours.

Neighbour objects establish bindings between protocol addresses and link layer addresses for hosts sharing the same link. Neighbour entries are organized into tables. The IPv4 neighbour table is known by another name - the ARP table.

The corresponding commands display neighbour bindings and properties, add new neighbour entries and delete old ones.


List neighbour entries:
$ ip neighbour show

Invalidate or delete an ARP entry for the neighbour on the device eth1:
$ ip neighbour del dev eth1

Add a permanent ARP entry for neighbour on device eth0:
$ ip neighbour add lladdr aa:bb:cc:dd:ee:ff dev eth0 nud permanent

Flush the neighbour/arp tables:
$ ip neighbour flush -s -s

“It is remarkable how easily and insensibly we fall into a particular route, and make a beaten track for ourselves” ~ Henry David Thoreau

Related linux commands

arp - address resolution display and control.
ip - Routing, devices and tunnels.
Equivalent Windows command: ROUTE - Manipulate network routing tables.

Copyright © 1999-2023 SS64.com
Some rights reserved