DHCP服务器搭建 DHCP服务器搭建一、ensp搭建了解即可1、路由器部署DHCP服务1、接口地址池路由器接口地址192.168.1.1/24属于192.168.1.0网段该网段成为能够分配的地址池接口地址自动成 为分配的网关地址第一步基础配置R1Huaweisystem-view#用户视图切换到系统视图[Huawei]undo info-centerenable#关闭消息提示[Huawei]sysname r1#设置主机名r1[r1]int e0/0/0#进入e0/0/0接口[r1-Ethernet0/0/0]ipadd192.168.1.124#配置IP地址[r1-Ethernet0/0/0]quit#返回系统视图sw1Huaweisystem-view[Huawei]sysname sw1[sw1]stp disable#关闭生成树Warning: The global STP state will be changed. Continue?[Y/N]y#回答y第二步配置路由器DHCPR1:[r1]dhcpenable#全局使能dhcp功能[r1]int e0/0/0[r1-Ethernet0/0/0]dhcpselectinterface#接口dhcp[r1-Ethernet0/0/0]dhcp server lease day3#dhcp租期3天[r1-Ethernet0/0/0]dhcp server dns-list223.5.5.5#dns分配223.5.5.5(阿里云公共DNS地址)[r1-Ethernet0/0/0]dhcp server excluded-ip-address192.168.1.4#地址池排除192.168.1.4第三步PC自动获取地址第四步抓包观察DHCP工作原理记录PC3 MAC地址R1:r1system-view[r1]int e0/0/0[r1-Ethernet0/0/0]dhcp server static-bind ip-address192.168.1.88 mac-address5489-98f3-5b43#将192.168.1.88绑定到PC3 MAC观察现象2、全局地址池第一步基础配置R1#用户视图切换到系统视图Huaweisystem-view#关闭消息提示[Huawei]undo info-centerenable#设置主机名r1[Huawei]sysname r1#进入e0/0/0[r1]int e0/0/0#配置IP地址[r1-Ethernet0/0/0]ipadd192.168.1.124#返回系统视图[r1-Ethernet0/0/0]quitsw1:#用户视图切换系统视图Huaweisystem-view#设置交换机主机名sw1[Huawei]sysname sw1#关闭生成树[sw1]stp disable Warning: The global STP state will be changed. Continue?[Y/N]y#交互提示输入y确认第二步配置路由器DHCPR1:#用户视图切换系统视图Huaweisystem-view#关闭日志信息提示[Huawei]undo info en#修改设备主机名为r1[Huawei]sysname r1#进入e0/0/0接口[r1]int e0/0/0#配置接口IP地址[r1-Ethernet0/0/0]ipadd192.168.1.124#退回系统视图[r1-Ethernet0/0/0]quit#创建DHCP地址池net1[r1]ip pool net1#配置地址池网段[r1-ip-pool-net1]network192.168.1.0 mask24#指定客户端网关地址[r1-ip-pool-net1]gateway-list192.168.1.1#配置DNS服务器地址[r1-ip-pool-net1]dns-list223.5.5.5#配置地址租期3天12小时30分钟[r1-ip-pool-net1]lease day3hour12minute30#排除不分配的IP 192.168.1.4[r1-ip-pool-net1]excluded-ip-address192.168.1.4#排除不分配的IP 192.168.1.44[r1-ip-pool-net1]excluded-ip-address192.168.1.44#IP‑MAC静态绑定[r1-ip-pool-net1]static-bind ip-address192.168.1.88 mac-address5489-98f3-5b43#退回系统视图[r1-ip-pool-net1]quit#全局开启DHCP功能[r1]dhcpenable#进入e0/0/0接口[r1]int e0/0/0#接口调用全局DHCP地址池[r1-Ethernet0/0/0]dhcpselectglobal第三步PC自动获取地址2、DHCP中继第一步基础设置R1Huaweisystem-view[Huawei]undo info en[Huawei]sysname r1[r1]int e0/0/0[r1-Ethernet0/0/0]ipadd192.168.1.124[r1-Ethernet0/0/0]int e0/0/1[r1-Ethernet0/0/1]ipadd12.1.1.124[r1-Ethernet0/0/1]quit[r1]ip route-static192.168.2.02412.1.1.2R2:Huaweisystem-view[Huawei]undo info en[Huawei]sys r2[r2]int e0/0/0[r2-Ethernet0/0/0]ipadd192.168.2.124[r2-Ethernet0/0/0]int e0/0/1[r2-Ethernet0/0/1]ipadd12.1.1.224[r2-Ethernet0/0/1]quit[r2]ip route-static192.168.1.02412.1.1.1sw1:Huaweisystem-view[Huawei]undo info en[Huawei]sys sw1[sw1]stp disable Warning: The global STP state will be changed. Continue?[Y/N]ysw2:Huaweisystem-view[Huawei]undo info en[Huawei]sys sw2[sw1]stp disable Warning: The global STP state will be changed. Continue?[Y/N]y第二步配置路由器DHCPR1:# 创建地址池1[r1]ip pool net1[r1-ip-pool-net1]network192.168.1.0 mask24[r1-ip-pool-net1]gateway-list192.168.1.1[r1-ip-pool-net1]dns-list8.8.8.8[r1-ip-pool-net1]quit# 创建地址池2[r1]ip pool net2[r1-ip-pool-net2]network192.168.2.0 mask24[r1-ip-pool-net2]gateway-list192.168.2.1[r1-ip-pool-net2]dns-list114.114.114.114[r1-ip-pool-net2]quit# 全局使能dhcp功能[r1]dhcpenable# 接口调用全局地址池[r1]int e0/0/0[r1-Ethernet0/0/0]dhcpselectglobal[r1-Ethernet0/0/0]int e0/0/1第三步配置DHCP中继R2:[r2]dhcpenable[r2]int e0/0/0#开启dhcp中继[r2-Ethernet0/0/0]dhcpselectrelay#中继给12.1.1.1r1 dhcp服务器[r2-Ethernet0/0/0]dhcp relay server-ip12.1.1.1第四步PC自动获取地址抓包R2 E0/0/0 E0/0/1 观察收到广播的dhcp discover通过dhcp中继单播发给 R1二·、Linux部署 DHCP 服务1、部署环境准备节点规划节点名称节点ip作用dhcp-server10.1.8.10/24(服务器必须静态IP)DHCP服务器dhcp-client1(普通员工)从dhcp-server自动获取随机IPDHCP客户端dhcp-client2(经理)从dhcp-server自动获取固定IP 10.1.8.88DHCP客户端基础配置服务器必须静态IP地址1、10.1.8.2 本质网关路由器 / 虚拟机虚拟网关 IP网关就是虚拟机的出口大门虚拟机想要访问外网、ping 外网所有数据包先交给网关VMware / Virtual‑Box 虚拟网卡很多时候网关默认分配为网段第二位 x.x.x.2举例子网段 192.168.1.x → 网关常是 192.168.1.2网段 10.1.8.x → 网关就是 10.1.8.22、DNS 填 10.1.8.2 原因网关设备自带 DNS 解析功能直接让路由器负责域名解析所以 dns 和网关写成同一个地址。查看自己真实网关不用死记 10.1.8.2[rootlocalhost ~]#route -ndhcp-server:[rootlocalhost ~]# nmcli connection modify ens33 ipv4.method manual ipv4.addresses 10.1.8.10/24 ipv4.gateway 10.1.8.2 ipv4.dns 10.1.8.2 autoconnect yes[rootlocalhost ~]# nmcli connection up ens33[rootlocalhost ~]# hostnamectl set-hostname dhcp-serverdhcp-client1:[rootlocalhost ~]# hostnamectl set-hostname dhcp-client1hcp-client2:[rootlocalhost ~]# hostnamectl set-hostname dhcp-client2要配置DHCPv4服务器请首先使用 ip addr命令确认您的网络接口配置是否指定了BROADCAST地 址。[rootdhcp-server ~]# ip addr | grep ens33#输出结果2: ens33:BROADCAST,MULTICAST,UP,LOWER_UPmtu1500qdisc pfifo_fast state UP group default qlen1000inet10.1.8.10/24 brd10.1.8.255 scope global noprefixroute ens33安装 DHCP 软件# 安装软件包[rootdhcp-server ~]# yum install -y dhcp# 配置防火墙放行dhcp服务[rootdhcp-server ~]# firewall-cmd --add-servicedhcp# 配置防火墙放行dhcp服务,并写入永久设置[rootdhcp-server ~]# firewall-cmd --add-servicedhcp --permanent配置 DHCP 服务器dhcpd服务使用 /etc/dhcp/dhcpd.conf 配置文件。 dhcp软件包提供/usr/share/doc/dhcp */dhcpd.conf.example 配置文件示例。#查看DHCP主配置文件,发现提示我们去看/usr/share/doc/dhcp*/dhcpd.conf.example这个文件[rootdhcp-server ~]# cat /etc/dhcp/dhcpd.conf## DHCP Server Configuration file.# see /usr/share/doc/dhcp*/dhcpd.conf.example# see dhcpd.conf(5) man page#查看DHCP配置示例文档[rootdhcp-server ~]# vim /etc/dhcp/dhcpd.conf.example#使用vim编辑DHCP主配置文件[rootdhcp-server ~]# vim /etc/dhcp/dhcpd.conf#在最后加上subnet10.1.8.0 netmask255.255.255.0{range10.1.8.10110.1.8.130;option domain-name-servers223.5.5.5;option domain-namexuhaou.cloud;option routers10.1.8.2;option broadcast-address10.1.8.255;default-lease-time600;max-lease-time7200;}#每行配置的意思是#给10.1.8.0/24这个网络段设备分配IP#IP分配范围10.1.8.101-10.1.8.130#分配给dhcp客户端dns地址为223.5.5.5(阿里云公共dns#局域网设备的域名后缀 xuhaoyu.cloud#分配给客户端的额网关地址为10.1.8.2#局域网广播地址。DHCP、ARP依赖它你的网段10.1.8.0/24 子网掩码255.255.255.0 可用主机范围10.1.8.1 ~10.1.8.25410.1.8.0网段标识网络地址10.1.8.255广播地址#默认租期600秒#最大租期7200秒简单记忆10.1.8.0网段名不能分给电脑10.1.8.1‑10.1.8.254可以分配给主机10.1.8.255广播地址专门用来发广播不能给到客户端当 IP配置说明 authoritative指示服务器对其所管理的子网具有权威性。subnet提供的子网详细。range指定服务器在该范围内分配IP地址。option routers指定服务器提供默认网关地址。option domain-name-servers指定服务器提供DNS名称服务器。option domain-search指定服务器提供DNS域搜索列表。default-lease-time提供网络信息默认租期如果客户端不要求任何特定的租期。单位秒。max-lease-time指示服务器可以从客户端请求接受的最大租期。单位秒。客户端系统上的NetworkManager使用domain-name-servers和domain-search更新resolv.conf文 件中的nameserver和search参数。验证 DHCP 配置# 验证配置文件语法[rootdhcp-server ~]# dhcpd -t#输出结果Internet Systems Consortium DHCP Server4.2.5 Copyright2004-2013 Internet Systems Consortium. All rights reserved.#主要看这个For info, please visit https://www.isc.org/software/dhcp/ Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specifiedinthe config fil启用并启动服务# 启用并启动服务[rootdhcp-server ~]# systemctl enable dhcpd --noww# 查看服务状态[rootdhcp-server ~]# systemctl status dhcpd配置 DHCP 客户端dhcp-client1(普通员工)# 添加一个自动获取ip连接假设网卡设备名为ens33,新连接的名称设为 dynamic可自定义[rootdhcp-client1 ~]# nmcli connection add con-name dynamic type ethernet ipv4.method auto ifname ens33[rootdhcp-client1 ~]# nmcli connection up dynamic# 验证[rootdhcp-client1 ~]# ip addr show ens332: ens33:BROADCAST,MULTICAST,UP,LOWER_UPmtu1500qdisc pfifo_fast state UP group default qlen1000link/ether 00:0c:29:07:ec:8b brd ff:ff:ff:ff:ff:ff inet10.1.8.102/24brd10.1.8.255 scope global noprefixroute dynamic ens33 valid_lft 451sec preferred_lft 451sec inet6 fe80::fd60:8109:ed08:cd78/64 scopelinknoprefixroute valid_lft forever preferred_lft forever[rootdhcp-client1 ~]# cat /etc/resolv.conf# Generated by NetworkManagersearch laogao.cloud nameserver10.1.8.2[rootdhcp-client1 ~]# route -n2、基于 MAC 地址预留IP地址在配置文件中host声明可以将MAC地址绑定到IP地址。 此配置对于始终为特定系统的网络接口提供相同的IP地址特别有用尤其是Web或数据库系统之类的服务器。dhcp-client2(经理)MAC地址查看[rootdhcp-client2 ~]# ip link show ens332: ens33:BROADCAST,MULTICAST,UP,LOWER_UPmtu1500qdisc pfifo_fast state UP mode DEFAULT group default qlen1000link/ether00:0c:29:02:49:2abrd ff:ff:ff:ff:ff:在以下示例中服务器始终为MAC地址是 00:0c:29:02:49:2a 的系统分配10.1.8.88地址(绿色那行字体是什么下面配置的时候就写什么)[rootdhcp-server ~]# vim /etc/dhcp/dhcpd.conf# 在/etc/dhcp/dhcpd.conf最后添加如下内容hostclient.xuahoyu.cloud{hardware ethernet 00:0c:29:02:49:2a;fixed-address10.1.8.88;}#每一行释义#host client.xuahoyu.cloud#定义一台固定主机自定义主机名称为 client.xuahoyu.cloud仅用来标识客户端没有网络功能。#hardware ethernet 00:0c:29:02:49:2a#填写客户端 ens33 网卡的MAC 物理地址#DHCP 服务器依靠 MAC 识别这台虚拟机。#fixed-address 10.1.8.88#IP 地址预留 / 静态绑定#只要 MAC 地址是00:0c:29:02:49:2a的设备申请 DHCP服务器永远分配固定 IP 10.1.8.88重启服务[rootdhcp-server ~]# systemctl restart dhcpd客户端验证# 创建并激活连接[rootdhcp-client2 ~]# nmcli connection add con-name dynamic type ethernet ipv4.method auto ifname ens33[rootdhcp-client2 ~]# nmcli connection up dynamic# 验证[rootdhcp-client2 ~]# ip addr show ens33[rootdhcp-client2 ~]# cat /etc/resolv.conf[rootdhcp-client2 ~]# route -n三、DHCP 中继服务器主机名IP 地址虚拟网络dhcp‑server.laogao.cloud10.1.8.10/24vmnet8dhcp‑relay.laogao.cloud10.1.8.20/24vmnet8dhcp‑relay.laogao.cloud10.1.1.20/24vmnet1dhcp‑client1.laogao.cloud自动获取vmnet1dhcp‑client2.laogao.cloud自动获取vmnet1虚拟机设置先开机再设置配置3台服务器IP地址,主机名dhcp-server:[rootlocalhost ~]# hostnamectl set-hostname dhcp-server[rootlocalhost ~]# nmcli connection modify ens33 ipv4.method manual ipv4.addresses 10.1.8.10/24 ipv4.gateway 10.1.8.2 ipv4.dns 10.1.8.2 autoconnectyes[rootlocalhost ~]# nmcli connection up ens33dhcp-relay[rootlocalhost ~]# hostnamectl set-hostname dhcp-relay#查看新添加的网卡是ens34还是35、36[rootlocalhost ~]#nmcli connection[rootlocalhost ~]# nmcli connection modify ens33 ipv4.method manualipv4.addresses10.1.8.20/24 ipv4.gateway10.1.8.2 ipv4.dns10.1.8.2 autoconnectyes[rootlocalhost ~]# nmcli connection up ens33[rootlocalhost ~]# nmcli connection add ifname ens34 con-name ens34 typeethernet ipv4.method manual ipv4.addresses10.1.1.20/24[rootlocalhost ~]# nmcli connection up ens34dhcp-client:[rootlocalhost ~]# hostnamectl set-hostname dhcp-client配置 dhcp-server配置 dhcp# 安装软件包[rootdhcp-server ~]# yum install -y dhcp# 配置防火墙放行dhcp服务[rootdhcp-server ~]# firewall-cmd --add-servicedhcp[rootdhcp-server ~]# firewall-cmd --add-servicedhcp --permanent# A窗口[rootdhcp-server ~]# vim /usr/share/doc/dhcp-*/dhcpd.conf.example# B窗口从A窗口复制案例[rootdhcp-server ~]# vim /etc/dhcp/dhcpd.confsubnet10.1.8.0 netmask255.255.255.0{range10.1.8.10010.1.8.200;option routers10.1.8.20;option broadcast-address10.1.8.255;option domain-name-servers223.5.5.5;option domain-searchlaogao.cloud;default-lease-time600;max-lease-time7200;}# 新增一个地址池subnet10.1.1.0 netmask255.255.255.0{range10.1.1.10010.1.1.200;option routers10.1.1.20;option broadcast-address10.1.1.255;option domain-name-servers223.5.5.5;option domain-searchlaogao.cloud;default-lease-time600;max-lease-time7200;}# 启用并启动服务[rootdhcp-server ~]# systemctl enable dhcpd --now# 查看服务状态[rootdhcp-server ~]# systemctl status dhcpd配置路由DHCP server必须配置一个到达 DHCP relay 接收 DHCP 广播网卡的路由。如果不配置该路由dhcp server 无法将数据包返回给 10.1.1.20 服务器最终导致无法提供dhcp给 dhcp-client。# 当前实验环境: DHCP relay的第二个网卡地址是10.1.1.20/24 。# dhcp-server 想要访问 10.1.1.20数据包转发给本机另一块网卡 IP 10.1.8.20[rootdhcp-server ~]# nmcli connection modify ens33 ipv4.routes 10.1.1.20/32 10.1.8.20[rootdhcp-server ~]# nmcli connection up ens33配置 dhcp-relay[rootdhcp-relay ~]# yum install -y dhcp[rootdhcp-relay ~]# cp /usr/lib/systemd/system/dhcrelay.service/etc/systemd/system/dhcrelay.service[rootdhcp-relay ~]# vim /etc/systemd/system/dhcrelay.service[Unit]DescriptionDHCP Relay Agent DaemonDocumentationman:dhcrelay(8)Wantsnetwork-online.targetAfternetwork-online.target[Service]Typenotify# 在 ExecStart 参数末尾添加 DHCP 服务器 IP 地址ExecStart/usr/sbin/dhcrelay-d--no-pid10.1.8.10StandardErrornull[Install]WantedBymulti-user.target[rootdhcp-relay ~]# systemctl enable dhcrelay.service --now配置路由转发# 开启路由转发[rootdhcp-relay ~]# echo net.ipv4.ip_forward1 /etc/sysctl.conf[rootdhcp-relay ~]# sysctl -p /etc/sysctl.confnet.ipv4.ip_forward1客户端测试[rootdhcp-client ~]# nmcli connection add con-name dynamic type ethernet ipv4.method auto ifname ens33[rootdhcp-client ~]# nmcli connection up dynamic[rootdhcp-client ~]# ip -br alo UNKNOWN127.0.0.1/8 ::1/128 ens33 UP10.1.1.100/24 fe80::32c5:ad2b:c0d6:f3ab/64#获取到地址# 验证确实是dhcp‑server分配的[rootdhcp-server ~]# cat /var/lib/dhcpd/dhcpd.leases# The format of this file is documented in the dhcpd.leases(5) manual page.# This lease file was written by isc‑dhcp‑4.2.5server‑duid\000\001\000\0012\004\\\034\000\014)6\302w;lease10.1.1.100{starts22026/08/04 08:20:43;ends22026/08/04 08:30:43;cltt22026/08/04 08:20:43;binding state active;next binding statefree;rewind binding statefree;hardware ethernet 00:0c:29:d8:9d:e6;client‑hostnamedhcp‑client;}lease10.1.1.100{starts22026/08/04 08:21:14;ends22026/08/04 08:31:14;cltt22026/08/04 08:21:14;binding state active;next binding statefree;rewind binding statefree;hardware ethernet 00:0c:29:d8:9d:e6;client‑hostnamedhcp‑client;}四、DHCP 服务器-Dnsmasq(扩展-自学)Dnsmasq 介绍Dnsmasq 是一个集 DNS 缓存、DHCP 、DHCP 中继、PXE一体的软件。多个功能即可以同时实施也 可以独立实施。作为 DNS 缓存服务器可以通过缓存 DNS 请求来提高对访问过的网址的连接速度。作为 DHCP 服务器可用于为局域网电脑分配内网ip地址和提供路由。作为 DHCP 中继服务器为局域网提供 DHCP 中继服务。作为 TFTP 服务器提供网络 PXE 网络引导。Dnsmasq 轻量且易配置适用于个人用户或小型网络节点规划dhcp-client1 \ dhcp-client2 复用上个实验,dnsmasq重新克隆产生节点名称节点 IP作用dnsmasq10.1.8.10/24 (服务器必须静态 IP)DHCP 服务器dhcp‑client1 (普通员工)从 dhcp‑server 自动获取随机 IPDHCP 客户端dhcp‑client2 (经理)从 dhcp‑server 自动获取固定 IP 10.1.8.66DHCP 客户端dnsmasq 安装# 基础配置[rootlocalhost ~]# nmcli connection modify ens33 ipv4.method manual ipv4.addresses 10.1.8.10/24 ipv4.gateway 10.1.8.2 ipv4.dns 10.1.8.2 autoconnect yes[rootlocalhost ~]# nmcli connection up ens33[rootlocalhost ~]# hostnamectl set-hostname dnsmasq# 安装软件[rootdnsmasq ~]# yum install -y dnsmasq# 配置防火墙放行dhcp服务[rootdnsmasq ~]# firewall-cmd --add-servicedhcp[rootdnsmasq ~]# firewall-cmd --add-servicedhcp --permanentdnsmasq 配置/etc/dnsmasq.conf 配置文件提供大量的注释说明。比较重要参数listen-address定义监听的地址默认是监控本机的所有网卡上。dhcp-authoritativeDHCP 权威服务器。dhcp-rangeIP 地址池范围。可以配置多个。dhcp-host给特定 MAC 地址主机分配主机名和IP地址。dhcp-lease-maxDHCP 租约最长时间。dhcp-option定义 dhcp 选项。​ 设置网关 dhcp-optionoption:router,1.2.3.4​ 设置域名服务器dhcp-optionoption:dns-server,1.2.3.4,1.2.3.5​ 设置查找域dhcp-optionoption:domain-search,laogao.cloud,example.com​ 设置对时服务器dhcp-optionoption:ntp-server,1.2.3.4,1.2.3.5[rootdnsmasq ~]# vim /etc/dnsmasq.conf# 文件末尾加上# IP地址范围是10.1.8.50-150掩码24位租约时间是12小时dhcp-range10.1.8.50,10.1.8.101,255.255.255.0,12h# 给Mac地址是00:0c:29:02:49:2a的主机分配IP地址10.1.8.66租约时间45分钟dhcp-host00:0c:29:02:49:2a,10.1.8.66,45m# 设置网关dhcp-optionoption:router,10.1.8.2# 设置DNSdhcp-optionoption:dns-server,8.8.8.8客户端测试dhcp-client1[rootdhcp-client1 ~]# nmcli connection up dynamic# 查看网络接口 ens33 的 IP 地址、掩码等详细信息验证是否从 DHCP 获取到正确的 IP[rootdhcp-client1 ~]# ip add show ens33# 查看 DNS 配置文件确认是否获得了 DHCP 下发的 DNS 服务器地址[rootdhcp-client1 ~]# cat /etc/resolv.conf# 查看路由表确认默认网关是否指向正确的路由器接口[rootdhcp-client1 ~]# route -ndhcp-client2[rootdhcp-client2 ~]# nmcli connection up dynamic[rootdhcp-client2 ~]# ip add show ens33[rootdhcp-client2 ~]# cat /etc/resolv.conf[rootdhcp-client2 ~]# route -n五、DHCP 中继服务器-Dnsmasq(扩展-自学这里采用上文中的环境中继服务通过Dnsmasq实现。配置 dnsmasq[rootdhcp-relay ~]# yum install -y dnsmasq[rootdhcp-relay ~]# vim /etc/dnsmasq.conf# 在末尾增加一条记录# 作用来自于网卡10.1.1.20的dhcp请求转发到10.1.8.10dhcp-relay10.1.1.20,10.1.8.10# dhcp-relay可多次使用为不同网段提供relay功能[rootdhcp-relay ~]# systemctl enable dnsmasq.service --now配置路由转发# 开启路由转发[rootdhcp-relay ~]# echo net.ipv4.ip_forward1 /etc/sysctl.conf[rootdhcp-relay ~]# sysctl -p /etc/sysctl.confnet.ipv4.ip_forward1客户端测试[rootdhcp-client1 ~]# nmcli connection up dynamic[rootdhcp-client2 ~]# nmcli connection up dynamic