215917510.png

拓扑图如上图所示,R1作为交换机,DS1作为多层交换机,AS1,AS2模拟主机。AS1,AS2都自动获取ip地址,并将R1当作dhcp服务器。

R1其配置如下:
ip dhcp excluded-address 192.168.3.1
ip dhcp excluded-address 192.168.3.2
ip dhcp pool net2

network 192.168.1.0 255.255.255.0

ip dhcp pool net3

network 192.168.2.0 255.255.255.0

no ip domain lookup
interface Loopback0

ip address 1.1.1.1 255.255.255.255

interface FastEthernet0/0

ip address 192.168.3.1 255.255.255.0

router eigrp 1
network 1.1.1.1 0.0.0.0
network 192.168.3.0
DS1的配置如下:
ip routing
interface FastEthernet0/0

no switchport

ip address 192.168.3.2 255.255.255.0    

interface FastEthernet0/1
switchport access vlan 2

no ip address

interface FastEthernet0/2
switchport access vlan 3

no ip address

interface Vlan2

ip address 192.168.1.1 255.255.255.0

ip helper-address 192.168.3.2//由于dhcp是以广播的形式向外发送的,而路由器以及三层交换机是抑制广播域的,所以要在接口上配置一个辅助接口,来转发广播

interface Vlan3

ip address 192.168.2.1 255.255.255.0

ip helper-address 192.168.3.2        

router eigrp 1
network 192.168.1.0
network 192.168.2.0
network 192.168.3.0
auto-summary
AS1的配置如下:
no ip routing
int f0/0
ip add dhcp
no shutdown
ip default-gateway 192.168.1.1
AS2的配置如下:
no ip routing
int f0/0
ip add dhcp
no shutdown
ip default-gateway 192.168.2.1