实验需求:


实验使用网段192.168.10.0/24分配IP地址,划分vlan 10~13,每个vlan不超过50台主机,配置MSTP协议实现负载均衡、配置VRRP协议实现网关备份,使用静态路由实现全网互通,在路由器上配置DHCP分发IP地址


实验目的:


1、掌握子网划分

2、掌握MSTP协议配置及使用场景

3、掌握VRRP协议配置及使用场景

4、掌握DHCP服务器及中继配置

5、掌握静态路由器的配置及使用场景


实验拓扑:

Cisco使用MST+VRRP+静态路由+子网划分+DHCP配置案例_ip地址




子网划分:


IOU4

e0/0:172.16.1.1/24


e0/1:172.16.1.2/24


loo0:1.1.1.1/24


IOU1

vlan10:192.168.10.60/26

虚拟ip:192.168.10.62

vlan11:192.168.10.124/26

虚拟ip:192.168.10.126

vlan12:192.168.10.188/26

虚拟ip:192.168.10.190

vlan13:192.168.10.252/26

虚拟ip:192.168.10.254

IOU2

vlan10:192.168.10.61/26

虚拟ip:192.168.10.62

vlan10:192.168.10.125/26

虚拟ip:192.168.10.126

vlan10:192.168.10.189/26

虚拟ip:192.168.10.190

vlan10:192.168.10.253/26

虚拟ip:192.168.10.254


配置代码与注释:(重复代码不再注释,默认初始为特权模式)


IOU4:

配置接口:

config terminal         //进入全局模式

interface ethernet 0/0       //进入接口

duplex full    //配置全双工

ip address 172.16.1.1 255.255.255.0   //配置接口IP地址

no shutdown   //启用接口

interface ethernet 0/1

duplex full

ip address 172.16.2.1 255.255.255.0

no shutdown

exit   //退出

interface loopback 0   //进入本地回环接口0

ip address 1.1.1.1 255.255.255.0

no shutdown

exit

配置静态路由:

ip route 192.168.10.0 255.255.255.128 172.16.1.2   //配置静态路由

ip route 192.168.10.128 255.255.255.128 172.16.2.2

ip route 192.168.10.0 255.255.255.128 172.16.2.2 11    //配置浮动路由

ip route 192.168.10.128 255.255.255.128 172.16.1.2 11

配置DHCP服务池:

ip dhcp pool vlan10  //创建服务池,服务池名字可用VLAN号方便记忆

network 192.168.10.0 255.255.255.192  //配置网段

default-router 192.168.10.62  //配置网关

dns-server 8.8.8.8  //配置DNS服务器

exit

ip dhcp pool vlan11

network 192.168.10.64 255.255.255.192

default-router 192.168.10.126

dns-server 8.8.8.8

exit

ip dhcp pool vlan12

network 192.168.10.128 255.255.255.192

default-router 192.168.10.190

dns-server 8.8.8.8

exit

ip dhcp pool vlan13

network 192.168.10.192 255.255.255.192

default-router 192.168.10.254

dns-server 8.8.8.8

exit

查看路由表:

exit

show ip route

Cisco使用MST+VRRP+静态路由+子网划分+DHCP配置案例_静态路由_02

IOU1:

配置接口:

configure terminal

interface range ethernet 0/0 - 3  //批量配置接口

switchport trunk encapsulation dot1q  //配置封装

switchport mode trunk  //配置干道模式

exit

配置链路冗余:

interface range ethernet 0/1 - 2

channel-group 1 mode on  //建立组号

exit

interface port-channel 1

switchport trunk encapsulation dot1q

switchport mode trunk

exit

创建VLAN:

vlan 10-13

exit

配置MST:

spanning-tree mode mst  //启用mst生成树

spanning-tree mst configuration  //进入生成树配置

name cisigo  //取名

revision 1  //配置级别

instance 1 vlan 10,11  //配置实例

instance 2 vlan 12,13

exit

spanning-tree mst 1 root primary  //配置根网桥

spanning-tree mst 2 root secondary

配置VRRP:

track 100 interface ethernet 0/3 line-protocol  //配置端口追踪

interface vlan 10

ip address 192.168.10.60 255.255.255.192

vrrp 10 ip 192.168.10.62 //配置虚拟ip

vrrp 10 priority 110 //配置优先级

vrrp 10 preempt  //配置占先权

vrrp 10 track 100 decrement 30  //追踪端口关闭时降低优先级

no shutdown

interface vlan 11

ip address 192.168.10.124 255.255.255.192

vrrp 11 ip 192.168.10.126

vrrp 11 priority 110

vrrp 11 preempt

vrrp 11 track 100 decrement 30

no shutdown

interface vlan 12

ip address 192.168.10.188 255.255.255.192

vrrp 12 ip 192.168.10.190

vrrp 12 priority 90

vrrp 12 preempt

no shutdown

interface vlan 13

ip address 192.168.10.252 255.255.255.192

vrrp 13 ip 192.168.10.254

vrrp 13 priority 90

vrrp 13 preempt

no shutdown

exit

配置三层接口:

interface ethernet 0/3

no switchport  //启用三层接口

ip address 172.16.1.2 255.255.255.0

no shutdown

exit

配置静态路由:

ip routing  //启用路由功能

ip route 0.0.0.0 0.0.0.0 172.16.1.1

配置DHCP中继:

interface vlan 10

ip helper-address 1.1.1.1  //配置服务池地址

interface vlan 11

ip helper-address 1.1.1.1

exit

查看配置(IOU2与IOU1同,不再赘述):

exit

show interfaces trunk //查看接口封装

Cisco使用MST+VRRP+静态路由+子网划分+DHCP配置案例_静态路由_03

show vlan brief   //查看VLAN

Cisco使用MST+VRRP+静态路由+子网划分+DHCP配置案例_ip地址_04

IOU2:

配置接口:

configure terminal

interface range ethernet 0/0 - 3

switchport trunk encapsulation dot1q

switchport mode trunk

exit

配置链路冗余:

interface range ethernet 0/1 - 2

channel-group 1 mode on

exit

interface port-channel 1

switchport trunk encapsulation dot1q

switchport mode trunk

exit

创建VLAN:

vlan 10-13

exit

配置MST:

spanning-tree mode mst

spanning-tree mst configuration

name cisigo

revision 1

instance 1 vlan 10,11

instance 2 vlan 12,13

exit

spanning-tree mst 1 root secondary

spanning-tree mst 2 root primary

配置VRRP:

track 100 interface ethernet 0/3 line-protocol

interface vlan 10

ip address 192.168.10.61 255.255.255.192

vrrp 10 ip 192.168.10.62

vrrp 10 priority 90

vrrp 10 preempt

no shutdown

interface vlan 11

ip address 192.168.10.125 255.255.255.192

vrrp 11 ip 192.168.10.126

vrrp 11 priority 90

vrrp 11 preempt

no shutdown

interface vlan 12

ip address 192.168.10.189 255.255.255.192

vrrp 12 ip 192.168.10.190

vrrp 12 priority 110

vrrp 12 preempt

vrrp 12 track 100 decrement 30

no shutdown

interface vlan 13

ip address 192.168.10.253 255.255.255.192

vrrp 13 ip 192.168.10.254

vrrp 13 priority 110

vrrp 13 preempt

vrrp 13 track 100 decrement 30

no shutdown

exit

配置三层接口:

interface ethernet 0/3

no switchport

ip address 172.16.2.2 255.255.255.0

no shutdown

exit

配置静态路由:

ip routing

ip route 0.0.0.0 0.0.0.0 172.16.2.1

配置DHCP中继:

interface vlan 12

ip helper-address 1.1.1.1

interface vlan 13

ip helper-address 1.1.1.1

exit

IOU3:

configure terminal

创建VLAN:

vlan 10-13

exit

配置接口:

interface range ethernet 1/0 - 1

switchport trunk encapsulation dot1q

switchport mode trunk

exit

interface ethernet 0/0

switchport mode access  //配置access模式

switchport access vlan10  //配置接入VLAN

interface ethernet 0/1

switchport mode access

switchport access vlan11

interface ethernet 0/2

switchport mode access

switchport access vlan12

interface ethernet 0/3

switchport mode access

switchport access vlan13

exit

配置MST:

spanning-tree mode mst

spanning-tree mst configuration

name cisigo

revision 1

instance 1 vlan 10,11

instance 2 vlan 12,13

exit

查看配置:

exit

show spanning-tree mst 1  //查看MST配置

Cisco使用MST+VRRP+静态路由+子网划分+DHCP配置案例_ip地址_05

show spanning-tree mst 2

Cisco使用MST+VRRP+静态路由+子网划分+DHCP配置案例_ip地址_06

PC验证结果(实验中用路由器代替):

配置接口(等效于配置PC IP)

config terminal

interface ethernet 0/0

duplex full

ip address dhcp   //DHCP请求

no shutdown

exit

Cisco使用MST+VRRP+静态路由+子网划分+DHCP配置案例_ip地址_07

验证连通性:(配图以IOU5为例)

exit

ping 1.1.1.1  //ping命令测试连通性

Cisco使用MST+VRRP+静态路由+子网划分+DHCP配置案例_ip地址_08

ping 192.168.10.193

Cisco使用MST+VRRP+静态路由+子网划分+DHCP配置案例_使用场景_09