此实验使用Cisco Packet Tracer制作

Cisco-三层VLAN+DHCP实验案例

Cisco-DHCP中继实验案例_CISCO

说明:某公司有三个部门,划分三个VLAN进行隔离,IP地址通过vlan40中的DHCP服务器进行下发,保证各个部门的主机获取到IP地址,通过三层交换机的路由访问外部网络。

IP地址规划表

设备

接口

地址

Switch31

VLAN 10

192.168.10.254/24

Switch31

VLAN 20

192.168.20.254/24

Switch31

VLAN 30

192.168.30.254/24

Switch31

VLAN 40

192.168.40.254/24

Switch31

FastEthernet0/4

200.100.10.1/30

R1

GigabitEthernet0/0

200.100.20.1/24

R1

GigabitEthernet0/1

200.100.10.2/30

DHCP-Server

FastEthernet0

192.168.40.1/24

PC0

FastEthernet0

200.100.20.1/24

PC1-3

FastEthernet0

DHCP获取

PC4-6

FastEthernet0

DHCP获取

PC7-9

FastEthernet0

DHCP获取

接口规划表

本端设备

接口

端口类型

对端设备

接口

Switch31

FastEthernet0/1

Trunk

Switch0

FastEthernet0/4

Switch31

FastEthernet0/2

Trunk

Switch1

FastEthernet0/4

Switch31

FastEthernet0/3

Trunk

Switch2

FastEthernet0/4

Switch31

FastEthernet0/4

Access

DHCP-Server

FastEthernet0

Switch31

FastEthernet0/5

R1

GigabitEthernet0/1

R1

GigabitEthernet0/0

PC0

FastEthernet0

Switch0

FastEthernet0/1

Access

PC1

FastEthernet0

Switch0

FastEthernet0/2

Access

PC2

FastEthernet0

Switch0

FastEthernet0/3

Access

PC3

FastEthernet0

Switch1

FastEthernet0/1

Access

PC4

FastEthernet0

Switch1

FastEthernet0/1

Access

PC5

FastEthernet0

Switch1

FastEthernet0/1

Access

PC6

FastEthernet0

Switch2

FastEthernet0/1

Access

PC7

FastEthernet0

Switch2

FastEthernet0/1

Access

PC8

FastEthernet0

Switch2

FastEthernet0/1

Access

PC9

FastEthernet0

项目实施

一、配置各接口所属VLAN和地址

#Switch31的配置

Switch31(config)#vlan 10
Switch31(config-vlan)#vlan 20
Switch31(config-vlan)#vlan 30
!
Switch31(config)interface FastEthernet0/1
Switch31(config-if)switchport mode trunk
Switch31(config-if)#switchport trunk allowed vlan 10
!
Switch31(config)interface FastEthernet0/2
Switch31(config-if)switchport mode trunk
Switch31(config-if)#switchport trunk allowed vlan 20
!
Switch31(config)interface FastEthernet0/3
Switch31(config-if)switchport mode trunk
Switch31(config-if)#switchport trunk allowed vlan 30
!
Switch31(config)interface FastEthernet0/4
Switch31(config-if)#no switchport
Switch31(config-if)#ip address 200.100.10.1 255.255.255.0
!
Switch31(config)interface FastEthernet0/5
Switch31(config-if)switchport mode access
Switch31(config-if)#switchport access vlan 40
!
Switch31(config)#int vlan 10
Switch31(config-if)#ip address 192.168.10.254 255.255.255.0
!
Switch31(config)#int vlan 20
Switch31(config-if)#ip address 192.168.20.254 255.255.255.0
!
Switch31(config)#int vlan 30
Switch31(config-if)#ip address 192.168.30.254 255.255.255.0
!
Switch31(config)#int vlan 40
Switch31(config-if)#ip address 192.168.40.254 255.255.255.0

R1的配置

Router1(config)#interface GigabitEthernet0/0
Router1(config-if)#ip address 200.100.20.1 255.255.255.0
!
Router1(config)#interface GigabitEthernet0/1
Router1(config-if)#ip address 200.100.10.2 255.255.255.0

Switch1的配置

Switch0(config)#vlan 10
Switch0(config-vlan)#exit
!
Switch0(config)#interface FastEthernet0/4
Switch0(config-if)#switchport mode trunk
Switch0(config-if)#switchport trunk allowed vlan 10
!
Switch0(config)#interface range fa0/1 - fa0/3
Switch0(config-if-range)#switchport mode access
Switch0(config-if-range)#switchport access vlan 10

Switch2的配置

Switch0(config)#vlan 20
Switch0(config-vlan)#exit
!
Switch0(config)#interface FastEthernet0/4
Switch0(config-if)#switchport mode trunk
Switch0(config-if)#switchport trunk allowed vlan 20
!
Switch0(config)#interface range fa0/1 - fa0/3
Switch0(config-if-range)#switchport mode access
Switch0(config-if-range)#switchport access vlan 20

Switch3的配置

Switch0(config)#vlan 30
Switch0(config-vlan)#exit
!
Switch0(config)#interface FastEthernet0/4
Switch0(config-if)#switchport mode trunk
Switch0(config-if)#switchport trunk allowed vlan 30
!
Switch0(config)#interface range fa0/1 - fa0/3
Switch0(config-if-range)#switchport mode access
Switch0(config-if-range)#switchport access vlan 30

二、配置DHCP服务器

Cisco-DHCP中继实验案例_网络技术_02

翻译乃个人理解,并非纯翻译!!!

Cisco-DHCP中继实验案例_IP_03

Cisco-DHCP中继实验案例_网络技术_04

三、配置DHCP中继

此拓扑中DHCP中继的作用是为了实现在不同子网中实现转发DHCP信息的功能。

#Switch31的配置

Switch31(config)#int vlan 10
Switch31(config-if)#ip address 192.168.10.254 255.255.255.0
Switch31(config-if)#ip helper-address 192.168.40.1
!
Switch31(config)#int vlan 20
Switch31(config-if)#ip address192.168.20.254 255.255.255.0
Switch31(config-if)#ip helper-address 192.168.40.1
!
Switch31(config)#int vlan 30
Switch31(config-if)#ip address 192.168.30.254 255.255.255.0
Switch31(config-if)#ip helper-address 192.168.40.1

四、配置路由实现内部网络访问外部网络

#Switch31的配置

Switch31(config)#ip route 0.0.0.0 0.0.0.0 200.100.10.2

R1的配置

Router1(config)#ip route 192.168.0.0 255.255.0.0 200.100.10.1

项目效果

VLAN 10内DHCP下发地址的效果

Cisco-DHCP中继实验案例_网络技术_05

VLAN 20内地址下发的效果

Cisco-DHCP中继实验案例_Access_06

VLAN 30内DHCP下发地址的效果

Cisco-DHCP中继实验案例_DHCP_07

DHCP中继效果

Cisco-DHCP中继实验案例_IP_08

路由的效果

Cisco-DHCP中继实验案例_DHCP_09

Cisco-DHCP中继实验案例_IP_10


Cisco-DHCP中继实验案例_DHCP_11