中兴vrrp及mstp多生成树+DHCP详解

目录

  1. vrrp及mstp多生成树+DHCP拓扑图

  2. IP地址规划表

  3. 介绍说明

• 3.1. MSTP简介

• 3.2. VRRP简介

• 3.2. DHCP简介

  1. 设备配置命令详情

4.1. 核心交换机1命令配置详情

4.2. 核心交换机2命令配置详情

4.3. 接入交换机1命令配置详情

4.4. 接入交换机2命令配置详情

  1. 总结

5.1. sw1分析总结

5.2. sw2分析总结

5.3. 步骤总结

  1. vrrp及mstp多生成树+DHCP拓扑图

中兴vrrp及mstp多生成树+DHCP详解_第1张图片

  1. IP地址规划表

中兴vrrp及mstp多生成树+DHCP详解_第2张图片

  1. 介绍说明
    • 3.1. MSTP简介

MSTP(多生成树协议)是在STP的基础上发展而来的,用于在局域网中消除数据链路层的物理环路,作为一种二层协议,MSTP通过选择性的阻塞网络中的冗余链路来消除二层环路,将环路网络结构修剪无环路的树型网络结构,从而防止在环路网络中不断增生和无限循环,避免设备由于重复接收相同报文造成报文处理能力的下降;同时,它还具备链路备份的能力。与STP相比,MSTP可以实现网络拓扑的快速收敛,也能使不同VLAN的流量沿各自的路径转发,从而为冗余链路提供了更好的负载分担机制。
• 3.2. VRRP简介

VRRP用来为网关设备提供冗余备份。VRRP将可以承担网关功能的一组设备加入到备份组中,形成一台虚拟路由器,局域网内的主机将此虚拟路由器设置为缺省网关。VRRP根据优先级从备份组中选举一台网关设备作为Master,负责转发局域网内主机与外部通信的流量,其他网关设备作为Backup。当Master出现故障后,VRRP重新选举新的Master,保证流量转发不会中断。

• 3.3. DHCP简介
DHCP(动态主机配置协议)是一个局域网的网络协议。指的是由服务器控制一段IP地址范围,客户机登录服务器时就可以自动获得服务器分配的IP地址和子网掩码。默认情况下,DHCP作为Windows Server的一个服务组件不会被系统自动安装,还需要管理员手动安装并进行必要的配置

  1. 设备配置命令详情

4.1. 核心交换机1命令配置详情
En
Conf t
//进入配置模式
Hostname sw1
//修改主机名sw1
Exit
Vlan 10
Exit
//创建vlan10
Vlan 20
Exit
//创建vlan20
Vlan 30
Exit
//创建vlan30
Vlan 1000
Exit
//创建vlan1000
Int vlan 1000
//进入vlan1000
Ip address 10.0.0.252 255.255.255.0
//配置vlan1000的IP地址
exit
Int vlan 10
//进入vlan10
Ip address 192.168.1.252 255.255.255.0
//配置vlan10的IP地址

Eixt
Int valn 20
//进入vlan20
Ip address 192.168.2.252 255.255.255.0
//配置vlan20的IP地址
Eixt
Int vlan 30
//进入vlan30
Ip address 192.168.3.252 255.255.255.0
//配置vlan30的IP地址
Exit
Int loopback1
Ip address 1.1.1.1 255.255.255.255
//创建loopback1和loopback1的地址
Exit
Int gei_1/3
Switchport mode trunk
Switchport trunk vlan 10 ,20 ,30,1000
Exit
//给接口gei_1/3添加trunk口类型
interface smartgroup 1
exit
interface gei_1/1
smartgroup 1 mode on
interface gei_1/2
smartgroup 1 mode on
exit
interface smartgroup 1
switchport mode trunk
switchport trunk vlan 10, 20, 30 ,1000
//创建聚合组1形成一个逻辑接口,把gei_1/1-2加入聚合组
Int gei_1/4
Switchport mode trunk
Switchport trunk vlan 10,20, 30, 1000
//给接口gei_1/4加trunk口类型
Interface vlan 10
Vrrp 1 ip 192.168.1.254
vrrp 1 priority 254
Interface vlan 20
Vrrp 1 ip 192.168.2.254
vrrp 1 priority 254
interface vlan 1000
vrrp 1 ip 10.0.0.254
vrrp 1 priority 254
interface vlan 30
vrrp 1 ip 192.168.3.254
vrrp 1 priority 254
//创建vlan10,20,30,1000的vrrp,优先级都为254
spanning-tree enable
spanning-tree mode mstp
spanning-tree mstp configuration
name instance1
revision 1
instance 1 vlans 10,20,30,1000
spanning-tree mst instance 1 priority 4096
//创建多生成树mstp实例1,实例1的优先级4096
exit
conf t
ip route 2.2.2.2 255.255.255.255 192.168.1.253
exit
//引入路由,指向核心2交换机

配置地址池
Conf t
Ip pool vlan10
//ip地址池名称为vlan10
Range 192.168.1.10 192.168.1.240 255.255.255.0
Ip pool vlan 20
Range 192.168.2.10 192.168.1.240 255.255.255.0
Ip pool vlan 30
Range 192.168.3.10 192.168.1.240 255.255.255.0
//在IP池中设置要分配的ip地址范围,一个ip池可以设置多个ip段
创建dhcp池,一个dhcp pool 可以绑定一个ip pool
IP dhcp pool vlan10
//创建dhcp pool 名称为vlan10,多个dhcp池可重复创建
Default-router 192.168.1.1
//设置默认网关
Dns-server 192.168.0.1 114.114.114.114
//配置dns服务器
Lease-time 1 0 0
//设置租约时间,为1天0分0秒
IP-pool vlan10
//把ip pool绑定到dhcp pool 里面
Ip dhcp pool vlan 20
Defult-router 192.168.2.1
Dns-server 192.168.0.1 114.114.114.114
Lease-time 1 0 0
Ip-pool vlan20
Ip dhcp pool vlan 30
Defult-router 192.168.3.1
Dns-server 192.168.0.1 114.114.114.114
Lease-time 1 0 0
Ip-pool vlan 30
启用dhcp进程
Ip dhcp enable
ip dhcp ramble
ip dhcp logging on
Interface vlan 10
//在vlan接口中设置dhcp模式,并绑定pollicy
Ip dhcp mode server
//启用接口的dhcp工作模式
Ip dhcp policy vlan 10
//在接口上绑定policy
Interface vlan 20
Ip dhcp mode server
Ip dhcp policy vlan 20
Intterface vlan 30
Ip dhcp mode server
Ip dhcp policy vlan 30
ip dhcp policy vlan10 1
dhcp-pool vlan10
ip dhcp policy vlan20 1
dhcp-pool vlan20
ip dhcp policy vlan30 1
dhcp-pool vlan30

尝试主机自动获取IP地址
中兴vrrp及mstp多生成树+DHCP详解_第3张图片
中兴vrrp及mstp多生成树+DHCP详解_第4张图片
中兴vrrp及mstp多生成树+DHCP详解_第5张图片
中兴vrrp及mstp多生成树+DHCP详解_第6张图片

4.2. 核心交换机2命令配置详情
En
Conf t
//进入配置模式
Hostname sw2
//修改主机名sw2
Exit
Vlan 10
Exit
//创建vlan10
Vlan 20
Exit
//创建vlan20
Vlan 30
Exit
//创建vlan30
Vlan 1000
Exit
//创建vlan1000
Int vlan 1000
//进入vlan1000
Ip address 10.0.0.253 255.255.255.0
//配置vlan1000的IP地址
exit
Int vlan 10
//进入vlan10
Ip address 192.168.1.253 255.255.255.0
//配置vlan10的IP地址

Eixt
Int valn 20
//进入vlan20
Ip address 192.168.2.253 255.255.255.0
//配置vlan20的IP地址
Eixt
Int vlan 30
//进入vlan30
Ip address 192.168.3.253 255.255.255.0
//配置vlan30的IP地址
Exit
Int loopback1
Ip address 2.2.2.2 255.255.255.255
//创建loopback1和loopback1的地址
Exit
Int gei_1/3
Switchport mode trunk
Switchport trunk vlan 10 ,20 ,30,1000
Exit
//给接口gei_1/3添加trunk口类型
interface smartgroup 1
exit
interface gei_1/1
smartgroup 1 mode on
interface gei_1/2
smartgroup 1 mode on
exit
interface smartgroup 1
switchport mode trunk
switchport trunk vlan 10, 20, 30 ,1000
//创建聚合组1形成一个逻辑接口,把gei_1/1-2加入聚合组
Int gei_1/4
Switchport mode trunk
Switchport trunk vlan 10,20, 30, 1000
//给接口gei_1/4加trunk口类型
Interface vlan 10
Vrrp 1 ip 192.168.1.254
Interface vlan 20
Vrrp 1 ip 192.168.2.254
interface vlan 1000
vrrp 1 ip 10.0.0.254
interface vlan 30
vrrp 1 ip 192.168.3.254
//创建vlan10,20,30,1000的vrrp,优先级默认
spanning-tree enable
spanning-tree mode mstp
spanning-tree mstp configuration
name instance 0
revision 1
instance 0 vlans 10,20,30,1000
//创建多生成树mstp实例0,默认优先级
conf t
ip route 1.1.1.1 255.255.255.255 192.168.1.252
exit
//引入路由,指向核心1交换机

配置地址池
Conf t
Ip pool vlan10
//ip地址池名称为vlan10
Range 192.168.1.10 192.168.1.240 255.255.255.0
Ip pool vlan 20
Range 192.168.2.10 192.168.1.240 255.255.255.0
Ip pool vlan 30
Range 192.168.3.10 192.168.1.240 255.255.255.0
//在IP池中设置要分配的ip地址范围,一个ip池可以设置多个ip段
创建dhcp池,一个dhcp pool 可以绑定一个ip pool
IP dhcp pool vlan10
//创建dhcp pool 名称为vlan10,多个dhcp池可重复创建
Default-router 192.168.1.1
//设置默认网关
Dns-server 192.168.0.1 114.114.114.114
//配置dns服务器
Lease-time 1 0 0
//设置租约时间,为1天0分0秒
IP-pool vlan10
//把ip pool绑定到dhcp pool 里面
Ip dhcp pool vlan 20
Defult-router 192.168.2.1
Dns-server 192.168.0.1 114.114.114.114
Lease-time 1 0 0
Ip-pool vlan20
Ip dhcp pool vlan 30
Defult-router 192.168.3.1
Dns-server 192.168.0.1 114.114.114.114
Lease-time 1 0 0
Ip-pool vlan 30
启用dhcp进程
Ip dhcp enable
ip dhcp ramble
ip dhcp logging on
Interface vlan 10
//在vlan接口中设置dhcp模式,并绑定pollicy
Ip dhcp mode server
//启用接口的dhcp工作模式
Ip dhcp policy vlan 10
//在接口上绑定policy
Interface vlan 20
Ip dhcp mode server
Ip dhcp policy vlan 20
Intterface vlan 30
Ip dhcp mode server
Ip dhcp policy vlan 30
ip dhcp policy vlan10 1
dhcp-pool vlan10
ip dhcp policy vlan20 1
dhcp-pool vlan20
ip dhcp policy vlan30 1
dhcp-pool vlan30

尝试主机自动获取IP地址
中兴vrrp及mstp多生成树+DHCP详解_第7张图片
中兴vrrp及mstp多生成树+DHCP详解_第8张图片

4.3. 接入交换机1命令配置详情
En

Set vlan 10 enable
Set vlan 20 enable
Set vlan 30 enable
Set vlan 1000 enable
//创建vlan 10,20,30,1000
Set vlan 10 add port 23-24 tag
Set vlan 20 add port 23-24 tag
Set vlan 30 add port 23-24 tag
Set vlan1000 add port 23-24 tag
//vlan10,20,30,1000添加上行接口23,24
Set vlan 10 add port 1-5 untag
Set vlan 20 add port 6-10 untag
//vlan10,20添加物理接口1-5,6-10
Set port 1-5 pvid 10
Set port 6-10 pvid 20
//相应的接口打上标签

Config route
Set ipport 0 enable
Set ipport 0 vlan 1000
Set ipport 0 ipaddress 10.0.0.1 255.255.255.0
Iproute 0.0.0.0 0.0.0.0 10.0.0.254
Exit
//开启三层接口,创建管理vlan

Spanning-tree enable
Spanning-tree mode mstp
Spanning-tree mst configuration
Name instance1
Revision 1
Instance 1 vlans 10,20,30,1000
//创建多生成树
Exit
Write

4.4. 接入交换机2命令配置详情
En

Set vlan 30 enable
Set vlan 10 enable
Set vlan 20 enable
Set vlan 1000 enable
//创建vlan10,20,30,1000
Set vlan 30 add port 23-24 tag
Set vlan 10 add port 23-24 tag
Set vlan 20 add port 23-24 tag
Set vlan 1000 add port 23-24 tag
//vlan10,20,30,1000添加上行接口23,24
Set vlan 10 add port 1-5 untag
Set vlan 30 add port 6-10 untag
//vlan10,30添加物理接口1-5,6-10
Set port 1-5 pvid 10
Set port 6-10 pvid 30
//相应的接口打上标签

Config route
Set ipport 0 enable
Set ipport 0 vlan 1000
Set ipport 0 ipaddress 10.0.0.2 255.255.255.0
Iproute 0.0.0.0 0.0.0.0 10.0.0.254
Exit
//开启三层接口,创建管理vlan
Spanning-tree enable
Spanning-tree mode mstp
Spanning-tree mst configuration
Name instance1
Revision 1
Instance 1 vlans 10,20,30,1000
//创建多生成树
Exit
Write

  1. 总结
    5.1. sw1分析总结
    sw1#show ip interface brief
    Interface IP-Address Mask AdminStatus PhyStatus Protocol
    loopback1 1.1.1.1 255.255.255.255 up up up
    vlan1 unassigned unassigned up up up
    vlan10 192.168.1.252 255.255.255.0 up up up
    vlan20 192.168.2.252 255.255.255.0 up up up
    vlan30 192.168.3.252 255.255.255.0 up up up
    vlan1000 10.0.0.252 255.255.255.0 up up up

//进行show接口,可以查看当前接口的简要信息

sw1#show spanning-tree instance 1

MST01
Spanning tree enabled protocol MSTP
RegRootID: Priority 4097; Address 0c12.62b2.3d54
Hello-Time 2 sec; Max-Age 20 sec
Forward-Delay 15 sec;

BridgeID: Priority 4097; Address 0c12.62b2.3d54
Hello-Time 2 sec; Max-Age 20 sec
Forward-Delay 15 sec; Max-Hops 20
Message-Age 0 sec; RemainHops 20

Interface Prio.Nbr
Name Port ID Cost Sts Role Type Bound

gei_1/3 128.2 20000 Forward Master p2p MSTP
smartgroup1 128.1 10000 Forward Designated p2p MSTP

//进行show生成树实例,查看接口多生成树状态,角色是主还是备。

show vrrp brief
Interface total: 4, Group total: 4, Master total: 4
Interface Grp Ver Pri Time Own Pre State Master-addr Group-addr
vlan1000 1 2 254 3.007 N Y Master 10.0.0.252 10.0.0.254
vlan30 1 2 254 3.007 N Y Master 192.168.3.252 192.168.3.254
vlan20 1 2 254 3.007 N Y Master 192.168.2.252 192.168.2.254
vlan10 1 2 254 3.007 N Y Master 192.168.1.252 192.168.1.254

//进行show vrrp的简要信息

sw1#show interface brief
Interface portattribute mode BW(Mbits) Admin Phy Prot Description
gei_1/1 electric Duplex/full 1000 up up up none
gei_1/2 electric Duplex/full 1000 up up up none
gei_1/3 electric Duplex/full 1000 up up up none
gei_1/4 electric Duplex/full 1000 up down down none
gei_1/5 electric Duplex/full 1000 up down down none
gei_1/6 electric Duplex/full 1000 up down down none
gei_1/7 electric Duplex/full 1000 up down down none
gei_1/8 electric Duplex/full 1000 up down down none
gei_1/9 electric Duplex/full 1000 up down down none
gei_1/10 electric Duplex/full 1000 up down down none

//进行show接口的,可查看接口的情况信息
5.2. sw2分析总结
sw2#show vrrp brief
Interface total: 3, Group total: 3, Master total: 0
Interface Grp Ver Pri Time Own Pre State Master-addr Group-addr
vlan1000 1 2 100 3.609 N Y Backup 10.0.0.252 10.0.0.254
vlan30 1 2 100 3.609 N Y Backup 192.168.3.252 192.168.3.254
vlan10 1 2 100 3.609 N Y Backup 192.168.1.252 192.168.1.254

//进行show vrrp的简要信息

sw2#show spanning-tree instance 0
MST00
Spanning tree enabled protocol MSTP
Root ID: Priority 32768; Address 0019.c631.e1f8
Hello-Time 2 sec; Max-Age 20 sec
Forward-Delay 15 sec;

RegRootID: Priority 32768; Address 0c12.62b2.3d54

BridgeID: Priority 32768; Address 0c12.62b2.3d5c
Hello-Time 2 sec; Max-Age 20 sec
Forward-Delay 15 sec; Max-Hops 20
Message-Age 1 sec; RemainHops 19
Interface Prio.Nbr
Name Port ID Cost Sts Role Type Bound

gei_1/4 128.2 20000 Discard Alternate p2p MSTP
smartgroup1 128.1 10000 Forward Root p2p MSTP

//进行show生成树实例,查看接口多生成树状态,角色是主还是备。

sw2#show interface brief
Interface portattribute mode BW(Mbits) Admin Phy Prot Description
gei_1/1 electric Duplex/full 1000 up up up none
gei_1/2 electric Duplex/full 1000 up up up none
gei_1/3 electric Duplex/full 1000 up down down none
gei_1/4 electric Duplex/full 1000 up up up none
gei_1/5 electric Duplex/full 1000 up down down none
gei_1/6 electric Duplex/full 1000 up down down none
gei_1/7 electric Duplex/full 1000 up down down none
gei_1/8 electric Duplex/full 1000 up down down none
gei_1/9 electric Duplex/full 1000 up down down none
gei_1/10 electric Duplex/full 1000 up down down none

//进行show接口,可查看接口情况信息

5.3. 步骤总结
MSTP+VRRP+DHCP配置步骤
1、配置交换机的基本配置,例如接口信息、主机名等
2、配置交换机聚合链路为samartgroup1
3、配置主VRRP ID、虚拟IP、优先级,然后设置备VRRP的虚拟IP、优先级(此处的优先级一定要比主设备的低)
4、配置MSTP,进入MSTP配置接口、配置name、实例映射、激活,退出后设置主备
5、配置DHCP,创建IP地址池,DHCP池,开启DHCP服务,在接口上绑定policy
5、配置完成

你可能感兴趣的:(中兴交换机学习,交换机,网络)