1. 程式人生 > >ConnMan連線管理守護程序

ConnMan連線管理守護程序

連線管理器(ConnMan)是一個連線管理守護程序(connmand),用於管理執行Linux作業系統的裝置中的Internet連線。它提供低記憶體消耗,並對網路條件變化進行快速,連貫,同步的反應。

ConnMan有各種外掛,是一個完全模組化的系統,可以擴充套件以支援各種有線或無線技術.外掛方法可以輕鬆適應和修改各種用例。諸如DHCP和域名解析之類的配置方法是使用外掛實現的。

所有應用程式都應該使用D-Bus與ConnMan進行通訊。它與嵌入式Yocto構建系統一起使用,是GENIVI車載資訊娛樂規範的一部分。

ConnMan根據GPL v2.0許可證分發。英特爾是ConnMan專案的主要貢獻者。

ConnMan體系結構

image

ConnMan內部基礎設施

image

功能和特點

以下功能內置於連線管理器中:

  • 通用外掛基礎結構
  • 裝置和網路抽象(具有基本的儲存支援)
  • IPv4,IPv4-LL(鏈路本地)和DHCP - IPv6,DHCPv6和6to4隧道
  • 高階路由和DNS配置
  • 內建DNS代理和智慧快取
  • 內建WISPr熱點登入和門戶檢測
  • 時間和時區配置(使用NTP進行手動和自動)
  • 代理處理(手動和自動使用WPAD)
  • 共享支援(USB,藍芽和WiFi AP模式)
  • 詳細的統計處理(家庭和漫遊)

各種外掛可以啟用網路支援:

  • 乙太網外掛
  • WiFi外掛與WEP40 / WEP128和WPA / WPA2(個人和企業)
  • 藍芽外掛(使用BlueZ)
  • 2G /3G / 4G外掛(使用oFono)

Pugins還提供其他功能:

  • 環回介面設定
  • PACrunner代理處理
  • PolicyKit授權支援

Connman D-BUS介面

D-Bus interfaces

  • 應用程式應該使用D-Bus與ConnMan進行通訊。
  • 主要入口點是通過管理器物件。
  • Manager物件包含對服務物件的引用(介面)。
  • 其他介面包括VPN,時鐘,任務,技術,會話,通知,對等,代理和計數器。

itemeditorimage_59ee6627ea6f6.png

管理D-BUS介面

  • 應用程式入口點是管理器物件
  • 所有的方法和屬性都有解釋

itemeditorimage_59ee666c6571e.png

管理屬性

檢索所有全域性屬性的簡單方法如下所示:

  • bus = dbus.SystemBus()
  • manager = dbus.Interface(bus.get_object("net.connman", "/"), "net.connman.Manager")
  • properties = manager.GetProperties()

更改全域性屬性也很簡單。例如,啟用所謂的離線模式(AKA飛航模式)就足以設定該屬性: manager.SetProperty("OfflineMode", dbus.Boolean(1)).

itemeditorimage_59ee66d54b14f.png

服務介面

先進的介面使使用者介面可以輕鬆訪問網路細節和使用者選擇的偏好。這是服務列表和介面。ConnMan維護一個單一的平面和所有可用服務的排序列表。

image

服務順序

image

服務狀態

  • 每項服務的基本狀態都是“閒置”。這意味著此服務目前尚未使用。它也不是試圖連線或做任何事情。
  • “關聯”狀態表示該服務試圖建立與網路的低階連線 - 例如,與WiFi接入點關聯/連線。
  • 在“配置”狀態下,該服務表明它正在嘗試檢索/配置IP設定。
  • “就緒”狀態表示成功連線的裝置。這並不意味著它具有預設路由,但基本的IP操作將會成功。
  • 在“斷開”狀態下,服務指示它將要終止當前連線並返回到“空閒”狀態。
  • 另外,“失敗”狀態表示錯誤的行為。由於服務未連線,因此與“空閒”狀態類似。

image

服務D-Bus介面

以下是如何獲取服務物件:

-properties = manager.GetProperties()
-for path in properties["Services"]:
service = dbus.Interface(bus.get_object("net.connman", path), "net.connman.Service")

它還包含連線或斷開特定服務的方法。ConnMan還可以根據他的策略或通過外部事件(如插入乙太網電纜)自動連線服務。手動連線(或斷開)特定服務就像告訴它一樣簡單。

connect: service.Connect() or service.Disconnect()

image

服務屬性

image

技術介面

基本的裝置配置任務由技術介面完成。例如,開啟和關閉裝置(例如通過RFKILL)應通過技術介面完成。

 

image

技術屬性

使用者可以通過Manager OfflineMode屬性啟用離線(飛行)模式。在離線模式下,包括乙太網在內的所有技術均關閉。在離線模式下,使用者可以使用rfkill命令或某些膝上型電腦中的Fn-Fx組合鍵,通過Technology Powered屬性臨時啟用單個技術。

 

image

Connman內部

啟動connmand

選項:

-c, --config=FILE             Load the specified configuration file instead of /usr/local/etc/connman/main.conf
-d, --debug=DEBUG             Specify debug options to enable
-i, --device=DEV              Specify networking device or interface
-I, --nodevice=DEV            Specify networking interface to ignore
-p, --plugin=NAME,...         Specify plugins to load
-P, --noplugin=NAME,...       Specify plugins not to load
-W, --wifi=NAME               Specify driver for WiFi/Supplicant
-n, --nodaemon                Don't fork daemon to background
-r, --nodnsproxy              Don't enable DNS Proxy
--nobacktrace                 Don't print out backtrace information

用法示例:

# CONNMAN_SUPPLICANT_DEBUG=1 connmand -n -d &> connman.log
#connmand -i wlan0 -I eth0 --nodnsproxy --nodaemon >& connman.log

主要配置檔案

main.conf

InputRequestTimeout = 120 (default)---------> input request ( ex. passphrase) timeout
BrowserLaunchTimeout = 300 ( default) -----> The request for launching a browser for portal pages
BackgroundScanning = true --------------------> option for background scanning
FallbackTimeservers = --------------------------> List of fallback timeservers ( used by NTP sync) separated by ","
FallbackNameservers = -------------------------> List of fallback nameservers
DefaultAutoConnectTechnologies = -----------> List of technologies that are marked autoconnectable by default.
PreferredTechnologies = ------------------------> List of preferred technologies from - most preferred one to least preferred
NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb,ve-,vb-   ---> List of blacklisted network interfaces 
AllowHostnameUpdates = true -----------------> Allow connman to change the system hostname ( ex. dhcp hostname option)
SingleConnectedTechnology = false -----------> Keep only a single connected technology at any time
TetheringTechnologies = wifi,bluetooth,gadget
PersistentTetheringMode = false --------------> Restore earlier tethering status when returning from offline mode
Enable6to4 = false ------------------------------> Automatically enable Anycast 6to4 if possible (not recommended. see RFC6343 )
EnableOnlineCheck = false --------------------> Enable use of http get as on online status check
AlwaysConnectedTechnologies = -------------> List of technologies with AutoConnect = true which are always connected regardless of PreferredTechnologies setting

Connman配置檔案

Connman使用配置檔案來調配現有服務。Connman將在/ var / lib / connman /下查詢它的配置檔案。配置檔名稱不得包含除字母或數字之外的其他字元,並且必須具有.config字尾。

Ex.      #cat /var/lib/connman/example.config
[global]
Name = Example
Description = Example network configuration

[service_home_ethernet]
Type = ethernet
IPv4 = 192.168.1.42/255.255.255.0/192.168.1.1
IPv6 = 2001:db8::42/64/2001:db8::1
MAC = 01:02:03:04:05:06
Nameservers = 10.2.3.4,192.168.1.99
SearchDomains = my.home,isp.net
Timeservers = 10.172.2.1,ntp.my.isp.net
Domain = my.home

[service_home_wifi]
Type = wifi
Name = my_home_wifi
Passphrase = secret
IPv4 = 192.168.2.2/255.255.255.0/192.168.2.1
MAC = 06:05:04:03:02:01Ex.      #cat /var/lib/connman/example.config
[global]
Name = Example
Description = Example network configuration

[service_home_ethernet]
Type = ethernet
IPv4 = 192.168.1.42/255.255.255.0/192.168.1.1
IPv6 = 2001:db8::42/64/2001:db8::1
MAC = 01:02:03:04:05:06
Nameservers = 10.2.3.4,192.168.1.99
SearchDomains = my.home,isp.net
Timeservers = 10.172.2.1,ntp.my.isp.net
Domain = my.home

[service_home_wifi]
Type = wifi
Name = my_home_wifi
Passphrase = secret
IPv4 = 192.168.2.2/255.255.255.0/192.168.2.1
MAC = 06:05:04:03:02:01

設定

設定和配置檔案會自動為使用者經常連線的網路建立。

# cat /var/lib/connman/settings 

[global]

OfflineMode=false

[WiFi]

Enable=true

Tethering=false

[Bluetooth]

Enable=false

Tethering=false

配置檔案設定儲存在/ var / lib / connman /目錄下的服務名稱下。VPN設定可以在/ var / lib / connman-vpn /中找到。

編寫外掛

基本外掛包含通過CONNMAN_PLUGIN_DEFINE的外掛描述以及通過該描述定義的init / exit回撥。

#include <connman/plugin.h>

static int example_init(void)
{
    return 0;
}

static void example_exit(void)
{
}

CONNMAN_PLUGIN_DEFINE(example, "Example plugin", CONNMAN_VERSION,
                        example_init, example_exit)

外掛使用技術,網路和裝置以及其他基礎設施與ConnMan的核心功能進行互動。這裡是技術基礎設施:

ex. bluetooth plugin
    static struct connman_technology_driver tech_driver = {
        .name           = "bluetooth",
        .type           = CONNMAN_SERVICE_TYPE_BLUETOOTH,
        .probe          = bluetooth_tech_probe,
        .remove         = bluetooth_tech_remove,
        .set_tethering  = bluetooth_tech_set_tethering,
    };

為了使Connection Manager知道新的Technology外掛,我們需要通過呼叫connman_technology_driver_register()來註冊它的驅動程式。

connman_technology_driver_register(&tech_driver);

裝置基礎設施

裝置代表給定技術的真實裝置。每種技術可能有很多裝置。

static struct connman_device_driver device_driver = {
        .name           = "bluetooth",
        .type           = CONNMAN_DEVICE_TYPE_BLUETOOTH,
        .probe          = bluetooth_device_probe,
        .remove         = bluetooth_device_remove,
        .enable         = bluetooth_device_enable,
        .disable        = bluetooth_device_disable,
    };

要註冊驅動程式:

connman_device_driver_register(&device_driver);

此外,需要為每個外掛編寫處理新裝置檢測的程式碼;藍芽外掛通過註冊BlueZ D-Bus介面的觀察器來實現。一旦出現新的藍芽裝置,外掛需要通過呼叫connman_device_create()來通知ConnMan核心。對於藍芽外掛,通話將是:

struct connman_device *device;
 device = connman_device_create("bluetooth", CONNMAN_DEVICE_TYPE_BLUETOOTH)

網路基礎設施

連線管理器提供了一種外掛來處理為每種型別的技術建立/處理連線的細節。對於藍芽外掛,需要註冊connman_network_driver:

    static struct connman_network_driver network_driver = {
        .name           = "bluetooth",
        .type           = CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN,
        .probe          = bluetooth_pan_probe,
        .remove         = bluetooth_pan_remove,
        .connect        = bluetooth_pan_connect,
        .disconnect     = bluetooth_pan_disconnect,
    };

然後,呼叫註冊函式:

 connman_network_driver_register(&network_driver);

Connman原始檔/基礎設施

在執行主迴圈之前,init函式將在src / main.c中呼叫。

src/util.c - /dev/urandom support
src/inotify.c - used by the core (config.c) and the session policy plugin
src/technology.c – used for technology interface
src/notifier.c – basic notifier infrastructure
src/agent.c – agent interface
src/service.c – used for service interface
src/peer_service.c – p2p peer service API
src/peer.c – p2p peer object’s core logic
src/provider.c – provider infrastructure
src/network.c – network infrastructure used by plug-ins
src/config.c – framework for configuration files
src/device.c – device infrastructure used by plug-ins
src/iptables.c – iptables support (netfilter chains and rules)
src/firewall-iptables.c, nftables.c (older firewall.c) – firewall infrastructure.
src/nat.c – used for NAT
src/tethering.c  – tethering infrastructure
src/manager.c – Manager interface
src/stats.c – used for storing service stats ( mmaped into memory)
src/ipconfig.c – IP configuration framework
src/rtnl.c – netlink support
src/session.c – Allows 3rd party applications to request a network session 
src/resolver.c – resolver framework
src/dhcp.c, dhcpv6.c – dhcp framework
src/rfkill.c – rfkill interface support
src/machine.c -  basic systemd-hostnamed ( machine-type- “chassis”) support

Connmanctl

ConnMan有一個標準的命令列客戶端connmanctl。它可以執行在兩種模式下:

  • 在命令模式下,命令作為connmanctl命令的引數輸入,就像systemctl一樣。
  • 通過輸入不帶引數的connmanctl來啟動互動模式。提示將變為connmanctl>,表示它正在等待使用者命令,就像python互動模式一樣。

Connmanctl例子

示例1. 啟用和禁用WiFi

$ connmanctl technologies - check for the line that says Powered: True/False. 
$ connmanctl enable wifi - To power the wifi on.
$ connmanctl disable wifi – To power off the wifi.

其他啟用wifi的方式可能包括 - ip link set <interface>向上。ConnMan將自動處理有線連線。

示例2. 連線到一個開放的接入點

本節中的命令顯示如何在命令模式下執行connmanctl。掃描網路connmanctl接受稱為技術的簡單名稱。掃描附近的WiFi網路:

$ connmanctl scan wifi To list the available networks found after a scan run (example output): 
$ connmanctl services 
*AO MyNetwork wifi_dc85de828967_68756773616d_managed_psk OtherNET wifi_dc85de828967_38303944616e69656c73_managed_psk AnotherOne wifi_dc85de828967_3257495245363836_managed_wep FourthNetwork wifi_dc85de828967_4d7572706879_managed_wep AnO6penNetwork wifi_dc85de828967_4d6568657272696e_managed_none 
$ connmanctl connect wifi_dc85de828967_4d6568657272696e_managed_none

您現在應該連線到網路。使用ip addr或connmanctl狀態進行檢查。

示例3. 連線到受保護的接入點
對於受保護的訪問點,向ConnMan守護程序提供一些資訊,至少一個密碼。

$ connmanctl
connmanctl> scan wifi ----- To list services: 
connmanctl> services 
connmanctl> agent on --- register the agent to handle user requests.
connmanctl> connect wifi_dc85de828967_38303944616e69656c73_managed_psk 

代理程式要求獲取更多資訊,具體取決於您要連線的網路型別。該代理還將列印有關其所需資訊的其他資料,如以下示例中所示。

Agent RequestInput wifi_dc85de828967_38303944616e69656c73_managed_psk Passphrase = [ Type=psk, Requirement=mandatory ] Passphrase?

提供請求的資訊(在本例中為密碼),然後鍵入:

connmanctl> quit

如果您提供的資訊是正確的,您現在應該連線到受保護的接入點。

Connmanctl其他用法

ConnMan將各種硬體介面稱為Technologies。要列出可用技術,請執行:

$ connmanctl technologies

技術可以通過以下方式開啟/關閉:

$ connmanctl enable technology_type

$ connmanctl disable technology_type 

例如,要關閉WiFi:

$ connmanctl disable wifi

ConnMan測試指令碼

Connman還提供了基本的Python指令碼(例如test-connman,list-services等)。諸如連線,斷開連線,自動連線,服務,掃描,啟用,禁用,離線模式,狀態等基本操作均通過這些指令碼得到支援。

ConnMan 除錯

啟用除錯

我們可以使用-d命令列選項在ConnMan中啟用除錯列印。

-d Activate all normal debug prints 
-d src/service.c This prints debugging info from src/service.c file only
-d src/network.c:src/ipconfig.c This activates debug prints in src/network.c and src/ipconfig.c files. 
-d 'src/n*.c' This would activate debug print from all the C source files starting with letter 'n' in src directory. Note the quotation marks around option, that is to prevent shell expansion. 
-d '*/n*.c:*/i*.c' Activate debug prints for all C source files starting with letters 'n' or 'i' in any sub-directory. 

子元件除錯

ConnMan的某些元件具有環境變數啟用的除錯列印。如果設定了環境變數,那麼相應的元件會列印一些額外的除錯資訊。

可以使用以下環境變數:

  • CONNMAN_DHCP_DEBUG:與DHCPv4相關的除錯資訊
  • CONNMAN_DHCPV6_DEBUG:與DHCPv6相關的除錯資訊
  • CONNMAN_IPTABLES_DEBUG:使用iptables時的額外資訊
  • CONNMAN_RESOLV_DEBUG:名稱解析器除錯列印。當ConnMan解析自己使用的主機名時使用這些除錯列印。請注意,DNS代理除錯列印不使用此環境變數。為此,可以使用“-d src / dnsproxy.c”命令列選項。
  • CONNMAN_SUPPLICANT_DEBUG:除錯connmand和wpa_supplicant程序之間的通訊列印。
  • CONNMAN_WEB_DEBUG:ConnMan在Wispr和6to4元件中進行Internet連線檢查時的除錯資訊。

例如:

CONNMAN_SUPPLICANT_DEBUG=1 src/connmand -n

示例:獲取CONNMAN_IPTABLES_DEBUG日誌

確保在核心中啟用iptables支援:

#zcat /proc/config.gz | grep "CONFIG_IP_NF_IPTABLES"

在核心中必須啟用Iptables:

CONFIG_IP_NF_IPTABLES=m or CONFIG_IP_NF_IPTABLES=y

清除所有iptable過濾器:

# iptables –F

在iptable規則下面設定以過濾ICMP資料包(輸入,輸出和轉發資料包):

# iptables -t filter -A INPUT -p icmp --icmp-type echo-request -j LOG --log-prefix="filter INPUT:"

# iptables -t filter -A INPUT -p icmp --icmp-type echo-reply -j LOG --log-prefix="filter INPUT:“

# iptables -t filter -A OUTPUT -p icmp --icmp-type echo-request -j LOG --log-prefix="filter OUTPUT:“

# iptables -t filter -A OUTPUT -p icmp --icmp-type echo-reply -j LOG --log-prefix="filter OUTPUT:“

# iptables -t filter -A FORWARD -p icmp --icmp-type echo-request -j LOG --log-prefix="filter FORWARD:“

# iptables -t filter -A FORWARD -p icmp --icmp-type echo-reply -j LOG --log-prefix="filter FORWARD:"

匯出下面的環境變數來啟用ConnMan的iptables除錯:

# export CONNMAN_IPTABLES_DEBUG=1

Start Connmand Connection Manager with debug option enabled:

# /usr/sbin/connmand -d -n -I eth0 

ConnMan守護程序訊息日誌應該在涉及ICMP資料包時顯示。

ConnMan

   Connection Manager簡稱connman,connman是使用d-bus做為程序間通訊機制來管理Linux網路連結的一種軟體。在connman的d-bus介面中,有一個介面叫做service。該介面的全稱為:net.connman.Service,自然是掛在net.connman上面的。做為net.connman.Service介面,它可以訪問到network的細節以及使用者偏好使用什麼型別的網路(比如3g、wifi、wimax等等)。外部的程式就通過net.connman.Service的一堆Properties和Methods來實現它基本的功能。(可能詮釋的不對,可能是整體的connman的功能)
        核心的邏輯如下:connman維護一個訊號標記並且將所有可能連線上的網路服務建成一個列表(分類成普通網路、使用者喜歡的以及上次使用的網路)。做為網路服務,它可以是乙太網裝置,WIFI,WIMAX,或者是遠端藍芽裝置(比如手機)。

        這個列表的分類和排序是由connman內部實現,沒必要由使用它的使用者來決定怎麼去將網路排序之類的。使用者的決定(比如連結WIFI、關閉乙太網等等)會通過connman實現,與此同時connman會重新對列表中的網路服務進行排序。

Related articles

ConnMan is a command-line network manager designed for use with embedded devices and fast resolve times. It is modular through a plugin architecture, but has native DHCP and NTP support.

Contents

Installation

Install the connman package. wpa_supplicant and bluez are optional dependencies required for Wi-Fi and Bluetooth functionality respectively.

Before enabling connman.service, ensure any existing network configuration is disabled.

Desktop clients

  • cmst — Qt GUI for ConnMan.

https://github.com/andrew-bibb/cmst || cmstAUR

  • connman-ncurses — Simple ncurses UI for ConnMan; not all of connman functionality is implemented, but usable (with X or from terminal without X), see the wiki.

https://github.com/eurogiciel-oss/connman-json-client || connman-ncurses-gitAUR

  • connman-notify — Connman event notification client

https://github.com/wavexx/connman-notify || connman-notifyAUR[broken link: archived in aur-mirror]

  • ConnMan-UI — GTK3 client applet.

https://github.com/tbursztyka/connman-ui || connman-ui-gitAUR

  • connman_dmenu — Client/frontend for dmenu.

https://github.com/taylorchu/connman_dmenu || connman_dmenu-gitAUR

  • Econnman — Enlightenment desktop panel applet.

http://www.enlightenment.org || econnmanAUR

  • LXQt-Connman-Applet — LXQt desktop panel applet.

https://github.com/surlykke/lxqt-connman-applet || lxqt-connman-applet-gitAUR

  • qconnman-ui — Qt management interface used on O.S. Systems products

https://github.com/OSSystems/qconnman-ui || qconnman-ui-gitAUR[broken link: archived in aur-mirror]

  • connman-gtk — GTK client.

https://github.com/jgke/connman-gtk || connman-gtkAUR

  • gnome-extension-connman — Gnome3 extension for connman; it contains only some of the functionality without installing connman-gtk.

https://github.com/jgke/gnome-extension-connman || https://extensions.gnome.org/extension/981/connman-extension/

Usage

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Only Wired and Wi-Fi plugins are described. (Discuss in Talk:ConnMan#)

ConnMan has a standard command line client connmanctl. It can run in 2 modes:

  • In command mode commands are entered as arguments to connmanctl command, just like systemctl.
  • Interactive mode is started by typing connmanctl without arguments. Prompt will change to connmanctl> to indicate it is waiting for user commands, just like python interactive mode. The interactive mode supports tab completion, which makes finding the correct connection easy.

Wired

ConnMan will automatically handle wired connections.

Wi-Fi

Enabling and disabling wifi

To check if wifi is enabled you can run connmanctl technologies and check for the line that says Powered: True/False. To power the wifi on you can run connmanctl enable wifi or if you need to disable it you can run connmanctl disable wifi. Other ways to enable wifi could include using the Fn keys on the laptop to turn it on or running ip link set <interface> up.

Connecting to an open access point

The commands in this section show how to run connmanctl in command mode.

To scan the network connmanctl accepts simple names called technologies. To scan for nearby Wi-Fi networks:

$ connmanctl scan wifi

To list the available networks found after a scan run (example output):

$ connmanctl services
*AO MyNetwork               wifi_dc85de828967_68756773616d_managed_psk
    OtherNET                wifi_dc85de828967_38303944616e69656c73_managed_psk 
    AnotherOne              wifi_dc85de828967_3257495245363836_managed_wep
    FourthNetwork           wifi_dc85de828967_4d7572706879_managed_wep
    AnOpenNetwork           wifi_dc85de828967_4d6568657272696e_managed_none

To connect to an open network, use the second field beginning with wifi_:

$ connmanctl connect wifi_dc85de828967_4d6568657272696e_managed_none

Tip: Network names can be tab-completed.

You should now be connected to the network. Check using ip addr or connmanctl state.

Connecting to a protected access point

For protected access points you will need to provide some information to the ConnMan daemon, at the very least a password or a passphrase.

The commands in this section show how to run connmanctl in interactive mode, it is required for running the agentcommand. To start interactive mode simply type:

$ connmanctl

You then proceed almost as above, first scan for any Wi-Fi technologies:

connmanctl> scan wifi

To list services:

connmanctl> services

Now you need to register the agent to handle user requests. The command is:

connmanctl> agent on

You now need to connect to one of the protected services. To do this easily, just use tab completion for the wifi_ service. If you were connecting to OtherNET in the example above you would type:

connmanctl> connect wifi_dc85de828967_38303944616e69656c73_managed_psk

The agent will then ask you to provide any information the daemon needs to complete the connection. The information requested will vary depending on the type of network you are connecting to. The agent will also print additional data about the information it needs as shown in the example below.

Agent RequestInput wifi_dc85de828967_38303944616e69656c73_managed_psk
  Passphrase = [ Type=psk, Requirement=mandatory ]
  Passphrase?  

Provide the information requested, in this example the passphrase, and then type:

connmanctl> quit

If the information you provided is correct you should now be connected to the protected access point.

Settings

Settings and profiles are automatically created for networks the user connects to often. They contain fields for the passphrase, essid and other information. Profile settings are stored in directories under /var/lib/connman/ by their service name. To view all network profiles run this command from root shell:

# cat /var/lib/connman/*/settings

Note: VPN settings can be found in /var/lib/connman-vpn/.

Technologies

Various hardware interfaces are referred to as Technologies by ConnMan.

To list available technologies run:

$ connmanctl technologies

To get just the types by their name one can use this one liner:

$ connmanctl technologies | awk '/Type/ { print $NF }'

Note: The field Type = tech_name provides the technology type used with connmanctl commands

To interact with them one must refer to the technology by type. Technologies can be toggled on/off with:

$ connmanctl enable technology_type

and:

$ connmanctl disable technology_type

For example to toggle off wifi:

$ connmanctl disable wifi

Warning: connman grabs rfkill events. It is most likely impossible to use rfkill or bluetoothctl to (un)block devices, yet hardware keys may still work.[1] Always use connmanctl enable|disable

Email:[email protected]


作者:程式手藝人
連結:https://www.jianshu.com/p/63a3f9841702
來源:簡書
簡書著作權歸作者所有,任何形式的轉載都請聯絡作者獲得授權並註明出處。