LAB12:DHCP中继
一、实验目的
1
、掌握DHCP中继的应用
二、实验内容
拓扑图:
需求:
1
、VLAN 10、VLAN 20内的PC能够从DHCP Server(Server-PT)动态获得IP地址;
2
、DHCP Server(Server-PT)属于VLAN 101;
三、实验配置
配置思路:
DHCP
工作时使用广播地址,同时PC和DHCP Server又不在同一VLAN中,而VLAN拥有分割广播域的作用,从而导致PC不能从DHCP Server 获取IP地址。这就需要我们在负责VLAN间路由的3560-24PS 的交换机上启用DHCP中继来解决问题。
配置
1
、开启3560-24PS的DHCP服务功能
Switch(config)#service dhcp
2
、开启路由功能
Switch(config)#ip routing
3
、开启DHCP中继功能
Switch(config)#ip dhcp relay information option
Switch(config)#interface vlan 10
Switch(config-if)#ip helper-address 192.168.101.1
(设置中继目标地址为DHCP Server )
验证:
Switch#debug ip dhcp server packet
*Mar 1 01:42:58.663: DHCPD: incoming interface name is Vlan10
*Mar 1 01:42:58.663: DHCPD:
Looking up binding using address 192.168.10.254
*Mar 1 01:42:58.663: DHCPD: setting giaddr to 192.168.10.254.
*Mar 1 01:42:58.663: DHCPD:
adding relay information option.
*Mar 1 01:42:58.663: DHCPD:
BOOTREQUEST from 0100.2264.4bab.eb forwarded to 192.168.20.1.
*Mar 1 01:42:58.667: DHCPD: incoming interface name is Vlan20
*Mar 1 01:42:58.667: DHCPD:
forwarding BOOTREPLY to client 0022.644b.abeb.
*Mar 1 01:42:58.667: old_giaddr = 0.0.0.0, giaddr=0.0.0.0, flag=0
*Mar 1 01:42:58.667: DHCPD: Option82 is currently:
*Mar 1 01:42:58.667: 020c020a0000c0a80afe0a000000
*Mar 1 01:42:58.667: DHCPD: Removing option82 information
*Mar 1 01:42:58.667: DHCPD: Option82 is removed
*Mar 1 01:42:58.667: DHCPD:
broadcasting BOOTREPLY to client 0022.644b.abeb.
*Mar 1 01:43:02.731: DHCPD: incoming interface name is Vlan10
*Mar 1 01:43:02.731: DHCPD:
Looking up binding using address 192.168.10.254
*Mar 1 01:43:02.731: DHCPD:
setting giaddr to 192.168.10.254.
*Mar 1 01:43:02.731: DHCPD: adding relay information option.
*Mar 1 01:43:02.731: DHCPD:
BOOTREQUEST from 0100.2264.4bab.eb forwarded to 192.168.20.1.
*Mar 1 01:43:02.735: DHCPD: incoming interface name is Vlan20
*Mar 1 01:43:02.735: DHCPD:
forwarding BOOTREPLY to client 0022.644b.abeb.
*Mar 1 01:43:02.735: old_giaddr = 0.0.0.0, giaddr=0.0.0.0, flag=0
*Mar 1 01:43:02.735: DHCPD: Option82 is currently:
*Mar 1 01:43:02.735: 020c020a0000c0a80afe0a000000
*Mar 1 01:43:02.735: DHCPD: Removing option82 information
*Mar 1 01:43:02.735: DHCPD: Option82 is removed
*Mar 1 01:43:02.735: DHCPD:
broadcasting BOOTREPLY to client 0022.644b.abeb.
四、应用场景
当使用Windows2003、Windows2008、Linux等为DHCP Server,并且和PC不在同一网段时;