标签:ip add mode standard body bbb 接口 设备 gen ace
这个列表的分类和排序是由connman内部实现,没必要由使用它的用户来决定怎么去将网络排序之类的。用户的决定(比如链接WIFI、关闭以太网等等)会通过connman实现,与此同时connman会重新对列表中的网络服务进行排序。
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.
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.
ConnMan has a standard command line client connmanctl
. It can run in 2 modes:
connmanctl
command, just like systemctl.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.ConnMan will automatically handle wired connections.
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
.
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
You should now be connected to the network. Check using ip addr
or connmanctl state
.
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 agent
command. 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 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
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 }‘
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
标签:ip add mode standard body bbb 接口 设备 gen ace
原文地址:http://www.cnblogs.com/yongxo/p/7491097.html