IPv6 Neighbor Discovery

Zeung-il Kim
7 min readJul 7, 2020

기술 트렌드를 잘 읽고 해당 기술쪽으로 타이밍 맞춰서 잘 편승하는 것이 엔지니어로서 장수 하는 비결 중 하나라고 생각합니다. 그런 부분에 있어서 IP(Internet Protocol)기반 기술은 앞으로도 쭉 살아남을 만한 영역이 아닌가 생각됩니다. 5G가 됬든 WiFi6/7이 오든 IoT 든 Connected Car든 다 IP 기반으로 움직이지 않을까 생각됩니다. 그렇다면 앞으로는 IPv4보다는 IPv6가 활성화 되지 않을까요? 전기차의 충전 통신은 이미 IPv6로 표준화 되어 있습니다.

아래글은 개인적인 정리 차원에서 IPv6 ND에 대해 요약해봤습니다.

======================================

IPv6 ND 는 ICMP(Internet Control Message Protocol)와 “solicited-node multicast address”를 사용해서 동일 네트워크 상의(Local link) neighbor의 link-layer address를 확인해서 연결이 가능한지 판단하고, 이웃하는 장치들(neighboring devices)을 추적관리하는 하는 과정이다.

※ IPv6의 Static cache entry : 관리자가 수동으로 각 장치들의 IPv6 주소, subnet mask, gateway, 대응하는 MAC주소등을 table에 기록함. 제어가 용이하지만 table 관리를 위한 작업이 필요함. (매번 update 필요)

※ NS(Neighbor Solicitation) message : ICMP type value 135, 임의의 노드가 동일 링크 상에 있는 다른 노드의 link-layer 주소를 알고자 할 때 전송한다. 이 때 source address는 NS를 보내는 노드의 IPv6 주소가 된다. Destination address는 목적지 노드의 IPv6 주소에 대응하는 “solicited-node multicast address”가 된다.

NS를 수신하면 destination node는 NA(Neighbor Advertisement)메시지로 응답한다. (ICMP type value 136). Source address는 NA를 전송하는 노드의 IPv6 인터페이스 주소이고 destination address는 NS를 보낸 노드의 주소가 된다. NS, NA 모두 link-layer address를 포함해서 보낸다.

source node가 NA를 수신하게되면 source node와 destination node는 서로 통신이 가능하게 된다.

Neighbor의 link-layer address가 식별되고 나면 NS는 neighbor로의 도달여부(reachability) 확인을 위해서 사용될 수 있다. (이 경우는 destination address로 neighbor의 unicast address를 사용함. Neighbor unreachability detection은 unicast packet을 보냈던 노드에 대해서만 수행함. postive ack가 회신된 neighbor는 reachable로 판단함, 또는 NS에 대해 NA가 오는 neighbor)

NA는 local link상에서 노드의 link-layer address에 변화가 있는 경우 송신 될 수 있다. (이 경우 NA의 destination address는 all-nodes multicast address가 된다.)

NS메시지는 stateless autoconfiguration 과정에서도 사용될 수 있는데, 이는 해당 인터페이스에 주소를 할당하기 전에 IPv6 unicast 주소가 유일한지(uniqueness) 확인하기 위함이다. 인터페이스에 신규 link-local주소를 할당하기 전에 먼저 DAD(Duplicate Address Detection)과정이 수행되며, 이 상태에서는 신규 주소는 임시 상태로 남아있게 된다. 이 때 노드는 unspecified source address(::)와 임시(tentative) link-local address를 가지고 NS를 보내게 된다. 만약 다른 노드가 해당 주소를 이미 사용하고 있다면 그 노드는 임시 link-local address를 담아서 NA로 회신을 한다. 아무런 NA가 없다면 이 임시주소가 unique하다고 판단하고 인터페이스에 주소를 할당한다.

※ Link-local scope multicast address → FF02::2에 대응하는 MAC address는 33:33:00:00:00:02

※ Solicited-node multicast : NS를 이용해서 destination node의 link-layer address를 얻어오기 위해 사용하는 destination address

ff02::1:ff00/104 여기에 low-order 24bits를 append한다. 즉, IPv6 Link local unicast address 가 fe80::da61:62ff:fe40:b937 이라면 solicited-node multicast address는 ff02::1:ff40:b937이 된다.

※ NS를 보내는 Linux command → ndisc6 ff02::1:ff40:b937 wlp4s0

IPv6 multicast는 MLD(multicast listener discovery) report 메시지를 송신하므로써 multicast group에 join한 node들에서 작동한다. Multicast group은 지리적 위치로 제한 되지 않으며 host들은 자신이 local에 있든, Internet상에 있든 상관 없이 multicast group에 join되어 있다면 그 group에 보낸 multicast packet을 받을 수 있다. multicast group에 속해 있든 속해 있지 않든 상관 없이 모든 host들이 sender가 될 수 있으나, 수신은 해당 multicast group에 속한 host들만이 패킷을 수신 할 수 있다. 수시로 host들은 multicast group에서 떠나거나(leave) 합류(join)할 수 있다.

IPv6 multicast address는 FF00::/8 prefix를 사용한다. (FF가 multicast임을 의미). 두 번째 octet은 lifetime(0 : permanent, 1 : temporary)과 scope(1 : node, 2 : link, 5 : site, 8 : organization, E : global scope)를 정의함.

multicast address는 interface ID로 끝난다.

몇가지 well known IPv6 Multicast address

FF02::1 → all nodes

FF02::2 → all routers

FF02::16 → all MLDv2-capable routers

FF02:0:0:0:0:1:FF00::/104 → solicited node address

※ unicast : 1-to-1 communication. 특정 노드에 패킷을 송신

※ anycast : 1-to-1 of many communication. 여러 개의 노드들에게 패킷을 송부하지만 경로 상 가장 가까운 노드를 목적지로 한다.

※ multicast : 1-to-many communication. 여러개의 노드들에게 패킷을 송부한다.

※ node : IPv6 기능이 있는 인터페이스를 의미

※ router : 명시적으로 주소가 지정되지 않은 패킷을 전달 할 수 있는 노드

※ host : router가 아닌 모든 노드

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response