Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jsimonetti/rtnetlink
Package rtnetlink provides low-level access to the Linux rtnetlink API. MIT Licensed.
https://github.com/jsimonetti/rtnetlink
Last synced: 30 days ago
JSON representation
Package rtnetlink provides low-level access to the Linux rtnetlink API. MIT Licensed.
- Host: GitHub
- URL: https://github.com/jsimonetti/rtnetlink
- Owner: jsimonetti
- License: mit
- Created: 2016-12-28T22:00:14.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-11-01T09:00:15.000Z (about 1 month ago)
- Last Synced: 2024-11-01T09:31:03.746Z (about 1 month ago)
- Language: Go
- Homepage:
- Size: 621 KB
- Stars: 149
- Watchers: 6
- Forks: 37
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
rtnetlink ![Linux Integration](https://github.com/jsimonetti/rtnetlink/workflows/Go/badge.svg) [![GoDoc](https://godoc.org/github.com/jsimonetti/rtnetlink?status.svg)](https://pkg.go.dev/github.com/jsimonetti/rtnetlink/v2) [![Go Report Card](https://goreportcard.com/badge/github.com/jsimonetti/rtnetlink)](https://goreportcard.com/report/github.com/jsimonetti/rtnetlink)
=======Package `rtnetlink` allows the kernel's routing tables to be read and
altered. Network routes, IP addresses, Link parameters, Neighbor setups,
Queueing disciplines, Traffic classes and Packet classifiers may all be
controlled. It is based on netlink messages.A convenient, high-level API wrapper is available using package
[`rtnl`](https://godoc.org/github.com/jsimonetti/rtnetlink/rtnl).The base `rtnetlink` library explicitly only exposes a limited low-level API to
rtnetlink. It is not the intention (nor wish) to create an iproute2
replacement.### Debugging and netlink errors
Unfortunately the errors generated by the kernels netlink interface are
not very great.When in doubt about your message structure it can always be useful to
look at the message send by iproute2 using `strace -f -esendmsg /bin/ip`
or similar.Another (and possibly even more flexible) way would be using `nlmon` and
`wireshark`. nlmon is a special kernel module which allows you to
capture all netlink (not just rtnetlink) traffic inside the kernel. Be
aware that this might be overwhelming on a system with a lot of netlink
traffic.```
# modprobe nlmon
# ip link add type nlmon
# ip link set nlmon0 up
```At this point use wireshark or tcpdump on the nlmon0 interface to view
all netlink traffic.Have a look at the examples for common uses of rtnetlink.
If you have any questions or you'd like some guidance, please join us on
[Gophers Slack](https://invite.slack.golangbridge.org) in the `#networking`
channel!