CCNP-30 DHCP 3(BSCI)


CCNP-30 DHCP 3

实验拓扑:

实验要求:把 R1 配置为 DHCP SERVER ,把 SW 配置为 DHCP RELAY AGENT ,把 R2 配置为 DHCP CLIENT
试验目的:掌握交换机 DHCP 中继代理的配置方法。

试验配置:
R1
DHCPSERVER(config)#service dhcp
DHCPSERVER(config)#ip dhcp pool ccnp
DHCPSERVER(dhcp-config)#network 199.99.1.0 255.255.255.0
DHCPSERVER(dhcp-config)#default-router 199.99.1.1
DHCPSERVER(dhcp-config)#dns-server 199.99.1.253 199.99.1.254
DHCPSERVER(dhcp-config)#domain-name cisco.com
DHCPSERVER(dhcp-config)#exit
DHCPSERVER(config)#ip dhcp excluded-address 199.99.1.250 199.99.1.254
DHCPSERVER(config)#int f0/0
DHCPSERVER(config-if)#ip add 199.99.1.250 255.255.255.0
DHCPSERVER(config-if)#no shu
DHCPSERVER(config-if)#exit
 
SW
SW(config)#service dhcp // 开启交换机的 DHCP 服务
SW(config)#ip dhcp relay information option // 开启 DHCP 中继代理 option82 选项
SW(config)#exit
SW#vlan database
SW(vlan)#vlan 10
SW(vlan)#exit
SW#config t
SW(config)#int range f0/0 - 15
SW(config-if-range)#switchport access vlan 10
SW(config-if-range)#exit
SW(config)#int vlan 10
SW(config-if)#ip add 199.99.1.1 255.255.255.0
SW(config-if)#ip helper-address 199.99.1.250
SW(config-if)#ip dhcp relay information trusted // 配置 DHCP 中继代理信任选项
SW(config-if)#exit
 
R2
DHCPCLIENT(config)#int f0/0
DHCPCLIENT(config-if)#ip add dhcp
DHCPCLIENT(config-if)#no shu
按照上面的配置完成后,在 R2 show ip int br 查看一下接口是否得到了 IP 地址:
DHCPCLIENT#show ip int br
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            199.99.1.2      YES DHCP   up                    up     
好的,正确得到了 IP 地址,下面我们在 SW 上开启 debug ip dhcp server packet ,再到 R2 F0/0 接口 shut no shut 一下,观察 SW 上的调试信息:
SW#debug ip dhcp server packet
SW#             
*Mar  1 00:10:56.575: DHCPD: setting giaddr to 199.99.1.1.
*Mar  1 00:10:56.579: DHCPD: adding relay information option.// 加入 option82 选项
*Mar  1 00:10:56.579: DHCPD: BOOTREQUEST from 0063.6973.636f.2d63.6330.302e.3066.3334.2e30.3030.302d.4661.302f.30 forwarded to 199.99.1.250.
*Mar  1 00:10:58.675: DHCPD: forwarding BOOTREPLY to client cc00.0f34.0000.
*Mar  1 00:10:58.675: DHCPD: validating relay information option.// 通过 option82 选项
*Mar  1 00:10:58.675: DHCPD: broadcasting BOOTREPLY to client cc00.0f34.0000.
*Mar  1 00:10:58.679: DHCPD: Finding a relay for client 0063.6973.636f.2d63.6330.302e.3066.3334.2e30.3030.302d.4661.302f.30 on interface Vlan10.
*Mar  1 00:10:58.679: DHCPD: setting giaddr to 199.99.1.1.
*Mar  1 00:10:58.679: DHCPD: adding relay information option. // 加入 option82 选项
*Mar  1 00:10:58.683: DHCPD: BOOTREQUEST from 0063.6973.636f.2d63.6330.302e.3066.3334.2e30.3030.302d.4661.302f.30 forwarded to 199.99.1.250.
*Mar  1 00:10:58.995: DHCPD: forwarding BOOTREPLY to client cc00.0f34.0000.
*Mar  1 00:10:58.995: DHCPD: validating relay information option. // 通过 option82 选项
*Mar  1 00:10:58.995: DHCPD: broadcasting BOOTREPLY to client cc00.0f34.0000.
上面用红颜色标记的部分就是有关中继代理 option82 选项的信息, option82 选项是用来验证 DHCP 信息的准确性的,有关 option82 选项的详细信息,请参照 RFC3046 。然后在 SW show ip dhcp relay information trusted-sources
SW#show ip dhcp relay information trusted-sources
List of trusted sources of relay agent information option:
Vlan10
 
然后我们再回到 R2 上察看几个 show 命令:
DHCPCLIENT#show ip int br
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            199.99.1.3      YES DHCP   up                    up     
 
DHCPCLIENT#show dhcp lease
Temp IP addr: 199.99.1.3  for peer on Interface: FastEthernet0/0
Temp  sub net mask: 255.255.255.0
   DHCP Lease server: 199.99.1.250, state: 3 Bound
   DHCP transaction id: 186E
   Lease: 86400 secs,  Renewal: 43200 secs,  Rebind: 75600 secs
Temp default-gateway addr: 199.99.1.1
   Next timer fires after: 11:59:34
   Retry count: 0   Client-ID: cisco-cc00.0f34.0000-Fa0/0
   Client-ID hex dump: 636973636F2D636330302E306633342E
                       303030302D4661302F30
   Hostname: DHCPCLIENT
 
DHCPCLIENT#show dhcp server
   DHCP server: ANY (255.255.255.255)
    Leases:   2
    Offers:   5      Requests: 2     Acks : 4     Naks: 0
    Declines: 0      Releases: 3     Query: 0     Bad: 0
    DNS0:   199.99.1.253,   DNS1:  199.99.1.254
    Subnet: 255.255.255.0   DNS Domain: cisco.com
 
DHCPCLIENT#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is 199.99.1.1 to network 0.0.0.0
 
C    199.99.1.0/24 is directly connected, FastEthernet0/0
S*   0.0.0.0/0 [254/0] via 199.99.1.1
得到了所有 DHCP SERVER 分配给它的信息,在 R1 show ip dhcp binding
DHCPSERVER#show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address          Client-ID/              Lease expiration        Type
                    Hardware address/
                    User name
199.99.1.3          0063.6973.636f.2d63.    Mar 02 2002 12:11 AM    Automatic
                    6330.302e.3066.3334.
                    2e30.3030.302d.4661.
                    302f.30
注意用红颜色标记的部分并不是 R2 F0/0 接口的 MAC 地址,它是 Client-ID ,用来识别某个接口的。

实验总结:掌握基本的交换机 DHCP 中继代理的配置方法。





















本文转自loveme2351CTO博客,原文链接: http://blog.51cto.com/loveme23/51479  ,如需转载请自行联系原作者


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值