RedHat7 de nmcli

1. Introducción

NetworkManager es RedHat 7 de la serie de servicios de red ofrece una red de control dinámico y demonio de configuración, herramientas de interfaz gráfica de usuario para nmtui, herramientas de línea de comandos para nmcli, gráfica de control central de la herramienta interfaz proporcionada por GNOME Shell, aún no determinados por el tratamiento de control-center estas tareas procesadas por nm-connection-editor.
NetworkManager tipos de conexión se pueden utilizar para el siguiente: Ethernet, VLAN, puente, unión, grupo, Wi-Fi, banda ancha móvil (como una red móvil 3G) y IP sobre InfiniBand. En estos tipos de conexión, la red se puede configurar alias de NetworkManager, dirección IP estática, el router, y la información de DNS, y *** de conexión parámetros de conexión numerosos específicas. Finalmente, NetworkManager API proporcionada por el D-bus, D-Bus permite que las aplicaciones de consulta y controlar la configuración y el estado de la red.

2, nmcli

Utilice necesidad nmcli para instalar e iniciar NetworkManager

2.1, instalar e iniciar NetworkManager

yum install NetworkManager
systemctl start NetworkManager
systemctl enable NetworkManager

2.2, el formato de uso nmcli

OPCIONES nmcli OBJETO COMANDO {| Ayuda}
OPCIONES

  -a, --ask                                询问缺少的参数
  -c, --colors auto|yes|no                 是否在输出中使用颜色
  -e, --escape yes|no                      值中是否有转义符分隔符
  -f, --fields <field,...>|all|common      指定要输出的字段
  -g, --get-values <field,...>|all|common  通用快捷方式 -m 表格 -t -f
  -h, --help                               打印帮助信息
  -m, --mode tabular|multiline             指定输出模式,输出网卡相关信息
  -o, --overview                           输出网卡相关信息的概述
  -p, --pretty                              输出网卡相关信息
  -s, --show-secrets                       允许显示密码
  -t, --terse                              简短的输出
  -v, --version                            查看程序版本
  -w, --wait <seconds>                     设置超时等待时间

OBJETO

g[eneral]       常规操作
*   status       显示 NetworkManager 总体状态
*   hostname [<主机名>]
*   permissions
*   logging [level <日志级别>] [domains <日志域>]  NetworkManager 日志记录
n[etworking]    管理网络
*   on
*   off
*   connectivity [check]
r[adio]         管理无线交换机
*   all | wifi | wwan [ on | off 
c[onnection]    管理连接
*   查看相关:
* *       show [--active] [--order <order spec>]
* *       show [--active] [id | uuid | path | apath] <ID> …
*   启动与关闭连接:
* *       up [[id | uuid | path] <ID>] [ifname <ifname>] [ap <BSSID>] [passwd-file <file with passwords>]
* *       down [id | uuid | path | apath] <ID> …
*   管理连接相关:
* *       add COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS SLAVE_OPTIONS IP_OPTIONS [-- ([+|-]<setting>.<property> <value>)+]
* *       modify [--temporary] [id | uuid | path] <ID> ([+|-]<setting>.<property> <value>)+
* *       clone [--temporary] [id | uuid | path ] <ID> <new name>
* *       edit [id | uuid | path] <ID>
* *       edit [type <new_con_type>] [con-name <new_con_name>
* *       delete [id | uuid | path] <ID>
* *       monitor [id | uuid | path] <ID> …
*   重载连接:
* *       reload
* *       load <filename> [ <filename>... ]
* *       import [--temporary] type <type> file <file to import>
* *       export [id | uuid | path] <ID> [<output file>]
d[evice]        管理设备
*   status | show | set | connect | reapply | modify | disconnect | delete | monitor | wifi | lldp
a[gent]         管理代理相关
*   secret | polkit | all 
m[onitor]       监视网络管理器(NetworkManager)的更改,每当 NetworkManager 出现更改时打印一行信息。

2.3 Ejemplo de configuración de IPv4

nmcli con modify eth0 ipv4.addresses "172.25.0.11/24 172.25.254.254" ipv4.method manual 
nmcli con modify eth0 ipv4.dns 172.25.254.254 
nmcli con down eth0 
nmcli con up eth0 

2.4, un ejemplo de configuración: configuración de polimerización puerto utilizando nmcli

Server0 dispuesto entre y requisitos desktop0 siguiente:
Este enlace utiliza la interfaz eth1 eth2 y
este enlace todavía está trabajando en una interfase falla
este enlace utiliza la siguiente dirección 192.168.0.101/255.255.255.0 server0
este enlace desktop0 en la siguiente dirección 192.168.0.102/255.255.255.0
este enlace por restos en el estado normal después de reiniciar el sistema

# server0配置 
#创建新的成组接口,NetworkManager 还会将配置写入 /etc/sysconfig/network-scripts/ifcfg-team0,其中会将对应的 ONBOOT 设定为 yes,并将 BOOTPROTO 设定为 dhcp
nmcli con add type team con‐name team0 ifname team0 config '{"runner":{"name":"activebackup"}}' 
#向team0中添加名为team0-slave1的接口eth1
nmcli con add type team‐slave con‐name team0‐slave1 ifname eth1 master team0 
nmcli con add type team‐slave con‐name team0‐slave2 ifname eth2 master team0 
#为聚合组配置IP
nmcli con mod team0 ipv4.addresses "192.168.0.101/24 192.168.0.254" ipv4.method manual 
#要启用成组,必须首先激活端口
nmcli con up team0‐slave1 
nmcli con up team0‐slave2 
#启用成组
nmcli con up team0 
# desktop0配置 
nmcli con add type team con‐name team0 ifname team0 config '{"runner":{"name":"activebackup"}}' 
nmcli con add type team‐slave con‐name team0‐slave1 ifname eth1 master team0 
nmcli con add type team‐slave con‐name team0‐slave2 ifname eth2 master team0 
nmcli con mod team0 ipv4.addresses "192.168.0.102/24 192.168.0.254" ipv4.method manual 
nmcli con up team0‐slave1 
nmcli con up team0‐slave2 
nmcli con up team0 
# 检查 
nmcli con show 
teamdctl team0 state 

Referencias:
RedHat documento oficial: https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/7/html-single/networking_guide/index#sec-Network_Config_Using_nmcli

Supongo que te gusta

Origin blog.51cto.com/jiayimeng/2483556
Recomendado
Clasificación