一、实验要求
实验拓扑图如上图所示
1、按照图示的VLAN及IP地址需求,完成相关配置
2、要求SW1为VLAN 2/3的主根及主网关
SW2为vlan 20/30的主根及主网关
SW1和SW2互为备份
3、可以使用super vlan(本实验未使用)
4、上层通过静态路由协议完成数据通信过程
5、AR1为企业出口路由器
6、要求全网可达
二、实验思路
1、先从交换机下手,将与PC连接的交换机SW3、SW4的VLAN相关配置先配好,然后再配置交换机间相连的配置(SW1、SW2),然后配置三层交换机(交换机与路由器之间的链路配置)
2、在SW1和SW2间的链路配置链路聚合
3、在交换机网络中,配置STP协议,防止链路成环
4、设置交换机的主根和主网关,以及它们的备份
5、配置VRRP、配置路由器的接口ip地址、自己的环回接口、还有静态路由
6、R1为出口路由器,故要在其出口接口配置NAT
7、完善其余步骤达到全网可通
三、实验步骤
1.在LSW3上:
LSW3上需要添加VLAN、划分接口等操作
[LSW3]vlan batch 2 3 20 30
[LSW3]INT G0/0/1
[LSW3-GigabitEthernet0/0/1]port link-type access
[LSW3-GigabitEthernet0/0/1]port default vlan 2
[LSW3-GigabitEthernet0/0/1]int g0/0/2
[LSW3-GigabitEthernet0/0/2]port link-type access
[LSW3-GigabitEthernet0/0/2]port default vlan 3
将LSW3的接口0/0/3和0/0/4配置成trunk,并开通VLAN 2 3 20 30
[LSW3-GigabitEthernet0/0/2]int g0/0/3
[LSW3-GigabitEthernet0/0/3]port link-type trunk
[LSW3-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 3 20 30
[LSW3-GigabitEthernet0/0/3]int g0/0/4
[LSW3-GigabitEthernet0/0/4]port link-type trunk
[LSW3-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3 20 40

启动mstp并配置相同的预配置region-configuration
[LSW3]stp enable
[LSW3]stp mode mstp
[LSW3]stp region-configuration
[LSW3-mst-region]region-name 3
[LSW3-mst-region]revision-level 100
[LSW3-mst-region]instance 1 vlan 2 to 3
[LSW3-mst-region]instance 2 vlan 20 30
[LSW3-mst-region]active region-configuration

2.在LSW4上:
LSW4上需要添加VLAN、划分接口等操作
[LSW4]vlan batch 2 3 20 30
[LSW4]int g0/0/2
[LSW4-GigabitEthernet0/0/2]port link-type access
[LSW4-GigabitEthernet0/0/2]port default vlan 30
[LSW4]int g0/0/1
[LSW4-GigabitEthernet0/0/1]port link-type access
[LSW4-GigabitEthernet0/0/1]port default vlan 20
[LSW4]int g0/0/4
[LSW4-GigabitEthernet0/0/4]port link-type trunk
[LSW4-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3 20 30
[LSW4]int g0/0/3
[LSW4-GigabitEthernet0/0/3]port link-type trunk
[LSW4-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 3 20 30


启动mstp并配置相同的预配置region-configuration
[LSW4]stp enable
[LSW4]stp mode mstp
[LSW4]stp region-configuration
[LSW4-mst-region]region-name 3
[LSW4-mst-region]revision-level 100
[LSW4-mst-region]instance 1 vlan 2 to 3
[LSW4-mst-region]instance 2 vlan 20 30
[LSW4-mst-region]active region-configuration

3.在LSW1上:
LSW1上需要添加VLAN、划分接口等操作
[LSW1]vlan batch 2 3 20 30
[LSW1]int g 0/0/3
[LSW1-GigabitEthernet0/0/3]port link-type trunk
[LSW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 3 20 30
[LSW1]int g0/0/4
[LSW1-GigabitEthernet0/0/4]port link-type trunk
[LSW1-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3 20 30
[LSW1]int Eth-Trunk 0
[LSW1-Eth-Trunk0]trunkport GigabitEthernet 0/0/1 to 0/0/2
[LSW1-Eth-Trunk0]port link-type trunk
[LSW1-Eth-Trunk0]port trunk allow-pass vlan 2 3 20 30


启动mstp并配置相同的预配置region-configuration

4.在LSW2上:
LSW2上需要添加VLAN、划分接口等操作
[LSW2]vlan batch 2 3 20 30
[LSW2]int g0/0/3
[LSW2-GigabitEthernet0/0/3]port link-type trunk
[LSW2-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 3 20 30
[LSW2-GigabitEthernet0/0/3]int g0/0/4
[LSW2-GigabitEthernet0/0/4]port link-type trunk
[LSW2-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3 20 30
[LSW2]int Eth-Trunk 0
[LSW2-Eth-Trunk0]trunkport GigabitEthernet 0/0/1 to 0/0/2
[LSW2-Eth-Trunk0]port link-type trunk
[LSW2-Eth-Trunk0]port trunk allow-pass vlan 2 3 20 30


启动mstp并配置相同的预配置region-configuration

主根与备份
LSW1成为主根
[LSW1]stp instance 1 root primary

LSW2成为备份
[LSW2]stp instance 2 root secondary

配置LSW1的VLANIF 2/3(主根)、VLANIF 20/30(备份根)
在交换机上分别设置IP,依次递增,例如LSW1为vlan2 10.0.2.1/24等,LSW2为10.0.2.2/24等
VLAN 2----->10.0.2.0/24
VLAN 3----->10.0.3.0/24
VLAN 20---->10.0.20.0/24
VLAN 30---->10.0.30.0/24
1.创建VLANif
LSW1(只修改IP地址,剩下的相同)
[LSW1]int Vlanif 2
[LSW1-Vlanif2]ip address 10.0.2.1 24 --设置IP地址
[LSW1-Vlanif2]vrrp vrid 1 virtual-ip 10.0.2.254 --配置VRRP
[LSW1-Vlanif2]vrrp vrid 1 priority 120 --设置优先级
[LSW1-Vlanif2]vrrp vrid 1 preempt-mode timer delay 20 --设置延迟时间
[LSW1-Vlanif2]vrrp vrid 1 track interface GigabitEthernet 0/0/5 reduced 30 --设置上行链路监控


LSW1是VLAN 20和30的备份根,所以要配置的很少,就ip地址和虚拟IP
[LSW1]interface Vlanif 20
[LSW1-Vlanif20]ip address 10.0.20.1 24
[LSW1-Vlanif20]vrrp vrid 1 virtual-ip 10.0.20.254
[LSW1]int Vlanif 30
[LSW1-Vlanif30]ip address 10.0.30.1 24
[LSW1-Vlanif30]vrrp vrid 1 virtual-ip 10.0.30.254

使用display命令查看配置

在LSW1的接口0/0/5上配置三层交换机
因为要与路由器R1进行连接,所以要进行额外的VLAN 配置
[LSW1]vlan 11
[LSW1-vlan11]int g0/0/5
[LSW1-GigabitEthernet0/0/5]port link-type access
[LSW1-GigabitEthernet0/0/5]port default vlan 11
[LSW1]int Vlanif 11
[LSW1-Vlanif11]ip address 10.0.0.1 30

配置LSW2的VLANIF 20/30(主根)、VLANIF 2/3(备份根)
因为LSW2是VLAN 2/3的备份根,配置少
[LSW2]int Vlanif 2
[LSW2-Vlanif2]ip address 10.0.2.2 24
[LSW2-Vlanif2]vrrp vrid 1 virtual-ip 10.0.2.254
[LSW2]int Vlanif 3
[LSW2-Vlanif3]ip address 10.0.3.2 24
[LSW2-Vlanif3]vrrp vrid 1 virtual-ip 10.0.3.254
LSW2为VLAN 20/30的主根,所以要配置优先级、延迟时间和上行链路监控
[LSW2]int Vlanif 20
[LSW2-Vlanif20]ip address 10.0.20.2 24
[LSW2-Vlanif20]vrrp vrid 1 virtual-ip 10.0.20.254
[LSW2-Vlanif20]vrrp vrid 1 priority 120
[LSW2-Vlanif20]vrrp vrid 1 preempt-mode timer delay 20
[LSW2-Vlanif20]vrrp vrid 1 track interface GigabitEthernet 0/0/5 reduced 30
[LSW2]int Vlanif 30
[LSW2-Vlanif30]ip address 10.0.30.2 24
[LSW2-Vlanif30]vrrp vrid 1 virtual-ip 10.0.30.254
[LSW2-Vlanif30]vrrp vrid 1 priority 120
[LSW2-Vlanif30]vrrp vrid 1 preempt-mode timer delay 20
[LSW2-Vlanif30]vrrp vrid 1 track interface GigabitEthernet 0/0/5 reduced 30


在LSW2的接口0/0/5上配置三层交换机
[LSW2]vlan 12
[LSW2-vlan12]int g0/0/5
[LSW2-GigabitEthernet0/0/5]port link-type access
[LSW2-GigabitEthernet0/0/5]port default vlan 12
[LSW2]int Vlanif 12
[LSW2-Vlanif12]ip address 10.0.0.5 30

配置OSPF
需要宣告VLAN2,3,20,30,LSW1宣告11,LSW2宣告12
[LSW1]ospf 1
[LSW1-ospf-1]area 0
[LSW1-ospf-1-area-0.0.0.0]network 10.0.2.1 0.0.0.0 --VLAN2
[LSW1-ospf-1-area-0.0.0.0]network 10.0.3.1 0.0.0.0 --VLAN3
[LSW1-ospf-1-area-0.0.0.0]network 10.0.20.1 0.0.0.0 ---VLAN20
[LSW1-ospf-1-area-0.0.0.0]network 10.0.30.1 0.0.0.0 --VLAN30
[LSW1-ospf-1-area-0.0.0.0]network 10.0.0.1 0.0.0.0 ---VLAN11

LSW2:

配置静默接口
[LSW1]ospf 1
[LSW1-ospf-1]silent-interface Vlanif 2
[LSW1-ospf-1]silent-interface Vlanif 3
[LSW1-ospf-1]silent-interface Vlanif 20
[LSW1-ospf-1]silent-interface Vlanif 30

LSW2:

配置LSW1,2和R1的专属VLAN13,并宣告


在ISP上
配置ISP的接口IP及其环回接口IP


在R1上
配置r1的接口ip
[r1]int g0/0/1
[r1-GigabitEthernet0/0/1]ip address 10.0.0.2 30
[r1-GigabitEthernet0/0/0]int g0/0/2
[r1-GigabitEthernet0/0/2]ip ad 10.0.0.6 30
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip ad 202.1.1.1 30

配置r1的ospf
[AR1]ospf 1
[AR1-ospf-1]area 0
[AR1-ospf-1-area-0.0.0.0]network 10.0.0.2 0.0.0.0
[AR1-ospf-1-area-0.0.0.0]network 10.0.0.6 0.0.0.0

配置缺省路由通到外网ISP
[R1]ip route-static 0.0.0.0 0 202.1.1.2
还需配置ospf的default-route-advertise
[R1]ospf 1
[R1-ospf-1]default-route-advertise

配置NAT 与 测试全网连通性
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 10.0.0.0 0.0.255.255
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]nat outbound 2000

配置完成后就可以连接了
