Cisco实验:【DHCP配置】客户端跨网段通过DHCP服务器自动获取动态IP和固定IP地址 您所在的位置:网站首页 cisco配置dhcp服务器的命令 Cisco实验:【DHCP配置】客户端跨网段通过DHCP服务器自动获取动态IP和固定IP地址

Cisco实验:【DHCP配置】客户端跨网段通过DHCP服务器自动获取动态IP和固定IP地址

2023-07-07 09:29| 来源: 网络整理| 查看: 265

模拟环境:R1为路由器e0/0接口和e0/1接口分别连接两个网段,e0/0连接用户区域,e0/1连接服务器区域;用户区域中SW1为接入层交换机,连接一台PC(R2模拟)和一台打印机(R5模拟);服务器区域中连接一台DHCP服务器(R3模拟);要求实现PC通过DHCP服务器自动获取动态IP地址,打印机通过DHCP服务器获取固定IP地址。

R2 模拟PC 获取100.1.1.0/24段内地址R5 模拟打印机 获取100.1.1.200/24固定地址SW1 接入层交换机R1 路由器 e0/0:100.1.1.1/24;e0/1:13.1.1.1/24R3 模拟DHCP服务器 13.1.1.3/24 *Cisco路由器模拟成PC,关闭路由选择协议 no ip routing, *指定网关 ip default-gateway x.x.x.x

 

 

 R1配置信息:

Router>enable Router#configure terminal Router(config)#hostname R1 R1(config)#interface ethernet 0/1 R1(config-if)#ip address 13.1.1.1 255.255.255.0 R1(config-if)#no shutdown R1(config-if)#exit R1(config)#interface ethernet 0/0 R1(config-if)#ip address 100.1.1.254 255.255.255.0 R1(config-if)#no shutdown R1(config-if)#ip helper-address 13.1.1.3 //网关接口设置中继,实现将用户网段内的DHCP请求中继到服务器网段的DHCP服务器获取地址

 

R3配置信息(DHCP Server):

Router>enable Router#configure terminal Router(config)#hostname Server Server(config)#interface ethernet 0/0 Server(config-if)#ip address 13.1.1.3 255.255.255.0 Server(config-if)#no shutdown Server(config)#service dhcp //开启DHCP服务 Server(config)#ip dhcp pool CCIE //创建名为CCIE的地址池 Server(dhcp-config)#network 100.1.1.0 255.255.255.0 //指定网段地址池为100.1.1.0/24 Server(dhcp-config)#default-router 100.1.1.254 //指定网关 Server(dhcp-config)#dns-server 100.1.1.254 //指定DNS服务器 Server(dhcp-config)#domain-name aaa.net //指定域名 Server(dhcp-config)#lease 1 0 30 //修改租期,天 时 分,默认为1天 Server#show run | section dhcp //查看DHCP配置信息 ip dhcp pool CCIE network 100.1.1.0 255.255.255.0 default-router 100.1.1.254 dns-server 100.1.1.254 domain-name aaa.net lease 1 0 30 Server(config)#ip dhcp excluded-address 100.1.1.254 100.1.1.254 //排除范围地址不参与分配,从低地址-高地址的一个范围 Server(config)#ip dhcp pool Printer Server(dhcp-config)#host 100.1.1.200 255.255.255.0 //指定主机地址池 Server(dhcp-config)#default-router 100.1.1.254 Server(dhcp-config)#dns-server 100.1.1.254 Server(dhcp-config)#domain-name aaa.net Server(dhcp-config)#lease 3 0 0 Server(dhcp-config)#client-identifier 01aa.bbcc.0050.00 //指定客户端的ID,用于识别该地址分配到指定的设备;01+MAC地址 小数点前移 Server#show run | section dhcp ip dhcp excluded-address 100.1.1.254 ip dhcp pool CCIE network 100.1.1.0 255.255.255.0 default-router 100.1.1.254 dns-server 100.1.1.254 domain-name aaa.net lease 1 0 30 ip dhcp pool Printer host 100.1.1.200 255.255.255.0 client-identifier 01aa.bbcc.0050.00 default-router 100.1.1.254 dns-server 100.1.1.254 domain-name aaa.net lease 3 Server(config)#no ip routing //关闭路由协议,模拟成终端设备 Server(config)#ip default-gateway 13.1.1.1 //设置设备网关

 

R2配置信息(PC):

Router>enable Router#configure terminal Router(config)#hostname PC PC(config)#no ip routing //关闭路由协议,模拟成终端设备 PC(config)#interface ethernet 0/0 PC(config-if)#ip address dhcp //DHCP获取地址 PC(config-if)#no shutdown

 

R5配置信息(Printer):

Router>enable Router#configure terminal Router(config)#hostname Printer Printer(config)#no ip routing //关闭路由协议,模拟成终端设备 Printer(config)#interface ethernet 0/0 Printer(config-if)#ip address dhcp client-id ethernet 0/0 //DHCP自动获取地址,获取时出示连接接口的客户端ID用于匹配主机地址池中客户端ID Printer(config-if)#no shutdown

 



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有