Code Monkey home page Code Monkey logo

ndpresponder's Introduction

IPv6 Neighbor Discovery Responder

GitHub Workflow Status GitHub code size

ndpresponder is a Go program that listens for ICMPv6 neighbor solicitations on a network interface and responds with neighbor advertisements, as described in RFC 4861 - IPv6 Neighbor Discovery Protocol.

This program differs from ndppd - NDP Proxy Daemon in that the source IPv6 address of neighbor advertisement is set to the same value as the target address in the neighbor solicitation. This change enables ndpresponder to work in certain KVM virtual servers where NDP uses link-local addresses but ebtables drops outgoing packets from link-local addresses. See my blog post for more information.

Installation

This program is written in Go. You can compile and install this program with:

go install github.com/yoursunny/ndpresponder@main

This program is also available as a Docker container:

docker build -t localhost/ndpresponder 'github.com/yoursunny/ndpresponder#main'
docker run -d --name localhost/ndpresponder --network host ndpresponder [arguments]

Static Mode

The program can respond to neighbor solicitations for any address under one or more subnets. It's recommended to keep the subnets as small as possible.

Sample command:

sudo ndpresponder -i eth0 -n 2001:db8:3988:486e:ff2f:add3:31e3:7b00/120
  • -i flag specifies the network interface name.
  • -n flag specifies the IPv6 subnet to respond to. You may repeat this flag to specify multiple subnets.

Docker Network Mode

The program can respond to neighbor solicitations for assigned addresses in Docker networks. When a container connects to a network, it attempts to inform the gateway router about the presence of a new address.

Sample command:

docker network create --ipv6 --subnet=172.26.0.0/16 \
  --subnet=2001:db8:1972:beb0:dce3:9c1a:d150::/112 ipv6exposed

docker run -d \
  --restart always --cpus 0.02 --memory 64M \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  --cap-drop=ALL --cap-add=NET_RAW --cap-add=NET_ADMIN \
  --network host --name ndpresponder \
  localhost/ndpresponder -i eth0 -N ipv6exposed
  • -i flag specifies the network interface name.
  • -N flag specifies the Docker network name. You may repeat this flag to specify multiple networks.

Other Options

You may change log level of this program by setting the NDPRESPONDER_LOG environment variable. Acceptable values are DEBUG, INFO, WARN, ERROR, and FATAL.

Sample command:

sudo NDPRESPONDER_LOG=WARN ndpresponder [arguments]
docker run -e NDPRESPONDER_LOG=WARN [other arguments]

ndpresponder's People

Contributors

yoursunny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ndpresponder's Issues

compile error: undefined: pageSize

$ go install github.com/yoursunny/ndpresponder@main
go: downloading github.com/yoursunny/ndpresponder v0.0.0-20230624195751-4500a2591d01
go: downloading github.com/urfave/cli/v2 v2.25.7
go: downloading github.com/google/gopacket v1.1.19
go: downloading github.com/fsouza/go-dockerclient v1.9.7
go: downloading github.com/vishvananda/netlink v1.2.1-beta.2
go: downloading go.uber.org/zap v1.24.0
go: downloading golang.org/x/net v0.11.0
go: downloading golang.org/x/sys v0.9.0
go: downloading inet.af/netaddr v0.0.0-20230525184311-b8eac61e914a
go: downloading github.com/docker/docker v24.0.2+incompatible
go: downloading github.com/docker/go-units v0.5.0
go: downloading github.com/moby/patternmatcher v0.5.0
go: downloading github.com/vishvananda/netns v0.0.4
go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.2
go: downloading github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673
go: downloading go.uber.org/atomic v1.11.0
go: downloading go.uber.org/multierr v1.11.0
go: downloading go4.org/intern v0.0.0-20230525184215-6c62f75575cb
go: downloading github.com/russross/blackfriday/v2 v2.1.0
go: downloading github.com/opencontainers/image-spec v1.1.0-rc3
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/containerd/containerd v1.7.2
go: downloading github.com/klauspost/compress v1.16.6
go: downloading github.com/moby/sys/sequential v0.5.0
go: downloading github.com/sirupsen/logrus v1.9.3
go: downloading github.com/moby/term v0.5.0
go: downloading github.com/morikuni/aec v1.0.0
go: downloading github.com/docker/go-connections v0.4.0
go: downloading github.com/gogo/protobuf v1.3.2
go: downloading github.com/opencontainers/runc v1.1.7
go: downloading go4.org/unsafe/assume-no-moving-gc v0.0.0-20230525183740-e7c30c78aeb2
go: downloading github.com/opencontainers/go-digest v1.0.0
# github.com/google/gopacket/afpacket
go/pkg/mod/github.com/google/[email protected]/afpacket/options.go:176:19: undefined: pageSize
go/pkg/mod/github.com/google/[email protected]/afpacket/options.go:177:85: undefined: pageSize

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.