HCIP第二次作业----交换综合实验

一、实验拓补

二、实验需求

1,内网IP地址使用172.16.0.0/16分配
2,Sw1和sw2之间互为备份
3,VRRP/STP/VLAN/Eth-trunk均使用
4,所有Pc均通过DHCP获取IP地址
5,ISP只能配置IP地址
6,所有电脑可以正常访问ISP路由器环回

三、实验步骤---思路

路由和交换机都存在时,先配交换机,当交换机两层和三层设备都存在时,先配二层设备

配置vlan

[SW3]vlan 2

[SW3-vlan2]vlan 3

[SW4]vlan 2

[SW4-vlan3]vlan 3

配置接口类型

[SW3]int g 0/0/1

[SW3-GigabitEthernet0/0/1]port link-type access

[SW3-GigabitEthernet0/0/1]port default vlan 2

[SW3-GigabitEthernet0/0/1]int g 0/0/2

[SW3-GigabitEthernet0/0/2]port link-type access

[SW3-GigabitEthernet0/0/2]port default vlan 3

[SW3]port-group group-member  g0/0/3 to g0/0/4

[SW3-port-group]port link-type trunk

[SW3-GigabitEthernet0/0/3]port link-type trunk

[SW3-GigabitEthernet0/0/4]port link-type trunk

[SW3-port-group]port trunk allow-pass vlan 2 3

[SW3-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 3

[SW3-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3

[SW4]int g 0/0/1

[SW4-GigabitEthernet0/0/1]p l a

[SW4-GigabitEthernet0/0/1]port default vlan 2

[SW4]int g 0/0/2

[SW4-GigabitEthernet0/0/2] p l a

[SW4-GigabitEthernet0/0/2]port default vlan 3

[SW4]port-group group-member g0/0/3 to g0/0/4

[SW4-port-group]port link-type trunk

[SW4-GigabitEthernet0/0/3]port link-type trunk

[SW4-GigabitEthernet0/0/4]port link-type trunk

[SW4-port-group]port trunk allow-pass vlan  2 3

[SW4-GigabitEthernet0/0/3]port trunk allow-pass vlan  2 3

[SW4-GigabitEthernet0/0/4]port trunk allow-pass vlan  2 3

三层交换机:

[SW1]vlan 2

[SW1-vlan2]vlan 3

[SW1-vlan3]vlan 10

[SW1-vlan10]vlan 20

[SW1]port-group group-member g0/0/3 to g0/0/4

[SW1-port-group]port link-type trunk

[SW1-GigabitEthernet0/0/3]port link-type trunk

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

[SW1-port-group]port trunk allow-pass vlan 2 3

[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 3

[SW1-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3

聚合:

[SW1]interface eth-trunk 0

[SW1-Eth-Trunk0]trunkport GigabitEthernet 0/0/1 to 0/0/2

[SW2]interface eth-trunk 0

[SW2-Eth-Trunk0]trunkport GigabitEthernet 0/0/1 to 0/0/2

[SW2-Eth-Trunk0]p l t

[SW2-Eth-Trunk0]port trunk allow-pass vlan 2 3 10 20

[SW1]interface eth-trunk 0

[SW1-Eth-Trunk0]p l t

[SW1-Eth-Trunk0]port trunk allow-pass vlan 2 3 10 20

[SW1-GigabitEthernet0/0/5]port link-type  access  

[SW1-GigabitEthernet0/0/5]port default  vlan 10

[SW2]port-group group-member GigabitEthernet  0/0/3 to g0/0/4

[SW2-port-group]p l t

[SW2]int g 0/0/3

[SW2-GigabitEthernet0/0/3]p l t

[SW2]int g 0/0/4

[SW2-GigabitEthernet0/0/4]p l t

[SW2-port-group]port trunk allow-pass vlan 2 3

[SW2-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 3

[SW2-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3

[SW2-GigabitEthernet0/0/5]p l a

[SW2-GigabitEthernet0/0/5]port default vlan

[SW2-GigabitEthernet0/0/5]port default vlan 20

配地址:

[SW1]interface Vlanif 2

[SW1-Vlanif2]ip add 172.16.0.1 26

[SW1-Vlanif2]int v 3

[SW1-Vlanif3]ip add 172.16.0.65 26

[SW1]int v 10

[SW1-Vlanif10]ip add 172.16.0.129 26

[SW1]display ip interface brief

[R1]int g 0/0/1

[R1-GigabitEthernet0/0/1]ip add 172.16.0.130 26

[R1-GigabitEthernet0/0/1]int g 0/0/2

[R1-GigabitEthernet0/0/2]ip add 172.16.0.194 26

[R1-GigabitEthernet0/0/2]int g 0/0/0

[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24

[R1]display ip interface brief

[R2]int  g 0/0/0

[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24

[R2-GigabitEthernet0/0/0]int l0

[R2-LoopBack0]ip add 2.2.2.2 24

[R2]display ip interface brief

配置生成树:

MSTP

[SW1]stp enable 

[SW1]stp mode mstp

[SW1]stp region-configuration

[SW1-mst-region]region-name aa

[SW1-mst-region]instance 1 vlan 2

[SW1-mst-region]instance 2 vlan 3

[SW1-mst-region]active region-configuration

[SW2]stp enable 

[SW2]stp mode mstp

SW2]stp region-configuration

[SW2-mst-region]region-name aa

[SW2-mst-region]instance 1 vlan 2

[SW2-mst-region]instance  2 vlan 3

[SW2-mst-region]active region-configuration

[SW3]stp enable

[SW3]stp mode mstp

[SW3]stp region-configuration

SW3-mst-region]region-name aa

[SW3-mst-region]instance 1 vlan 2

[SW3-mst-region]instance 2 vlan 3

[SW3-mst-region]active region-configuration

[SW4]stp enable

[SW4]stp mode mstp

[SW4]stp region-configuration

[SW4-mst-region]region-name  aa

[SW4-mst-region]instance 1 vlan 2

[SW4-mst-region]instance 2 vlan 3

[SW4-mst-region]active region-configuration

准备根桥:

[SW1]stp instance 1 root primary

[SW2]stp instance  1 root secondary

[SW1]stp instance 2 root secondary

[SW2]stp instance 2 root primary

SW3和SW4连着PC,需要做边缘端口的保护:

[SW3]port-group group-member GigabitEthernet 0/0/1 to g0/0/2

[SW3-port-group]stp edged-port enable

[SW3-GigabitEthernet0/0/1]stp edged-port enable

[SW3-GigabitEthernet0/0/2]stp edged-port enable

[SW3]stp bpdu-protection

[SW4]port-group group-member GigabitEthernet 0/0/1 to g 0/0/2

[SW4-port-group]stp enable

[SW4-GigabitEthernet0/0/1]stp enable

[SW4-GigabitEthernet0/0/2]stp enable

[SW4-port-group]stp edged-port enable

[SW4-GigabitEthernet0/0/1]stp edged-port enable

[SW4-GigabitEthernet0/0/2]stp edged-port enable

[SW4]stp bpdu-protection

检查:display stp brief 

SW1

SW2

SW3

SW4

VRRP:

[SW1]VLAN 2

[SW1-vlan2]int vlanif 2

[SW1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.0.62

[SW1-Vlanif2]vrrp vrid 1 priority 120

[SW1-Vlanif2]vrrp vrid 1 track  interface g0/0/5 reduced 30

[SW1]vlan 3

[SW1-vlan3]int vlanif 3        

[SW1-Vlanif3]vrrp vrid 2 virtual-ip 172.16.0.126

[SW1]dis vrrp brief

[SW2]vlan 2

[SW2-vlan2]int vlanif 2

[SW2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.0.62

[SW2-Vlanif2]int vlanif 3

[SW2-Vlanif3]vrrp vrid 2 virtual-ip 172.16.0.1 26

[SW2-Vlanif3]vrrp vrid 2 priority 120

[SW2-Vlanif3]vrrp vrid 2 track interface Vlanif 20 reduced 30

[SW2]dis vrrp brief

DHCP:

[SW1]dhcp enable
[SW1]ip pool aa
[SW1-ip-pool-aa]net 172.16.1.0 mask 25
[SW1-ip-pool-aa]gateway-list 172.16.1.126
[SW1-ip-pool-aa]dns-list 114.114.114.114
[SW1-ip-pool-aa]q
[SW1]ip pool bb
[SW1-ip-pool-bb]net 172.16.1.128 mask 25
[SW1-ip-pool-bb]gateway-list 172.16.1.254
[SW1-ip-pool-bb]dns-list 114.114.114.114
[SW1-ip-pool-bb]q
[SW1]int vlanif 1 
[SW1-Vlanif1]dhcp select global 
[SW1-Vlanif1]int vlan 2   
[SW1-Vlanif2]dhcp select global 


[SW2]dhcp enable
[SW2]ip pool aa
Info:It's successful to create an IP address pool.
[SW2-ip-pool-aa]net 172.16.1.0 mask 25
[SW2-ip-pool-aa]gateway-list 172.16.1.126
[SW2-ip-pool-aa]dns-list 114.114.114.114
[SW2-ip-pool-aa]q
[SW2]ip pool bb
[SW2-ip-pool-bb]net 172.16.1.128 mask 25
[SW2-ip-pool-bb]gateway-list 172.16.1.254
[SW2-ip-pool-bb]dns 114.114.114.114
[SW2-ip-pool-bb]q
[SW2]int vlanif 1
[SW2-Vlanif1]dhcp select global 
[SW2-Vlanif1]int vlanif 2
[SW2-Vlanif2]dhcp select global

检测pc是否获得ip地址:

配置路由协议:

R1:

[R1]ospf 1 router-id 1.1.1.1

[R1-ospf-1]a 0

[R1-ospf-1-area-0.0.0.0]ne 172.16.0.128 0.0.0.63

[R1-ospf-1-area-0.0.0.0]ne 172.16.0.192 0.0.0.63

SW1:

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]net 172.16.0.0 0.0.0.255

[SW1]ospf 2 router-id 3.3.3.3
[SW1-ospf-2]area 0
[SW1-ospf-2-area-0.0.0.0]net 172.16.0.2 0.0.0.0
[SW1-ospf-2-area-0.0.0.0]area 1
[SW1-ospf-2-area-0.0.0.1]net 172.16.1.0 0.0.0.255

[SW2-ospf-1]area 0
[SW2-ospf-1-area-0.0.0.0]net 172.16.0.6 0.0.0.0
[SW2-ospf-1-area-0.0.0.0]area 1
[SW2-ospf-1-area-0.0.0.1]net 172.16.1.0 0.0.0.255

[R2]ip route-static 0.0.0.0 0 12.1.1.1 
[R2-ospf-1]default-route-advertise 

路由汇总:

[SW1-ospf-2]area 1
[SW1-ospf-2-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0

[SW2-ospf-2]area 1 
[SW2-ospf-2-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0

防环:

[SW1]ip route-static 172.16.1.0 24 NULL 0

[SW2]ip route-static 172.16.1.0 24 NULL 0

[R2]acl 2000   
[R2-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R2]int g0/0/0    
[R2-GigabitEthernet0/0/0]nat outbound 2000

测试:pc1和pc2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值