From e156ecf77804e1661f6625c3d9dac3a81cbf37f2 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 25 Aug 2015 10:16:45 +0800 Subject: [PATCH] translated --- ... NetworkManager Command Line Tool Nmcli.md | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) rename {sources => translated}/tech/20150824 Basics Of NetworkManager Command Line Tool Nmcli.md (62%) diff --git a/sources/tech/20150824 Basics Of NetworkManager Command Line Tool Nmcli.md b/translated/tech/20150824 Basics Of NetworkManager Command Line Tool Nmcli.md similarity index 62% rename from sources/tech/20150824 Basics Of NetworkManager Command Line Tool Nmcli.md rename to translated/tech/20150824 Basics Of NetworkManager Command Line Tool Nmcli.md index d911cfcc0e..5ddb31d1ea 100644 --- a/sources/tech/20150824 Basics Of NetworkManager Command Line Tool Nmcli.md +++ b/translated/tech/20150824 Basics Of NetworkManager Command Line Tool Nmcli.md @@ -1,20 +1,18 @@ -translating----geekpi - -Basics Of NetworkManager Command Line Tool, Nmcli +网络管理命令行工具基础,Nmcli ================================================================================ ![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/08/networking1.jpg) -### Introduction ### +### 介绍 ### -In this tutorial, we will discuss NetworkManager command line tool, aka **nmcli**, in CentOS / RHEL 7. Users who are using **ifconfig** should avoid this command in Centos 7. +在本教程中,我们会在CentOS / RHEL 7中讨论网络管理工具,也叫**nmcli**。那些使用**ifconfig**的用户应该在CentOS 7中避免使用这个命令。 -Lets configure some networking settings with nmcli utility. +让我们用nmcli工具配置一些网络设置。 -#### To get all address information of all interfaces connected with System #### +### 要得到系统中所有接口的地址信息 ### [root@localhost ~]# ip addr show -**Sample Output:** +**示例输出:** 1: lo: mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 @@ -29,53 +27,53 @@ Lets configure some networking settings with nmcli utility. inet6 fe80::20c:29ff:fe67:2f4c/64 scope link valid_lft forever preferred_lft forever -#### To retrieve packets statistics related with connected interfaces #### +#### 检索与连接的接口相关的数据包统计 #### [root@localhost ~]# ip -s link show eno16777736 -**Sample Output:** +**示例输出:** ![unxmen_(011)](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_0111.png) -#### Get routing configuration #### +#### 得到路由配置 #### [root@localhost ~]# ip route -Sample Output: +示例输出: default via 192.168.1.1 dev eno16777736 proto static metric 100 192.168.1.0/24 dev eno16777736 proto kernel scope link src 192.168.1.51 metric 100 -#### Analyze path for some host/website #### +#### 分析主机/网站路径 #### [root@localhost ~]# tracepath unixmen.com -Output will be just like traceroute but in more managed form. +输出像traceroute,但是更加完整。 ![unxmen_0121](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_01211.png) -### nmcli utility ### +### nmcli 工具 ### -**Nmcli** is a very rich and flexible command line utility. some of the terms used in nmcli are: +**Nmcli** 是一个非常丰富和灵活的命令行工具。nmcli使用的情况有: -- **Device** – A network interface being used. -- **Connection** – A set of configuration settings, for a single device you can have multiple connections, you can switch between connections. +- **设备** – 正在使用的网络接口 +- **连接** – 一组配置设置,对于一个单一的设备可以有多个连接,可以在连接之间切换。 -#### Find out how many connections are available for how many devices #### +#### 找出有多少连接服务于多少设备 #### [root@localhost ~]# nmcli connection show ![unxmen_(013)](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_013.png) -#### Get details of a specific connection #### +#### 得到特定连接的详情 #### [root@localhost ~]# nmcli connection show eno1 -**Sample output:** +**示例输出:** ![unxmen_(014)](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_0141.png) -#### Get the Network device status #### +#### 得到网络设备状态 #### [root@localhost ~]# nmcli device status @@ -85,71 +83,73 @@ Output will be just like traceroute but in more managed form. eno16777736 ethernet connected eno1 lo loopback unmanaged -- -#### Create a new connection with “dhcp” #### +#### 使用“dhcp”创建新的连接 #### [root@localhost ~]# nmcli connection add con-name "dhcp" type ethernet ifname eno16777736 -Where, +这里, -- **Connection add** – To add new connection -- **con-name** – connection name -- **type** – type of device -- **ifname** – interface name +- **Connection add** – 添加新的连接 +- **con-name** – 连接名 +- **type** – 设备类型 +- **ifname** – 接口名 -This command will add connection with dhcp protocol. +这个命令会使用dhcp协议添加连接 -**Sample output:** +**示例输出:** Connection 'dhcp' (163a6822-cd50-4d23-bb42-8b774aeab9cb) successfully added. -#### Instead of assigning an IP via dhcp, you can add ip address as “static” #### +#### 不同过dhcp分配IP,使用“static”添加地址 #### [root@localhost ~]# nmcli connection add con-name "static" ifname eno16777736 autoconnect no type ethernet ip4 192.168.1.240 gw4 192.168.1.1 -**Sample Output:** +**示例输出:** Connection 'static' (8e69d847-03d7-47c7-8623-bb112f5cc842) successfully added. -**Update connection:** +**更新连接:** [root@localhost ~]# nmcli connection up eno1 Again Check, whether ip address is changed or not. +再检查一遍,ip地址是否已经改变 [root@localhost ~]# ip addr show ![unxmen_(015)](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_0151.png) -#### Add DNS settings to Static connections. #### +#### 添加DNS设置到静态连接中 #### [root@localhost ~]# nmcli connection modify "static" ipv4.dns 202.131.124.4 -#### Add additional DNS value. #### +#### 添加额外的DNS值 #### [root@localhost ~]# nmcli connection modify "static" +ipv4.dns 8.8.8.8 -**Note**: For additional entries **+** symbol will be used and **+ipv4.dns** will be used instead on **ip4.dns** +**注意**:要使用额外的**+**符号,并且要是**+ipv4.dns**,而不是**ip4.dns**。 -Put an additional ip address: + +添加一个额外的ip地址: [root@localhost ~]# nmcli connection modify "static" +ipv4.addresses 192.168.200.1/24 -Refresh settings using command: +使用命令刷新设置: [root@localhost ~]# nmcli connection up eno1 ![unxmen_(016)](http://www.unixmen.com/wp-content/uploads/2015/08/unxmen_016.png) -You will see, setting are effective now. +你会看见,设置生效了。 -That’s it. +完结 -------------------------------------------------------------------------------- via: http://www.unixmen.com/basics-networkmanager-command-line-tool-nmcli/ 作者:Rajneesh Upadhyay -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出