Fork me on GitHub

Netlink Protocol Library Suite (libnl)


The libnl suite is a collection of libraries providing APIs to netlink protocol based Linux kernel interfaces.

Netlink is a IPC mechanism primarly between the kernel and user space processes. It was designed to be a more flexible successor to ioctl to provide mainly networking related kernel configuration and monitoring interfaces.


The interfaces are split into several small libraries to not force applications to link against a single, bloated library.

Core library implementing the fundamentals required to use the netlink protocol such as socket handling, message construction and parsing, and sending and receiving of data. This library is kept small and minimalistic. Other libraries of the suite depend on this library.
API to the configuration interfaces of the NETLINK_ROUTE family including network interfaces, routes, addresses, neighbours, and traffic control.
API to the generic netlink protocol, an extended version of the netlink protocol.
API to netlink based netfilter configuration and monitoring interfaces (conntrack, log, queue)


The easiest method of installing the libnl library suite is to use the existing packages of your linux distribution. See the table below for a list of available packages per distribution. Please note that the list may be out of date at times. Refer to the manual of your distribution for more information on how to install packages.

Distribution libnl-3.x libnl-2.x libnl-1.x
Source Package libnl-3.2.24.tar.gz No stable releases anymore libnl-1.1.4.tar.gz
CentOS Never packaged Never packaged 1.1
Package names: libnl, libnl-devel
Debian 3.2.7
Package names: libnl-3, libnl-3-dev, libnl-route-3-200, ...
1.99 (git snapshot)
Package names: libnl2, libnl2-dev, libnl2-doc, libnl2-dbg
Package names: libnl1, libnl1-dev, libnl1-doc
Fedora 3.2.13
Package names: libnl3
Never packaged 1.1
Package names: libnl, libnl-devel
OpenSUSE 3.2.12
Package names: libnl3, libnl3-devel, libnl-config, libnl-tools
Package names: libnl2_0
Package names: libnl-1, libnl-1_1-devel
Slackware Never packaged Never packaged 1.1
Package names: libnl-1.1
Ubuntu 3.2.3
Package names: libnl-3-200, libnl-3-200-dbg
1.99 (git snapshot)
Package names: libnl2, libnl2-dev, libnl2-doc, libnl2-dbg
Package names: libnl1, libnl-dev, libnl-doc

See the archives for specific older releases.

Known Bugs

Releases 3.2.18 and 3.2.19 have been shipped with an incorrect SONAME.

Release Notes

Version 3.2.24 has been released on Jan 21, 2014.

Important: 3.2.10 reverted an an uneeded SONAME bump that was done due to an ABI/API breakage in an unused API. After severe discussion, it was decided to undo the SONAME bump to make life easier for distribution maintainers by removing the unused APIs from the public header files and by providing compat header files that mistakenly included them.

If you linked against 3.2.18 or 3.2.19 your binary will not be compatible with >= 3.2.20. You will have to relink your binary. We are sorry for any inconvenience this may cause.

Changelog for 3.2.23 -> 3.2.24

Cong Wang (28):
      add ingress qdisc
      factor out rtnl_link_fill_info()
      add veth link support
      add link netns support
      factor out rtnl_link_info_parse()
      do not compile some address families when not available
      add initial tc action support
      add mirred tc action
      add u32 action support
      add u32 action test
      basic: add action support
      add veth.h into include/
      fix linux/pkt_act.h inclusion
      add fq_codel qdisc
      add fq_codel cli module
      fix rtnl_link_info_parse() and rtnl_link_fill_info()
      add a parameter to rtnl_link_veth_add()
      add declaration for rtnl_cls_change()
      fix a bug in rtnl_act_fill()
      rename rtnl_mirred_set_index() to rtnl_mirred_set_ifindex()
      add rtnl_mirred_get* functions
      u32: add action removal API
      basic: add action removal API
      fix some typo in lib/route/act.c
      add an assertion in rtnl_tc_set_link()
      add declaration for rtnl_basic_add_action()
      u32: add rtnl_u32_get_key()
      act: remove rtnl_act_alloc_cache()

HongweiBi (1):
      bridge: add rtnl_link_add_bridge() function

Jan Engelhardt (1):
      build: separate compiler and linker flags

Jiri Pirko (1):
      add support for IFA_FLAGS nl attribute

Olaf Hering (1):
      Remove extra memset from __nlmsg_alloc

Samuel Gauthier (1):
      The commit 6a8d90f5fec4 "attr: Allow attribute type 0" intended to     al

Thomas Graf (9):
      python: Include all files in distribution
      Merge pull request #50 from olafhering/olh_memset__nlmsg_alloc
      link: Fall back to global provisioned link cache if object is not a cache
      attr: Allow attribute type 0
      basic: Add missing declaration for rtnl_basic_add_action()
      basic: Declare rtnl_act in basic.h to silence warning
      Revert "basic: Declare rtnl_act in basic.h to silence warning"
      Revert "basic: Add missing declaration for rtnl_basic_add_action()"
      cache: Add missing declaration for nl_cache_find()

Thomas Haller (8):
      build: fix build failure when using different build dir (make distcheck)
      libnl-3.2.24-rc1 release
      route: add libnl name prefix to global variable link_policy
      addr: add address flag IFA_F_MANAGETEMPADDR
      addr: add address flag IFA_F_NOPREFIXROUTE
      python: fix build error for missing library_path in
      doc: fix typo in documentation
      libnl-3.2.24 release

Changelog for 1.1.3 -> 1.1.4

Emmanuel Roullit (1):
      Perform no operation on nl_object_free(NULL).

Emmanuel Thierry (1):
      Wrong calcultation in nla_reserve

Jiri Pirko (1):
      use MSG_TRUNC flag to get recv message size at once

Thomas Graf (2):
      1.1.4 release
      nl: Increase receive buffer size to 4 pages

Коренберг Марк (дома) (1):
      Fix leak of cb if nl_socket_alloc_cb() failed to allocate socket


Documentation tarball: libnl-doc-3.2.24.tar.gz

Library Developer's Guide API Reference Tutorials
Core Library (libnl) Core Library Developer's Guide API Reference
Routing Family (libnl-route) Routing Library Developer's Guide API Reference
Generic Netlink Family (libnl-genl) API Reference
Netfilter Family (libnl-nf) API Reference

Mailing List

Please post questions and patches to the libnl mailinglist

Visit the info page for more information and to subscribe to the list or checkout the archives.

Git Trees

3.x releases


1.1.x releases

Support for 1.1.x releases is limited, backports are only done upon request. Do not develop new applications based on libnl1 and consider porting your applications to libnl3