Neighbor Discovery Protocol

from Wikipedia, the free encyclopedia
NDP (Neighbor Discovery Protocol)
Family: Internet protocol family
Operation area: Network address mapping
NDP in the TCP / IP protocol stack :
application HTTP IMAP SMTP DNS ...
transport TCP UDP
Internet IPv6
Network access NDP
Ethernet Token
bus
Token
ring
FDDI ...
Standards: RFC 4861

RFC 3122

Neighbor Discovery Protocol ( NDP ) replaces IPv4's Address Resolution Protocol (ARP) for IPv6 . Among other things, it is used to resolve IPv6 addresses into link-layer addresses .

use

NDP is used by the nodes involved in the IPv6 network to find the link layer address of other nodes connected to the same network and to update the cached addresses. For all nodes not connected to the same network, NDP is used to find a router that can forward the packets .

functionality

For NDP, the node must manage the following information for each interface :

In the Neighbor cache addresses are managed, to some has been sent and are on the same network. Each entry of an IPv6 address has its link layer address. Further information is also managed here, such as pointers to packets waiting for address resolution, information for the availability check or whether it is a router.

In the Destination Cache addresses are managed, to some has been sent. For each entry, via a link to the neighbor cache , it is saved which is the next hop a packet should take.

The prefixes that are valid on the same network are managed in the Prefix List . Every entry, except for the link-local address, has an expiration date. This means that only networks that are announced by a router remain in the list.

All routers that are known for the interface are managed in the Default Router List . The entries refer to entries in the neighbor cache . In addition, they have an expiration date, so old routers disappear and only those who announce their presence remain.

The information for creating these lists is exchanged via ICMPv6 ( Internet Control Message Protocol V6 ). For this purpose, NDP defines five ICMPv6 types.

Router and prefix determination

Routers send router advertisement messages via multicast at certain time intervals . The information in these messages is used to create the Default Router List and Prefix List . After the specified lifetime has expired, the entries are deleted from the lists again. This means that only routers remain entered that are active and periodically announce their presence.

In order not to have to wait for the next scheduled router advertisement , a node can force a router advertisement by sending a router solicitation message to the router multicast address . This is particularly advantageous when activating a new interface so that you do not have to wait with the configuration.

Parameter determination

With this mechanism, nodes determine relevant parameters for the link (e.g. the MTU used for the link ) to which they are connected, or Internet parameters (such as the value for the hop limit ) that are used for outgoing packets have to.

Address auto configuration

With this procedure, network nodes configure IPv6 addresses for their interfaces without using a DHCP service.

Determination of the next hop

When a packet is to be sent, the destination cache is checked to see whether an entry already exists for this destination. If there is no entry, the next hop for the packet is determined using the prefix list and the default router list . This information is then stored in the destination cache so that this does not have to be determined every time.

If the new entry to a non-existing entry in the Neighbor Cache shows, this is also generated as unfinished marked and the address resolution (engl. Address Resolution ) triggered. The packet is placed in the queue and a pointer is set to it in the neighbor cache .

Address resolution

To determine the link layer address of a node, a neighbor solicitation message is sent via IPv6 multicast to the so-called solicited node address of the target. It should be noted that multicast is also used at the link layer level - each IPv6 node must therefore not only listen to its original fixed MAC address (e.g. Ethernet ), but also to a specific one at the link layer level Multicast address based on its IPv6 address. In the neighbor solicitation package, the complete IPv6 address sought is then contained in the user data, and only the node with the same address replies to it. It sends a neighbor advertisement message. The information it contains is stored in the neighbor cache . If an entry was still unfinished, it can now be marked as reachable and the packages to which it refers can be triggered.

Example: An IPv6 host in an Ethernet network with a MAC address 00: 1d: e0: 2a: 42: 42 receives a link-local IPv6 address fe80 :: 021d: e0ff: fe 2a: 4242 via EUI-64 . The associated solicitated node multicast address to which neighbor solicitation packets are sent at IPv6 level is FF02 :: 1: FF 2a: 4242 . At the link layer level, the host not only listens to its MAC address 00: 1d: e0: 2a: 42: 42 , but also to the Ethernet multicast address 33:33 (assigned to the solicitated node multicast address): ff: 2a: 42: 42 . 33:33 is the part that identifies an IPv6 multicast packet in the Ethernet, ff: 2a: 42: 42 identifies the actual group ( multicast ).

Detection of the inaccessibility of the neighbor

In order to keep the neighbor cache up-to-date, an attempt is made to find out whether the entries in it are still up-to-date. There are different ways to determine whether a node is not active. As long as you receive TCP data or TCP acknowledgments, you know that the node can still be reached.

When an entry exceeds its lifetime without being confirmed by traffic, it is marked as out of date. As soon as a package wants to be sent, the entry is marked as delayed and an attempt is made for a short time to confirm it through traffic. If this does not happen, a Neighbor Solicitation message is sent again to actively test the node. If it doesn't answer, it will be deleted from the neighbor cache .

Detection of duplicate addresses

With this procedure, network nodes determine whether the address they gave themselves during auto configuration is unique.

detour

Redirect messages are sent by the router to inform other nodes about a better first hop for a destination address. When such a message is received, the destination cache is updated. If no suitable entry is found in the destination cache , a new one is created.

ICMPv6 types

Router Solicitation - Type 133

Router Solicitation Scheme
+ Bits 0-7 Bits 8-15 Bits 16-23 Bits 24-31
0 Type code Checksum
32 Reserved
... Options

All routers in the same network are requested to report themselves via router solicitation to the router multicast address.

The code of this message is always 0. The "Reserved" field must be initialized with zeros by the sender and the recipient must ignore it.

The only possible option is the link layer address of the transmitter. In order to avoid problems with protocol extensions, all unknown options must be ignored.

Router Advertisement - Type 134

Router Advertisement Scheme
+ Bits 0-7 Bits 8-15 Bits 16-23 Bits 24-31
0 Type code Checksum
32 Hop limit M. O HA Pref Proxy reserved Router lifetime
64 Availability timeout
96 Resolution timeout
... Options

Routers announce their presence in the network via router advertisement . Either on request via router solicitation or periodically so as not to be forgotten.

The hop limit is an 8-bit value that contains the standard hop limit proposed by the router.

8 flags follow: A set M bit tells the node that it should also use stateful autoconfiguration in addition to autoconfiguration for the IP address.

A set O bit tells the node that it should use stateful autoconfiguration in addition to autoconfiguration for all non-IP address information.

HA signals whether a home agent (for mobile availability) is active.

Pref makes it possible to set preferences for several routers in the network.

Proxy signals whether a proxy is being used.

The router lifetime is a 16-bit integer that specifies how many seconds a router should remain in the default router list . The theoretical maximum is 18.2 hours (= 65,536 seconds = seconds). RFC4861 limits the maximum value to 9000 seconds d. H. on 2.5 hours. A value of 0 means that the router is not a default router and should not be entered in the default router list .

The availability timeout is a 32-bit integer that specifies how many milliseconds an entry in the neighbor cache should be considered reachable after receiving data. The resolution timeout is a 32-bit integer that specifies the number of milliseconds after which a neighbor solicitation should be sent again.

Valid options are the link-layer address of the sender, the MTU of the router, and any valid prefixes. To enable problem-free protocol extensions, all unknown options must be ignored.

Neighbor Solicitation - Type 135

Neighbor solicitation scheme
+ Bits 0-7 Bits 8-15 Bits 16-23 Bits 24-31
0 Type code Checksum
32 Reserved
64 Destination address
96
128
160
... Options

Via neighbor solicitation (as much as neighbor request ) to the link-layer multicast address of an IPv6 address, this address is resolved to a link-layer address. The link layer multicast address to be used is calculated from the IPv6 address of the destination node as described above under address resolution . The accessibility of a node is also checked in this way.

The type is set to 135 and the code to 0. The reserved field must be initialized with zeros by the sender and ignored by the receiver. The destination address is the IPv6 address that is to be resolved into a link layer address. No multicast address may be specified.

The only possible option is the link layer address of the transmitter. In order to avoid problems with protocol extensions, all unknown options must be ignored.

Neighbor Advertisement - Type 136

Neighbor Advertisement Scheme
+ Bits 0-7 Bits 8-15 Bits 16-23 Bits 24-31
0 Type code Checksum
32 R. S. O Reserved Reserved
64 Destination address
96
128
160
... Options

A Neighbor Advertisement message is used to respond to Neighbor Solicitation messages.

The type is set to 136 and the code to 0. The R bit is set if the node is a router. The S bit is set when the neighbor advertisement is sent based on a unicast neighbor solicitation message. A set O bit means that the entry in the neighbor cache must be updated. The reserved field must be initialized with zeros by the sender and ignored by the receiver.

The (IPv6) target address from the associated Neighbor Solicitation message is entered as the target address or the (IPv6) address for which a new link layer address is to be announced.

The only possible option is the link layer address of the transmitter. In order to avoid problems with protocol extensions, all unknown options must be ignored.

Redirect - Type 137

Redirect scheme
+ Bits 0-7 Bits 8-15 Bits 16-23 Bits 24-31
0 Type code Checksum
32 Reserved
64 Hop address
96
128
160
192 Destination address
224
256
288
... Options

Per redirect message to share with router if there is a better first hop for a certain goal.

The type is set to 137 and the code to 0. The reserved field must be initialized with zeros by the sender and ignored by the receiver. The hop address is the preferred router for the address. The destination address is the address for which there is a better first hop.

The only possible options are the link layer address of the sender and the header of the triggering packet. In order to avoid problems with protocol extensions, all unknown options must be ignored.

Implementation in operating systems

All IPv6-capable operating systems that are operated in Ethernet-based networks are able to resolve addresses using NDP.

Under most Linux distributions , the iproute2 tool can be used to view the neighbor cache:

# ip -6 neigh
2001:470:1f0b:2f2:5cad:a77f:aaff:849 dev wlan0 lladdr 00:11:25:32:10:ab REACHABLE
fe80::2a10:7bff:fe65:58a dev wlan0 lladdr 28:10:7b:65:ab:cd router REACHABLE
2001:470:1f0b:2f2::cafe dev wlan0 lladdr 00:11:25:32:10:ab REACHABLE

On many BSD -based systems such as FreeBSD and OpenBSD , the ndp tool helps with this , whereby the '-an' options mean that all hosts should be displayed numerically ; here at FreeBSD 9 (the comments on the right were added afterwards):

# ndp -an
Neighbor                             Linklayer Address  Netif Expire    S Flags
2001:475:abcd:2f2:3189:67c1:b550:9400 c6:ab:27:56:b5:30   em0 14s       R R               # <-- Ein anderer Rechner im Netzwerk, mit Privacy Extensions
2001:475:abcd:2f2:211:25ff:fe32:10ab 00:11:25:32:10:ab    em0 permanent R
fe80::211:25ff:fe32:10ab%em0         00:11:25:32:10:ab    em0 permanent R
2001:475:abcd:2f2::cafe              00:11:25:32:10:ab    em0 permanent R                 # <-- Alias-Adresse
fe80::2a10:7bff:fe65:58a%em0         28:10:7b:65:ab:cd    em0 23h59m25s S R               # <-- Das ist der Router
2001:475:abcd:2f2:5cad:a77f:aaff:849 00:11:25:32:10:ab    em0 permanent R
fe80::c6ab:27ff:fe56:b530%em0        c6:ab:27:56:b5:30    em0 24s       R R               # <-- Derselbe Rechner wie in der ersten Zeile mit seiner link-local address

In particular, the Expire column must be observed. It defines when a name entry is to be classified as obsolete. The addresses of the computer itself are permanent , the router is here for almost 24 hours and the neighboring devices in the network are usually less than a minute until the entry is refreshed.

In Windows the command is:

# netsh interface ipv6 show neighbors level=verbose

Web links

  • RFC 4861 - Neighbor Discovery for IP Version 6 (IPv6)
  • RFC 3122 - Extensions to IPv6 Neighbor Discovery for Inverse Discovery Specification

Individual evidence

  1. Robert M. Hinden <hinden@ipsilon.com>: IP Version 6 Addressing Architecture. Retrieved August 12, 2018 .
  2. Matt Crawford <crawdad@fnal.gov>: Transmission of IPv6 Packets over Ethernet Networks. Retrieved August 12, 2018 .