HCIP第二次作业

HCIP作业:网络实验配置与实现

一 实验拓扑

  • 二 实验要求​​​​​​

    • 内网IP地址使用172.16.0.0/16。
    • SW1和SW2之间互为备份。
    • 使用VRRP/MSTP/VLAN/eth-trunk等技术。
    • 所有PC通过DHCP获取IP地址。
    • ISP只配置IP地址,所有电脑能正常访问ISP路由器环回。

三、实验步骤

VLAN配置

undo info-center enable 
#sw3
[sw3]vlan batch 2 to 3
[sw3]int g0/0/1
[sw3-GigabitEthernet0/0/1]port link-type access
[sw3-GigabitEthernet0/0/1]port default vlan 2
[sw3-GigabitEthernet0/0/1]int g0/0/2
[sw3-GigabitEthernet0/0/2]port link-type access
[sw3-GigabitEthernet0/0/2]port default vlan 2

#sw4
[SW4]vlan batch 2 to 3
[sw4]int g0/0/1
[SW4-GigabitEthernet0/0/1]port link-type access 
[SW4-GigabitEthernet0/0/1]port default vlan 2
[sw4-GigabitEthernet0/0/1]int g0/0/2
[sw4-GigabitEthernet0/0/2]port link-type access
[sw4-GigabitEthernet0/0/2]port default vlan 3

#sw3、sw4与其他交换机之间配置trunk
[sw3]port-group group-member g0/0/3 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]port-group group-member g0/0/3 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

#sw2、sw1
[sw1]vlan batch 2 3 10 20
[sw1]port-group group-member g0/0/3 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]int Eth-Trunk 0 
[sw1-Eth-Trunk0]trunkport GigabitEthernet 0/0/1 to 0/0/2
[sw1-Eth-Trunk0]port link-type trunk 
[sw1-Eth-Trunk0]port trunk allow-pass vlan 2 3 10 20
[sw1-Eth-Trunk0]int g 0/0/5
[sw1-GigabitEthernet0/0/5]port link-type access 
[sw1-GigabitEthernet0/0/5]port default vlan 10


[sw2]vlan batch 2 3 10 20
[sw2]port-group group-member g0/0/3 g0/0/4
[sw2-port-group]port link-type trunk 
[sw2-GigabitEthernet0/0/3]port link-type trunk 
[sw2-GigabitEthernet0/0/4]port link-type trunk 
[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]int Eth-Trunk 0 
[sw2-Eth-Trunk0]trunkport GigabitEthernet 0/0/1 to 0/0/2
[sw2-Eth-Trunk0]port link-type trunk
[sw2-Eth-Trunk0]port trunk allow-pass vlan 2 3 10 20
[sw2-Eth-Trunk0]int g0/0/5
[sw2-GigabitEthernet0/0/5]port link-type access
[sw2-GigabitEthernet0/0/5]port default vlan 20

display port vlan active

image-20250329225204772

image-20250329223622937

image-20250329221853926

image-20250329222101329

vlanif

[sw1]int v 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-Vlanif3]int v 10
[sw1-Vlanif10]ip add 172.16.0.129 26

[sw2]int v 2
[sw2-Vlanif2]ip add 172.16.0.2 26
[sw2-Vlanif2]int v 3
[sw2-Vlanif3]ip add 172.16.0.66 26
[sw2-Vlanif3]int v 20
[sw2-Vlanif20]ip add 172.16.0.193 26


[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
 

[ISP]int  g 0/0/0
[ISP-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[ISP-GigabitEthernet0/0/0]int l0
[ISP-LoopBack0]ip add 2.2.2.2 24

display ip interface brief

image-20250330003558750

image-20250330003611813

image-20250330003449152

image-20250330003526192

stp

[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 
[sw1-mst-region]q
[sw1]stp instance 1 root primary 
[sw1]stp instance 2 root secondary 

[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 
[sw2-mst-region]q
[sw2]stp instance 1 root secondary 
[sw2]stp instance 2 root primary 

[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

display stp brief

image-20250329230446544

image-20250329230747345

image-20250329231005159

PixPin_2025-03-29_23-11-30

dhcp

[sw1]dhcp enable 
[sw1]ip pool aa
[sw1-ip-pool-aa]network 172.16.0.0 mask 26
[sw1-ip-pool-aa]gateway-list 172.16.0.62
[sw1-ip-pool-aa]dns-list 8.8.8.8
[sw1-ip-pool-aa]int v 2
[sw1-Vlanif2]dhcp select global 
[sw1-Vlanif2]ip pool bb
[sw1-ip-pool-bb]network 172.16.0.64 mask 26
[sw1-ip-pool-bb]gateway-list 172.16.0.126
[sw1-ip-pool-bb]dns-list 8.8.8.8
[sw1-ip-pool-bb]int v 3
[sw1-Vlanif3]dhcp select global 


[sw2]dhcp enable
[sw2]ip pool aa
[sw2-ip-pool-aa]network 172.16.0.0 mask 26
[sw2-ip-pool-aa]gateway-list 172.16.0.62
[sw2-ip-pool-aa]dns-list 8.8.8.8
[sw2-ip-pool-aa]int v 2
[sw2-Vlanif2]dhcp select global
[sw2]ip pool bb
Info:It's successful to create an IP address pool.
[sw2-ip-pool-bb]network 172.16.0.64 mask 26
[sw2-ip-pool-bb]gateway-list 172.16.0.126
[sw2-ip-pool-bb]dns-list 8.8.8.8
[sw2-ip-pool-bb]int v 3
[sw2-Vlanif3]dhcp select global

display ip pool

image-20250329232059053

image-20250330000057119

vrrp配置

[sw1]int v 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-Vlanif2]int v 3
[sw1-Vlanif3]vrrp vrid 2 virtual-ip 172.16.0.126

[sw2]int v 2
[sw2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.0.62
[sw2-Vlanif2]int v 3
[sw2-Vlanif3]vrrp vrid 2 virtual-ip 172.16.0.126
[sw2-Vlanif3]vrrp vrid 2 priority 120
[sw2-Vlanif3]vrrp vrid 2 track interface Vlanif 20 reduced 30

dis vrrp brief

image-20250329232252763

image-20250329232304268

ospf配置

[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]ospf 1 router-id 2.2.2.2
[sw1-ospf-1]a 0
[sw1-ospf-1-area-0.0.0.0]ne 172.16.0.128 0.0.0.63
[sw1-ospf-1-area-0.0.0.0]ne 172.16.0.0 0.0.0.63
[sw1-ospf-1-area-0.0.0.0]ne 172.16.0.64 0.0.0.63

[sw2]ospf 1 router-id 3.3.3.3
[sw2-ospf-1]a 0
[sw2-ospf-1-area-0.0.0.0]ne 172.16.0.192 0.0.0.63
[sw2-ospf-1-area-0.0.0.0]ne 172.16.0.0 0.0.0.63
[sw2-ospf-1-area-0.0.0.0]ne 172.16.0.64  0.0.0.63

dis ospf peer brief

image-20250330003641947

image-20250330003723831

image-20250330003733898

PC可访问ISP

[r1]ip route-static 0.0.0.0 12.0.0.2
[r1-acl-basic-2000]rule permit source 172.16.0.0 0.0.0.255
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]nat outbound 2000
[r1-ospf-1]default-route-advertise

image-20250330003907325

image-20250330003939916

image-20250330004008369

image-20250330004034717

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值