HCIP | 三层架构

目录

要求:

配置:

基础配置:

R1

R2

DHCP

LSW1

LSW2

eth-thrunk

LSW1

LSW2

VLAN、trunk

LSW1

LSW2

LSW3

LSW4

LSW5

STP

LSW1

LSW2

LSW3

LSW4

LSW5

SVI

LSW1

LSW2

vrrp

LSW1

LSW2

IP配置

LSW1

LSW2

内网OSPF

LSW1

LSW2

R1

公网访问

R1


要求:

实现全网通

配置:

基础配置:

R1

[R1]int g 0/0/2  
[R1-GigabitEthernet0/0/2]ip add 12.1.1.1 24
[R1-GigabitEthernet0/0/2]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.0.1 24
[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.4.1 24
[R1-GigabitEthernet0/0/1]int l0
[R1-LoopBack0]ip add 1.1.1.1 32

R2

[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[R2-GigabitEthernet0/0/0]int l0
[R2-LoopBack0]ip add 2.2.2.2 32

DHCP

LSW1

[LSW1]dhcp enable 
[LSW1]ip pool v2
[LSW1-ip-pool-v2]net 192.168.2.0 mask 24
[LSW1-ip-pool-v2]gateway-list 192.168.2.254
[LSW1-ip-pool-v2]q
[LSW1]int Vlanif 2
[LSW1-Vlanif2]dhcp select global 
[LSW1-Vlanif2]q
[LSW1]ip pool v3
[LSW1-ip-pool-v3]net 192.168.3.0 mask 24
[LSW1-ip-pool-v3]gateway-list  192.168.3.254
[LSW1-ip-pool-v3]q
[LSW1]int Vlanif 3
[LSW1-Vlanif3]dhcp select global

LSW2

[LSW2]dhcp enable 
[LSW2]ip pool v2
[LSW2-ip-pool-v2]net 192.168.2.0 mask 24
[LSW2-ip-pool-v2]gateway-list 192.168.2.254
[LSW2-ip-pool-v2]q
[LSW2]int v 2
[LSW2-Vlanif2]dhcp se
[LSW2-Vlanif2]dhcp select fl
[LSW2-Vlanif2]dhcp select gl
[LSW2-Vlanif2]dhcp select global 
[LSW2-Vlanif2]q
[LSW2]int Vlanif 2
[LSW2-Vlanif2]dhcp select global 
[LSW2-Vlanif2]q
[LSW2]ip pool v3
[LSW2-ip-pool-v3]net 192.168.3.0 mask 24
[LSW2-ip-pool-v3]gateway-list 192.168.3.254
[LSW2-ip-pool-v3]q
[LSW2]int Vlanif 3
[LSW2-Vlanif3]dhcp select global 

eth-thrunk

LSW1

[LSW1]interface Eth-Trunk 0
[LSW1-Eth-Trunk0]int g 0/0/5
[LSW1-GigabitEthernet0/0/5]eth-trunk 0
[LSW1-GigabitEthernet0/0/5]int g 0/0/6
[LSW1-GigabitEthernet0/0/6]eth-trunk 0

LSW2

[LSW2]int Eth-Trunk 0
[LSW2-Eth-Trunk0]q
[LSW2]int g 0/0/5
[LSW2-GigabitEthernet0/0/5]eth-trunk 0
[LSW2-GigabitEthernet0/0/5]int g 0/0/6
[LSW2-GigabitEthernet0/0/6]eth-trunk 0

VLAN、trunk

LSW1

[LSW1]vlan batch 2 to 3
[LSW1]port-group group-member g 0/0/2 Eth-Trunk 0
[LSW1-Eth-Trunk0]port link-type trunk 
[LSW1-Eth-Trunk0]port trunk allow-pass vlan all

LSW2

[LSW2]vlan batch 2 to 3
[LSW2]port-group group-member g 0/0/7 Eth-Trunk 0
[LSW2-Eth-Trunk0]port link-type trunk 
[LSW2-Eth-Trunk0]port trunk allow-pass vlan all

LSW3

[LSW3]vlan batch 2 to 3
[LSW3]port-group group-member e 0/0/1 e 0/0/4
[LSW3-port-group]port link-type trunk 
[LSW3-Ethernet0/0/1]port link-type trunk 
[LSW3-Ethernet0/0/4]port link-type trunk 
[LSW3-port-group]port trunk allow-pass vlan all
[LSW3-Ethernet0/0/1]port trunk allow-pass vlan all
[LSW3-Ethernet0/0/4]port trunk allow-pass vlan all
[LSW3-port-group]q
[LSW3]port-group group-member e 0/0/2 e 0/0/3
[LSW3-port-group]port link-type access 
[LSW3-Ethernet0/0/2]port link-type access 
[LSW3-Ethernet0/0/3]port link-type access 
[LSW3-port-group]port default vlan 2 
[LSW3-Ethernet0/0/2]port default vlan 2
[LSW3-Ethernet0/0/3]port default vlan 2

LSW4

[LSW4]vlan batch 2 to 3
[LSW4]port-group group-member e 0/0/1 e 0/0/2
[LSW4-port-group]port link-type trunk 
[LSW4-Ethernet0/0/1]port link-type trunk 
[LSW4-Ethernet0/0/2]port link-type trunk 
[LSW4-port-group]port trunk allow-pass vlan all
[LSW4-Ethernet0/0/1]port trunk allow-pass vlan all
[LSW4-Ethernet0/0/2]port trunk allow-pass vlan all
[LSW4]port-group group-member e 0/0/3 e 0/0/4
[LSW4-port-group]port link-type access 
[LSW4-Ethernet0/0/3]port link-type access 
[LSW4-Ethernet0/0/4]port link-type access 
[LSW4-port-group]port default vlan 3
[LSW4-Ethernet0/0/3]port default vlan 3
[LSW4-Ethernet0/0/4]port default vlan 3

LSW5

[LSW5]vlan batch 2 to 3
[LSW5]port-group group-member e 0/0/1 e 0/0/2
[LSW5-port-group]port link-type trunk 
[LSW5-Ethernet0/0/1]port link-type trunk 
[LSW5-Ethernet0/0/2]port link-type trunk 
[LSW5-port-group]port trunk allow-pass vlan all
[LSW5-Ethernet0/0/1]port trunk allow-pass vlan all
[LSW5-Ethernet0/0/2]port trunk allow-pass vlan all
[LSW5-port-group]q
[LSW5-Ethernet0/0/3]port link-type access 
[LSW5-Ethernet0/0/3]
[LSW5-Ethernet0/0/3]port default vlan 2
[LSW5-Ethernet0/0/3]q
[LSW5]int e 0/0/4
[LSW5-Ethernet0/0/4]port link-type access 
[LSW5-Ethernet0/0/4]port default vlan 3

STP

LSW1

[LSW1]stp enable 
[LSW1]stp region-configuration 
[LSW1-mst-region]region-name a
[LSW1-mst-region]instance 1 vlan 2
[LSW1-mst-region]instance 2 vlan 3
[LSW1-mst-region]active region-configuration 

[LSW1]stp instance 1 root primary 
[LSW1]stp instance 2 root secondary 

LSW2

[LSW2]stp enable
[LSW2]stp region-configuration
[LSW2-mst-region]region-name a
[LSW2-mst-region]instance 1 vlan 2
[LSW2-mst-region]instance 2 vlan 3
[LSW2-mst-region]active region-configuration

[LSW2]stp instance 2 root primary 
[LSW2]stp instance 1 root secondary 

LSW3

[LSW3]stp enable
[LSW3]stp region-configuration
[LSW3-mst-region]region-name a
[LSW3-mst-region]instance 1 vlan 2
[LSW3-mst-region]instance 2 vlan 3
[LSW3-mst-region]active region-configuration

LSW4

[LSW4]stp enable
[LSW4]stp region-configuration
[LSW4-mst-region]region-name a
[LSW4-mst-region]instance 1 vlan 2
[LSW4-mst-region]instance 2 vlan 3
[LSW4-mst-region]active region-configuration

LSW5

[LSW5]stp enable
[LSW5]stp region-configuration
[LSW5-mst-region]region-name a
[LSW5-mst-region]instance 1 vlan 2
[LSW5-mst-region]instance 2 vlan 3
[LSW5-mst-region]active region-configuration

SVI

LSW1

[LSW1]int Vlanif 2
[LSW1-Vlanif2]ip add 192.168.2.1 24
[LSW1-Vlanif2]q 
[LSW1]int Vlanif 3
[LSW1-Vlanif3]ip add 192.168.3.1 24

LSW2

[LSW2]int Vlanif 2
[LSW2-Vlanif2]ip add 192.168.2.2 24
[LSW2-Vlanif2]q
[LSW2]int Vlanif 3
[LSW2-Vlanif3]ip add 192.168.3.2 24

vrrp

LSW1

[LSW1]int Vlanif 2
[LSW1-Vlanif2]vrrp vrid 1 virtual-ip 192.168.2.254                   
[LSW1-Vlanif2]vrrp vrid 1 priority 120
[LSW1-Vlanif2]vrrp vrid 1 track interface g 0/0/1 reduced 30
[LSW1]int Vlanif 3
[LSW1-Vlanif3]vrrp vrid 2 virtual-ip 192.168.3.254

LSW2

[LSW2]int Vlanif 3
[LSW2-Vlanif3]vrrp vrid 2 virtual-ip 192.168.3.254
[LSW2-Vlanif3]vrrp vrid 2 priority 120
[LSW2-Vlanif3]vrrp vrid 2 track interface  g 0/0/1 reduced 30
[LSW2-Vlanif3]q   
[LSW2]int Vlanif 2
[LSW2-Vlanif2]vrrp vrid 2 virtual-ip 192.168.2.254

IP配置

LSW1

[LSW1]vlan 4
[LSW1-vlan4]q
[LSW1]int g 0/0/1
[LSW1-GigabitEthernet0/0/1]port link-type access 
[LSW1-GigabitEthernet0/0/1]port default vlan 4
[LSW1-GigabitEthernet0/0/1]q
[LSW1]int Vlanif 4
[LSW1-Vlanif4]ip add 192.168.0.2 30

LSW2

[LSW2]vlan 4
[LSW2-vlan4]q
[LSW2]int g 0/0/1
[LSW2-GigabitEthernet0/0/1]port link-type access 
[LSW2-GigabitEthernet0/0/1]port default vlan 4
[LSW2-GigabitEthernet0/0/1]q
[LSW2]int Vlanif  4
[LSW2-Vlanif4]ip add 192.168.0.6 30

内网OSPF

LSW1

[LSW1]ospf 
[LSW1-ospf-1]area 0
[LSW1-ospf-1-area-0.0.0.0]net 192.168.0.0 0.0.255.255

LSW2

[LSW2]ospf 
[LSW2-ospf-1]area 0
[LSW2-ospf-1-area-0.0.0.0]net 192.168.0.0 0.0.255.255

R1

[R1]ospf 
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]net 192.168.0.0 0.0.255.255 

公网访问

R1

[R1]ospf 
[R1-ospf-1]default-route-advertise always 
[R1-ospf-1]q
[R1]ip route-static 0.0.0.0 0 12.1.1.2 
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.0.0 0.0.255.255 
[R1-acl-basic-2000]q
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]nat outbound 2000 
相关推荐
南宫生2 小时前
力扣-图论-17【算法学习day.67】
java·学习·算法·leetcode·图论
sanguine__2 小时前
Web APIs学习 (操作DOM BOM)
学习
fantasy_arch2 小时前
CPU性能优化-磁盘空间和解析时间
网络·性能优化
AORO_BEIDOU3 小时前
单北斗+鸿蒙系统+国产芯片,遨游防爆手机自主可控“三保险”
华为·智能手机·harmonyos
数据的世界014 小时前
.NET开发人员学习书籍推荐
学习·.net
是Dream呀4 小时前
Python从0到100(七十八):神经网络--从0开始搭建全连接网络和CNN网络
网络·python·神经网络
四口鲸鱼爱吃盐4 小时前
CVPR2024 | 通过集成渐近正态分布学习实现强可迁移对抗攻击
学习
博览鸿蒙5 小时前
鸿蒙操作系统(HarmonyOS)的应用开发入门
华为·harmonyos
kaixin_learn_qt_ing5 小时前
了解RPC
网络·网络协议·rpc
安全小王子5 小时前
Kali操作系统简单介绍
网络·web安全