某高校网工课后作业《路由交换综合案例》配置详细步骤

1题目需求


说明:n代表几班,X代表学号后两位,例:1903002303,n代表几班,X代表学号后两位,例:1903002303,n表示3,X表示3;STP和MSTP中vlan的创建可以用GVRP。配置任务:1、实现vlan X和vlanX+10的通信;2、实现vlan X+20和vlan+30的通信;3、确定S1和S2的端口在STP中的状态;4、vlan X+20的根桥是S6,次根桥是S7;vlanX+30的根桥是S7,次根桥是S6;5、确定S6、S7和S8的端口在MSTP中的状态;6、分别用静态路由、RIPv2、单区域OSPF实现四个VLAN的相互通信;7、用ACL实现PC1不能访问PC3,但是可以访问PC6,PC5可以访问PC3和PC6.最后提交每个设备的配置文档和拓扑项目,将每一步实现的结果用截图或表格添加在word文档里。


某高校网工课后作业《路由交换综合案例》配置详细步骤




2基础配置



一、确定vlan号、IP段读完题目,我们可以先把VLAN号确定下来。龙哥,这里以n=3,X=41为例,PC的vlan和ip段分配情况,如下:

序号
PC
vlan 号
IP段
1
PC1、PC5
41
192.3.41.128/26
2
PC2
51
192.3.51.128/26
3
PC3、PC6
61
192.3.61.0/24
4
PC4
71
192.3.71.0/24


即PC的ip地址、网关可配置如下:PC1: 192.3.41.129/26     PC5: 192.3.41.130/26    网关:192.3.41.150/26PC2: 192.3.51.129/26     网关:192.3.51.150/26PC3: 192.3.61.3/24         PC6: 192.3.61.6/24   网关:192.3.61.100/24PC4: 192.3.71.4/24         网关:192.3.71.100/24
二、配置电脑IP地址

PC1的配置:

某高校网工课后作业《路由交换综合案例》配置详细步骤

(看不清?可单击图片放大查看)

PC5配置:

某高校网工课后作业《路由交换综合案例》配置详细步骤


PC2配置:

某高校网工课后作业《路由交换综合案例》配置详细步骤



PC3配置:

某高校网工课后作业《路由交换综合案例》配置详细步骤


PC6配置:

某高校网工课后作业《路由交换综合案例》配置详细步骤


PC4配置:

某高校网工课后作业《路由交换综合案例》配置详细步骤



三、修改设备名

建议正式配置前,把每台网络设备的设备名修改一下,防止后续配错设备了。


某高校网工课后作业《路由交换综合案例》配置详细步骤

某高校网工课后作业《路由交换综合案例》配置详细步骤


某高校网工课后作业《路由交换综合案例》配置详细步骤


某高校网工课后作业《路由交换综合案例》配置详细步骤


某高校网工课后作业《路由交换综合案例》配置详细步骤


某高校网工课后作业《路由交换综合案例》配置详细步骤


某高校网工课后作业《路由交换综合案例》配置详细步骤



四、创建VLAN

题目说,创建VLAN可以使用GVRP来创建。


SW2配置


[SW2]gvrp


[SW2]int Eth0/0/1

[SW2-Ethernet0/0/1]port link-type trunk

[SW2-Ethernet0/0/1]port trunk allow-pass vlan all

[SW2-Ethernet0/0/2]gvrp

[SW2-Ethernet0/0/1]qu

[SW2]


[SW2]int e0/0/2

[SW2-Ethernet0/0/2]port link-type trunk

[SW2-Ethernet0/0/2]port trunk allow-pass vlan all

[SW2-Ethernet0/0/2]gvrp

[SW2-Ethernet0/0/2]qu

[SW2]



SW1配置:

[SW1]gvrp


[SW1]int Eth0/0/4

[SW1-Ethernet0/0/4]port link-type trunk

[SW1-Ethernet0/0/4]port trunk allow-pass vlan all

[SW1-Ethernet0/0/4]gvrp

[SW1-Ethernet0/0/4]qu

[SW1]


[SW1]int Eth0/0/5

[SW1-Ethernet0/0/5]port link-type trunk

[SW1-Ethernet0/0/5]port trunk allow-pass vlan all

[SW1-Ethernet0/0/5]gvrp

[SW1-Ethernet0/0/5]qu

[SW1]



现在我们必须在SW1创建vlan 41、51,然后再来看看SW2是否也自动创建了:


[SW1]vlan 41

[SW1-vlan41]qu

[SW1]

[SW1]vlan 51

[SW1-vlan51]qu

[SW1]


某高校网工课后作业《路由交换综合案例》配置详细步骤


同理,SW6、SW7、SW8也这样配置:


SW6的配置:

[SW6]gvrp


[SW6]int Eth0/0/2

[SW6-Ethernet0/0/2]port link-type trunk

[SW6-Ethernet0/0/2]port trunk allow-pass vlan all

[SW6-Ethernet0/0/2]gvrp

[SW6-Ethernet0/0/2]qu

[SW6]


[SW6]int Eth0/0/3

[SW6-Ethernet0/0/3]port link-type trunk

[SW6-Ethernet0/0/3]port trunk allow-pass vlan all

[SW6-Ethernet0/0/3]gvrp

[SW6-Ethernet0/0/3]qu

[SW6]


SW7的配置:

[SW7]gvrp


[SW7]int Eth0/0/1

[SW7-Ethernet0/0/1]port link-type trunk

[SW7-Ethernet0/0/1]port trunk allow-pass vlan all

[SW7-Ethernet0/0/1]gvrp

[SW7-Ethernet0/0/1]qu

[SW7]


[SW7]int Eth0/0/2

[SW7-Ethernet0/0/2]port link-type trunk

[SW7-Ethernet0/0/2]port trunk allow-pass vlan all

[SW7-Ethernet0/0/2]gvrp

[SW7-Ethernet0/0/2]qu

[SW7]



SW8的配置:

[SW8]gvrp


[SW8]int Eth0/0/1

[SW8-Ethernet0/0/1]port link-type trunk

[SW8-Ethernet0/0/1]port trunk allow-pass vlan all

[SW8-Ethernet0/0/1]gvrp

[SW8-Ethernet0/0/1]qu

[SW8]


[SW8]int Eth0/0/2

[SW8-Ethernet0/0/2]port link-type trunk

[SW8-Ethernet0/0/2]port trunk allow-pass vlan all

[SW8-Ethernet0/0/2]gvrp

[SW8-Ethernet0/0/2]qu

[SW8]


在SW8创建VLAN:

[SW8]vlan 61

[SW8-vlan61]qu

[SW8]

[SW8]vlan 71

[SW8-vlan71]qu

[SW8]



五、设置access口


VLAN确定后,我们就可以根据拓扑图,给每个PC所接的交换机端口划分VLAN了。



[SW1]int e0/0/2

[SW1-Ethernet0/0/2]port link-type access 

[SW1-Ethernet0/0/2]port default vlan  41

[SW1-Ethernet0/0/2]stp edged-port enable 

[SW1]



[SW1]int e0/0/6

[SW1-Ethernet0/0/6]port link-type access

[SW1-Ethernet0/0/6]port default vlan  41

[SW1-Ethernet0/0/6]stp edged-port enable 

[SW1]



[SW1]int e0/0/3

[SW1-Ethernet0/0/3]port link-type access 

[SW1-Ethernet0/0/3]port default vlan  51

[SW1-Ethernet0/0/3]stp edged-port enable 

[SW1]





[SW8]int e0/0/3

[SW8-Ethernet0/0/3]port link-type access 

[SW8-Ethernet0/0/3]port default vlan  61

[SW8-Ethernet0/0/3]stp edged-port enable 

[SW8]



[SW8]int e0/0/5

[SW8-Ethernet0/0/5]port link-type access

[SW8-Ethernet0/0/5]port default vlan  61

[SW8-Ethernet0/0/5]stp edged-port enable 

[SW8]



[SW8]int e0/0/4

[SW8-Ethernet0/0/4]port link-type access 

[SW8-Ethernet0/0/4]port default vlan  71

[SW8-Ethernet0/0/4]stp edged-port enable 

[SW8]





3配置任务



一、实现vlan 41和vlan 51间的通信

即在R1上做单臂路由。


在SW2上连接路由器的接口配置成trunk:

[SW2]int Eth0/0/3

[SW2-Ethernet0/0/3]port link-type trunk 

[SW2-Ethernet0/0/3]port trunk allow-pass vlan all

[SW2-Ethernet0/0/3]gvrp


R1上的配置:


[R1]int g0/0/0.1

[R1-GigabitEthernet0/0/0.2]ip address  192.3.41.150 26

[R1-GigabitEthernet0/0/0.2]dot1q  termination vid 41


[R1]int g0/0/0.2

[R1-GigabitEthernet0/0/0.2]ip address  192.3.51.150 26

[R1-GigabitEthernet0/0/0.2]dot1q  termination vid 51


现在我们来验证一下,vlan间的通信:


某高校网工课后作业《路由交换综合案例》配置详细步骤


某高校网工课后作业《路由交换综合案例》配置详细步骤


二、实现vlan 61和vlan 71间的通信


即在R4上做单臂路由。


在SW6上连接路由器的接口配置成trunk:

[SW6]int Eth0/0/1

[SW6-Ethernet0/0/1]port link-type trunk 

[SW6-Ethernet0/0/1]port trunk allow-pass vlan all

[SW6-Ethernet0/0/1]gvrp


R4上的配置:


[R4]int g0/0/1.1

[R4-GigabitEthernet0/0/1.1]ip address  192.3.61.100 24

[R4-GigabitEthernet0/0/1.1]dot1q  termination vid 61


[R4]int g0/0/1.2

[R1-GigabitEthernet0/0/1.2]ip address  192.3.71.100 24

[R1-GigabitEthernet0/0/1.2]dot1q  termination vid 71


现在我们来验证一下,vlan间的通信:

某高校网工课后作业《路由交换综合案例》配置详细步骤



某高校网工课后作业《路由交换综合案例》配置详细步骤


三、确定S1和S2的端口在STP中的状态

由于华为默认是MSTP,所以我们需要修改一下,改为STP,再来看看STP状态:


某高校网工课后作业《路由交换综合案例》配置详细步骤



把SW2修改为STP,并修改优先级,使之成为根桥

[SW2]stp mode stp

[SW2]stp priority  0


现在我们来看STP状态:

SW2:

某高校网工课后作业《路由交换综合案例》配置详细步骤


某高校网工课后作业《路由交换综合案例》配置详细步骤


某高校网工课后作业《路由交换综合案例》配置详细步骤


某高校网工课后作业《路由交换综合案例》配置详细步骤



四、 vlan X+20的根桥是S6,次根桥是S7;vlanX+30的根桥是S7,次根桥是S6;


[SW6]stp region-configuration

[SW6-mst-region]region-name along

[SW6-mst-region]instance 1 vlan 61

[SW6-mst-region]instance 2 vlan  71

[SW6-mst-region]active region-configuration 

Info: This operation may take a few seconds. Please wait for a moment...done.

[SW6-mst-region]qu


[SW6]stp instance 1 root primary   //把vlan61在SW6设置为根桥

[SW6]stp instance  2 root  secondary  //把vlan71在SW6设置为次根桥

[SW6]



[SW7]stp region-configuration

[SW7-mst-region]region-name along

[SW7-mst-region]instance 1 vlan 61

[SW7-mst-region]instance 2 vlan  71

[SW7-mst-region]active region-configuration 

Info: This operation may take a few seconds. Please wait for a moment...done.

[SW7-mst-region]qu


[SW7]stp instance 1 root  secondary //把vlan61在SW7设置为次根桥

[SW7]stp instance  2 root  primary   //把vlan71在SW7设置为根桥

[SW7]



五、确定S6、S7和S8的端口在MSTP中的状态;


某高校网工课后作业《路由交换综合案例》配置详细步骤



某高校网工课后作业《路由交换综合案例》配置详细步骤


某高校网工课后作业《路由交换综合案例》配置详细步骤




六、分别用静态路由、RIPv2、单区域OSPF实现四个VLAN的相互通信;
配置路由前,给给R1和R4之间设置一个IP网段,如14.1.1.0/24.
R1的G0/0/1的ip地址为:14.1.1.1/24R4的G0/0/0的ip地址为:14.1.1.4/24



[R4]int g0/0/1


[R4-GigabitEthernet0/0/0]ip add 14.1.1.1 24



[R4]int g0/0/0

[R4-GigabitEthernet0/0/0]ip add 14.1.1.4 24



1、静态路由:


[R1]ip route-static 192.3.61.0 24 14.1.1.4

[R1]ip route-static 192.3.71.0 24 14.1.1.4

[R1]



[R4]ip route-static 192.3.41.0 26 14.1.1.1

[R4]ip route-static 192.3.51.0 26 14.1.1.1

[R4]


接下来验证一下:

PC1可以ping通 PC4

某高校网工课后作业《路由交换综合案例》配置详细步骤



PC1可以ping通 PC3:

某高校网工课后作业《路由交换综合案例》配置详细步骤



2、RIPv2配置:

a、先删除上述静态路由;

[R1]undo ip route-static 192.3.61.0 24 14.1.1.4

[R1]undo ip route-static 192.3.71.0 24 14.1.1.4

[R1]



[R4]undo ip route-static 192.3.41.0 26 14.1.1.1

[R4]undo ip route-static 192.3.51.0 26 14.1.1.1

[R4]




b、配置RIPv2


在R1上配置ripv2

[R1]rip

[R1-rip-1]version 2

[R1-rip-1]network 192.3.41.0

[R1-rip-1]network 192.3.51.0

[R1-rip-1]net 14.0.0.0

[R1-rip-1]


在R2上配置ripv2

[R4]rip

[R4-rip-1]version 2

[R4-rip-1]network 192.3.61.0

[R4-rip-1]network 192.3.71.0

[R4-rip-1]net 14.0.0.0

[R4-rip-1]



接下来验证一下:

某高校网工课后作业《路由交换综合案例》配置详细步骤


某高校网工课后作业《路由交换综合案例》配置详细步骤



3、单区域OSPF


    a、删除ripv2

         

[R1]undo rip 1

Warning: The RIP process will be deleted. Continue?[Y/N]y

[R1]


[R4]undo rip 1

Warning: The RIP process will be deleted. Continue?[Y/N]y

[R1]

     


    b、配置ospf



[R1]ospf

[R1-ospf-1]area 0

[R1-ospf-1-area-0.0.0.0]net 14.1.1.1 0.0.0.0

[R1-ospf-1-area-0.0.0.0]net 192.3.41.150 0.0.0.0

[R1-ospf-1-area-0.0.0.0]net 192.3.51.150 0.0.0.0

[R1-ospf-1-area-0.0.0.0]

[R1-ospf-1-area-0.0.0.0]qu

[R1-ospf-1]



[R4]ospf

[R4-ospf-1]area 0

[R4-ospf-1-area-0.0.0.0]net 14.1.1.4 0.0.0.0

[R4-ospf-1-area-0.0.0.0]net 192.3.61.100 0.0.0.0

[R4-ospf-1-area-0.0.0.0]net 192.3.71.100 0.0.0.0

[R4-ospf-1-area-0.0.0.0]qu

[R4-ospf-1]



验证,这次换PC2 ping PC3、 PC4:

某高校网工课后作业《路由交换综合案例》配置详细步骤



七、用ACL实现PC1不能访问PC3,但是可以访问PC6,PC5可以访问PC3和PC6.


配置之前,我们先看看PC1能不能访问PC3、PC6:


某高校网工课后作业《路由交换综合案例》配置详细步骤


看看PC5能不能访问PC3、PC6:

某高校网工课后作业《路由交换综合案例》配置详细步骤



现在我们来使用高级ACL 来满足需求:


配置ACL


[R1]acl number 3001

[R1-acl-adv-3001]rule  5 deny ip source 192.3.41.129 0 destination  192.3.61.3 0


配置流分类:

[R1]traffic classifier tc

[R1-classifier-tc]if-match acl 3001

[R1-classifier-tc]qu


配置流行为:

[R1]traffic behavior tb

[R1-behavior-tb]deny 

[R1-behavior-tb]qu


配置流策略:

[R1]traffic policy  tp

[R1-trafficpolicy-tp]classifier tc behavior tb

[R1-trafficpolicy-tp]qu



应用到接口:


[R1]int g0/0/0.1 

[R1-GigabitEthernet0/0/0.1]traffic-policy tp inbound 

[R1-GigabitEthernet0/0/0.1]qu


[R1]int GigabitEthernet 0/0/0.2

[R1-GigabitEthernet0/0/0.2]traffic-policy tp inbound 

[R1-GigabitEthernet0/0/0.2]qu



现在我们来验证看看,PC1不能访问PC3,但是可以访问PC6,PC5可以访问PC3和PC6:

某高校网工课后作业《路由交换综合案例》配置详细步骤


某高校网工课后作业《路由交换综合案例》配置详细步骤


到这里就完成了,最后记得保存设备配置喔!

每台设备执行 save 命令,选择Y,再回车。

某高校网工课后作业《路由交换综合案例》配置详细步骤


上一篇:网络工程师就算没有真机,也可以在ensp模拟器上玩python编程自动化!


下一篇:Super VLAN概述