惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
J
Java Code Geeks
The GitHub Blog
The GitHub Blog
博客园_首页
U
Unit 42
人人都是产品经理
人人都是产品经理
Engineering at Meta
Engineering at Meta
IT之家
IT之家
G
Google Developers Blog
L
LangChain Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
爱范儿
爱范儿
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
Jina AI
Jina AI
有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
小众软件
小众软件
H
Help Net Security

NetworkManager

NetworkManager 1.58 NetworkManager 1.54 NetworkManager 1.52 Protect your VPN from TunnelVision attacks NetworkManager 1.50 Addressing hostname assignment in NetworkManager 1.40 Help NetworkManager project to triage issues NetworkManager 1.48 NetworkManager 1.46 NetworkManager 1.44 NetworkManager 1.42 Set up NMCI on Fedora Linux VM Using Python and NetworkManager to control the network [link] Notes on D-Bus NetworkManager 1.40 NetworkManager 1.38 From ifcfg to keyfiles [link] NetworkManager 1.36 NetworkManager 1.34 NetworkManager 1.32 NetworkManager 1.30 Initscripts’ ifcfg-rh Format in NetworkManager and its Future [link] How to set up your NetworkManager environment [link] NetworkManager 1.28 [link] Looking forward to Linux network configuration in the initial ramdisk (initrd) [link] NetworkManager 1.26 [link] Internet connection sharing with NetworkManager [link] Why NetworkManager? [link] Please welcome: NetworkManager 1.20 [link] Becoming friends with NetworkManager [link]
Resources for developers
2001-01-01 · via NetworkManager

D-Bus API

NetworkManager provides a D-Bus interface on the system bus. You can use this interface to query network state and the details of network interfaces like current IP addresses or DHCP options, and to activate, deactivate, created, edit, and delete saved network connections.

Check the D-Bus API reference: STABLE DEVEL

libnm API

libnm wraps the D-Bus API in easy-to-use GObjects and is often much simpler for glib-based applications to use.

libnm’s API provides two core aspects. One is NMConnection and NMSetting types, which help handling NetworkManager’s connection profiles. The other is NMClient, which is a cache of the D-Bus objects from D-Bus API.

Check the libnm API reference: STABLE DEVEL

This is a simple example on how to print existing connections in Python using GObject introspection:

#!/usr/bin/python3

# GObject-introspection is needed to call libnm from python
import gi
gi.require_version("NM", "1.0")
from gi.repository import NM

def print_values(setting, key, value, flags, data):
    print("     {}.{}: {}".format(setting.get_name(), key, value))

# Create the client object. This automatically loads all the D-Bus
# tree and creates in-memory objects for connections, devices, access
# points, etc.
client = NM.Client.new(None)

# Obtain a list of connection profiles ...
connections = client.get_connections()

# ... and print their properties
for c in connections:
    print("{}:".format(c.get_id()))
    c.for_each_setting_value(print_values, None)
    print("\n")

Examples

Examples in Python and other languages are available in the NetworkManager git tree.

Release Numbering

Major NetworkManager releases are numbered 1.y.0, with y being an even number. For example, 1.0.0, 1.2.0, …, 1.18.0.

Minor stable releases are numbered 1.y.z, with y and z being even numbers. For example 1.4.2, 1.18.2.

Development snapshots from the upstream main branch are numbered 1.y.z with y being an odd number. This is the development for the upcoming stable release 1.$((y+1)).0. Such snapshots don’t guarantee a stable API and have less testing. Use with care.