doc.go 1.3 KB

123456789101112131415161718192021222324252627
  1. // Package rtnetlink allows the kernel's routing tables to be read and altered.
  2. // Network routes, IP addresses, Link parameters, Neighbor setups, Queueing disciplines,
  3. // Traffic classes and Packet classifiers may all be controlled.
  4. // It is based on netlink messages.
  5. //
  6. // A convenient, high-level API wrapper is available using package rtnl:
  7. // https://godoc.org/github.com/jsimonetti/rtnetlink/rtnl.
  8. //
  9. // The base rtnetlink library xplicitly only exposes a limited low-level API to rtnetlink.
  10. // It is not the intention (nor wish) to create an iproute2 replacement.
  11. //
  12. // When in doubt about your message structure it can always be useful to look at the
  13. // message send by iproute2 using 'strace -f -esendmsg' or similar.
  14. //
  15. // Another (and possibly even more flexible) way would be using 'nlmon' and wireshark.
  16. // nlmod is a special kernel module which allows you to capture all (not just rtnetlink)
  17. // netlink traffic inside the kernel. Be aware that this might be overwhelming on a system
  18. // with a lot of netlink traffic.
  19. //
  20. // # modprobe nlmon
  21. // # ip link add type nlmon
  22. // # ip link set nlmon0 up
  23. //
  24. // At this point use wireshark or tcpdump on the nlmon0 interface to view all netlink traffic.
  25. //
  26. // Have a look at the examples for common uses of rtnetlink.
  27. package rtnetlink