Skip to content
Package ndp implements the Neighbor Discovery Protocol, as described in RFC 4861. MIT Licensed.
Branch: master
Clone or download
mdlayher Merge pull request #17 from mdlayher/mdl-srht
builds: switch to builds.sr.ht
Latest commit 012988d Apr 19, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.builds builds: switch to builds.sr.ht Apr 19, 2019
cmd/ndp Don't silently drop trailing args on command line Oct 19, 2018
internal internal/ndpcmd: only print RA fields which are set Mar 7, 2019
LICENSE.md
README.md builds: switch to builds.sr.ht Apr 19, 2019
addr.go ndp: add tests for address selection Jan 10, 2018
addr_test.go
conn.go ndp: fix typo May 30, 2018
conn_setup_test.go ndp: port IPv6-enabled interface detection to tests from cmd/ndp Feb 19, 2019
conn_test.go ndp: add SolicitedNodeMulticast and Conn.{Join,Leave}Group Jan 26, 2018
doc.go ndp: use stringer to generate RouterSelectionPreference strings Jul 21, 2018
fuzz.go ndp: implement DNS search list option Feb 19, 2019
fuzz_test.go ndp: handle Unicode domain names in DNSSL Feb 20, 2019
go.mod go.mod: bump dependencies Apr 19, 2019
go.sum go.mod: bump dependencies Apr 19, 2019
gofuzz.go ndp: fix fuzz crashers and add fuzz test Jan 10, 2018
message.go
message_internal_test.go ndp: add router advertisement flags from newer RFCs Jan 16, 2018
message_test.go Add MarshalMessageChecksum for easy checksum calculation Jan 14, 2019
option.go ndp: handle Unicode domain names in DNSSL Feb 20, 2019
option_test.go ndp: handle Unicode domain names in DNSSL Feb 20, 2019
string.go ndp: use stringer to generate RouterSelectionPreference strings Jul 21, 2018

README.md

ndp builds.sr.ht status GoDoc Go Report Card

Package ndp implements the Neighbor Discovery Protocol, as described in RFC 4861. MIT Licensed.

The command ndp is a utility for working with the Neighbor Discovery Protocol.

Install the package and utility using go get:

$ go get github.com/mdlayher/ndp/...

To learn more about NDP, and how to use this package, check out my blog: Network Protocol Breakdown: NDP and Go.

Examples

Listen for incoming NDP messages on interface eth0 to one of the interface's global unicast addresses.

$ sudo ndp -i eth0 -a global listen
$ sudo ndp -i eth0 -a 2001:db8::1 listen

Send router solicitations on interface eth0 from the interface's link-local address until a router advertisement is received.

$ sudo ndp -i eth0 -a linklocal rs

Send neighbor solicitations on interface eth0 to a neighbor's link-local address until a neighbor advertisement is received.

$ sudo ndp -i eth0 -a linklocal -t fe80::1 ns

An example of the tool sending a router solicitation and receiving a router advertisement on the WAN interface of a Ubiquiti router:

$ sudo ndp -i eth1 -a linklocal rs
ndp> interface: eth1, link-layer address: 04:18:d6:a1:ce:b8, IPv6 address: fe80::618:d6ff:fea1:ceb8
ndp rs> router solicitation:
    - source link-layer address: 04:18:d6:a1:ce:b8

ndp rs> router advertisement from: fe80::201:5cff:fe69:f246:
    - hop limit:        0
    - flags:            [MO]
    - preference:       0
    - router lifetime:  2h30m0s
    - reachable time:   1h0m0s
    - retransmit timer: 0s
    - options:
        - prefix information: 2600:6c4a:7002:100::/64, flags: [], valid: 720h0m0s, preferred: 168h0m0s
You can’t perform that action at this time.