انجمنهای فارسی اوبونتو
کمک و پشتیبانی => شبکه و سرویس دهندهها => نویسنده: mah-nil در 18 شهریور 1390، 12:11 قظ
-
لطفا یکی راهنمایی کنه چطور میتونم از کنسول (نه محیط گرافیکی) به یه شبکه وصل شم یا اصن بتونم مثلا شبکه های وایرلس ببینم و بهشون وصل شم
-
چون به احتمال زیاد اوبونتو استفاده میکنی پس برای شبکه NetworkManager نصب هست. nmcli کارت رو راه میندازه :)
NAME
nmcli - command-line tool for controlling NetworkManager
SYNOPSIS
nmcli [ OPTIONS ] OBJECT { COMMAND | help }
OBJECT := { nm | con | dev }
OPTIONS := {
-t[erse]
-p[retty]
-m[mode] tabular | multiline
-f[ields] <field1,field2,...> | all | common
-e[scape] yes | no
-v[ersion]
-h[elp]
}
DESCRIPTION
nmcli is a command-line tool for controlling NetworkManager and getting
its status. It is not meant as a replacement of nm-applet or other
similar clients. Rather it's a complementary utility to these pro‐
grams. The main nmcli's usage is on servers, headless machines or just
for power users who prefer the command line.
The use cases comprise:
— Initscripts: ifup/ifdown can utilize NetworkManager via nmcli
instead of having to manage connections itself and possibly inter‐
fere with NetworkManager.
— Servers, headless machines: No GUI is available; then nmcli can be
used to activate/deactivate connections. However, if a connection
requires a secret to activate and if that secret is not stored at
the system level, nmcli will not be able to activate it; it is cur‐
rently unable to supply the needed secrets to NetworkManager.
— User sessions: nmcli can be used activate/deactivate connections
from the command line, but a full NetworkManager client (like nm-
applet) is used for supplying secrets not stored at the system
level. Keyring dialogs and password prompts may appear if this
happens.
OPTIONS
-t, --terse
Output is terse. This mode is designed and suitable for com‐
puter (script) processing.
-p, --pretty
Output is pretty. This causes nmcli to produce easy readable
outputs for humans, i.e. values are aligned, headers are
printed, etc.
-m, --mode tabular | multiline
Switch between tabular and multiline output. If omitted,
default is tabular for most commands. For the commands produc‐
ing more structured information, that cannot be displayed on a
single line, default is multiline. Currenly, they are:
'nmcli con list id|uuid <name>'
'nmcli dev list'
tabular - Output is a table where each line describes a single
entry. Columns define particular properties of the entry.
multiline - Each entry comprises more lines, each property on
its own line. The values are prefixed with the property name.
-f, --fields <field1,field2,...> | all | common
This option is used to specify what fields (column names) should
be printed. Valid field names differ for specific commands.
List available fields by providing an invalid value to the
--fields option.
all is used to print all valid field values of the command.
common is used to print common field values of the command. If
omitted, default is common. The option is mandatory when
--terse is used. In this case, generic values all and common
cannot be used. (This is to maintain compatibility when new
fields are added in the future).
-e, --escape yes | no
Whether to escape ':' and '\' characters in terse tabular mode.
The escape character is '\'. If omitted, default is yes.
-v, --version
Show nmcli version.
-h, --help
Print help information.
OBJECT
nm NetworkManager
Use this object to inquire and change state of NetworkManager.
COMMAND := { status | enable | sleep | wifi | wwan }
status
Show overall status of NetworkManager. This is the
default action, when no command is provided to nm object.
Reference to D-Bus:
No simple reference.
enable [true|false]
Get networking-enabled status or enable/disable network‐
ing by NetworkManager. All interfaces managed by Net‐
workManager are deactivated when networking has been dis‐
abled.
Reference to D-Bus:
interface: org.freedesktop.NetworkManager
method: Enable
arguments: TRUE or FALSE
sleep [true|false]
Get sleep status or put to sleep/awake NetworkManager.
All interfaces managed by NetworkManager are deactivated
when it falls asleep. This command is not meant for user
to enable/disable networking, use enable for that. D-Bus
Sleep method is designed to put NetworkManager to sleep
or awake for suspending/resuming computer.
Reference to D-Bus:
interface: org.freedesktop.NetworkManager
method: Sleep
arguments: TRUE or FALSE
wifi [on|off]
Inquire or set status of WiFi in NetworkManager. Without
any further argument, WiFi status is printed; on enables
WiFi; off disables WiFi.
Reference to D-Bus:
No simple reference.
wwan [on|off]
Inquire or set status of WWAN in NetworkManager. Without
any further argument, WWAN status is printed; on enables
WWAN; off disables WWAN.
Reference to D-Bus:
No simple reference.
con Connections
Get information about NetworkManager's connections.
COMMAND := { list | status | up | down }
list [id <id> | uuid <id>]
List configured connections. Without a parameter, all
connections are listed. In order to get connection
details, id with connection's name or uuid with connec‐
tion's UUID shall be specified. When no command is given
to the con object, the default action is 'nmcli con
list'.
Reference to D-Bus:
No simple reference.
status
Print status of active connections.
Reference to D-Bus:
No simple reference.
up id <id> | uuid <id> [iface <iface>] [ap <hwaddr>] [--nowait]
[--timeout <timeout>]
Activate a connection. The connection is identified by
its name using id or UUID using uuid. For requiring par‐
ticular device to activate the connection on, iface
option with interface name should be given. ap option
can further concretize what AP should be used in case of
WiFi connection. --nowait option causes nmcli to exit
immediately and not to wait for command completion.
--timeout option provides a means to specify how long to
wait for operation completion.
Reference to D-Bus:
interface: org.freedesktop.NetworkManager
method: ActivateConnection
arguments: according to arguments
down id <id> | uuid <id>
Deactivate a connection. The connection is identified by
its name using id or UUID using uuid.
Reference to D-Bus:
interface: org.freedesktop.NetworkManager
method: DeactivateConnection
arguments: according to arguments
dev Devices
Get information about devices.
COMMAND := { status | list | disconnect | wifi }
status
Print status of devices. This is the default action,
when no command is specified to dev object.
Reference to D-Bus:
No simple reference.
list [iface <iface>]
Get detailed information about devices. Without an argu‐
ment, all devices are examined. To get information for a
specific device, iface argument with the interface name
should be provided.
Reference to D-Bus:
No simple reference.
disconnect iface <iface> [--nowait] [--timeout <timeout>]
Disconnect a device and prevent the device from automati‐
cally activating further connections without user/manual
intervention. --nowait option causes nmcli to exit imme‐
diately and not to wait for command completion. --time‐
out option provides a means to specify how long to wait
for operation completion.
Reference to D-Bus:
interface: org.freedesktop.NetworkManager.Device
method: Disconnect
arguments: none
wifi [list [iface <iface>] [hwaddr <hwaddr>]]
List available WiFi access points. iface and hwaddr
options can be used to get just APs for particular inter‐
face or specific AP, respectively.
Reference to D-Bus:
No simple reference.
ENVIRONMENT VARIABLES
nmcli's behavior is affected by the following environment variables.
LC_ALL If set to a non-empty string value, override the values of
all the other internationalization variables.
LC_MESSAGES Determines the locale to be used for internationalised
messages.
LANG Provides a default value for the internationalization
variables that are unset or null.
Notes about localization:
Be aware that nmcli is localized and that's why the output depends on
your environment. It's important to realize that especially when you
parse the output.
Call nmcli as LC_ALL=C nmcli to be sure the locale is set to "C" while
executing in a script.
LC_ALL, LC_MESSAGES, LANG variables specify the LC_MESSAGES locale cat‐
egory (in that order), which determines the language that nmcli uses
for messages. The "C" locale is used if none of these variables are
set, and this locale uses English messages.
EXIT STATUS
nmcli exits with status 0 if it succeeds, a value greater than 0 is
returned if errors occur.
0 Success - indicates the operation succeeded
1 Unknown or unspecified error
2 Invalid user input, wrong nmcli invocation
3 Timeout expired (see commands with --timeout option)
4 Connection activation failed
5 Connection deactivation failed
6 Disconnecting device failed
-
خیلی تشکر بابت راهنماییت فقط یه مشکلی که هست اینه که من توی dev وقتی wifi رو میزنم access point رو بهم نشون میده ولی تو قسمت con نمیتونم بهش وصل شم
از کجا میتونم id یا uuid رو پیدا کنم
با تشکر فراوان از وقتی که برای پاسخ دادن اختصاص میدین ;)
-
خیلی تشکر بابت راهنماییت فقط یه مشکلی که هست اینه که من توی dev وقتی wifi رو میزنم access point رو بهم نشون میده ولی تو قسمت con نمیتونم بهش وصل شم
از کجا میتونم id یا uuid رو پیدا کنم
با تشکر فراوان از وقتی که برای پاسخ دادن اختصاص میدین ;)
وقتی دستور nmcli را در ترمینال وارد کنید این خروجی را به شما میدهد:
Usage: nmcli [OPTIONS] OBJECT { COMMAND | help }
OPTIONS
-t[erse] terse output
-p[retty] pretty output
-m[ode] tabular|multiline output mode
-f[ields] <field1,field2,...>|all|common specify fields to output
-e[scape] yes|no escape columns separators in values
-n[ocheck] don't check nmcli and NetworkManager versions
-v[ersion] show program version
-h[elp] print this help
OBJECT
nm NetworkManager's status
c[onnection] NetworkManager's connections
d[evice] devices managed by NetworkManager
آبجکت C مشخصات کانکشن/ها را مثل نام(id) و UUID و ... را به ما خواهد داد.پس دستور nmcli c را وارد کنید.این هم صفحه man این رابط که همه ی این توضیحات و دستورات را گفته است:
http://crpppc19.epfl.ch/cgi-bin/man/man2html?1+nmcli (http://crpppc19.epfl.ch/cgi-bin/man/man2html?1+nmcli)
========
بهتر بود در نام تاپیک به جای کنسول از ترمینال استفاده میکردید،البته الان هم میتوانید تغییرش دهید.