三层架构实验

该博客围绕网络实验展开,涵盖实验要求、IP划分、配置IP地址、OSPF、静态路由、NAT等内容。还涉及Eth - trunk链路、Trunk、STP、VLANIF的IP地址、VRRP、DHCP、VLAN划分的配置,最后进行测试,旨在构建一个完整的网络环境。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 实验要求

1、内网IP地址172.16.0.0/16

2、sw1/2之间互为备份

3、VRRP​​​​​​/STP/VLAN/Trunk均使用

4、所有PC通过DHCP获取IP地址

 

ip划分

R1-R2:100.1.1.0/24

R2-LSW1:172.16.0.0/30

R2-LSW2:172.16.0.4/30

VLAN 2:172.16.2.0/24

VLAN 3:172.16.3.0/24

配置IP地址

R1

[R1]int g0/0/0 
[R1-GigabitEthernet0/0/0]ip address 100.1.1.2 24
[R1-GigabitEthernet0/0/0]int lo0
[R1-LoopBack0]ip address 100.1.2.1 24

R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip address 100.1.1.1 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip address 172.16.0.1 30
[R2-GigabitEthernet0/0/1]int g0/0/2
[R2-GigabitEthernet0/0/2]ip address 172.16.0.5 30

LSW1

[LSW1]int Vlanif 1
[LSW1-Vlanif1]ip address 172.16.0.2 30
 

LSW2

[LSW2]int Vlanif 1
[LSW2-Vlanif1]ip address 172.16.0.5 30
 

配置OSPF 

R2

[R2]ospf 1 router-id 3.3.3.3
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255

LSW1

[LSW1]ospf 1 router-id 1.1.1.1 
[LSW1-ospf-1]area 0 
[LSW1-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255

LSW2

[LSW2]ospf 1 router-id 2.2.2.2
[LSW2-ospf-1]area 0
[LSW2-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
 

配置静态路由、NAT、边界路由器上配置一个下发缺省

R2

[R2]ip route-static 0.0.0.0 0 100.1.1.2 
[R2]acl 2000
[R2-acl-basic-2000]rule 1 permit source any 
[R2-acl-basic-2000]q
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]nat outbound 2000
[R2]ospf 1
[R2-ospf-1]default-route-advertise always
 

配置LSW1-LSW2之间的Eth-trunk链路

LSW1

[LSW1]int Eth-Trunk 1
[LSW1-Eth-Trunk1]trunkport GigabitEthernet 0/0/1 
[LSW1-Eth-Trunk1]trunkport GigabitEthernet 0/0/2
[LSW1-Eth-Trunk1]port trunk allow-pass vlan all
[LSW1-Eth-Trunk1]q

LSW2

[LSW2]int Eth-Trunk 1
[LSW2-Eth-Trunk1]trunkport GigabitEthernet 0/0/1
[LSW2-Eth-Trunk1]trunkport GigabitEthernet 0/0/2
[LSW2-Eth-Trunk1]port trunk allow-pass vlan all 
[LSW2-Eth-Trunk1]q

Trunk

LSW1

[LSW1]int g0/0/3
[LSW1-GigabitEthernet0/0/3]port link-type trunk 
[LSW1-GigabitEthernet0/0/3]port trunk allow-pass vlan all 
[LSW1-GigabitEthernet0/0/3]int g0/0/4
[LSW1-GigabitEthernet0/0/4]port link-type trunk 
[LSW1-GigabitEthernet0/0/4]port trunk allow-pass vlan all 

 LSW2

[LSW2]int g0/0/3
[LSW2-GigabitEthernet0/0/3]port link-type trunk  
[LSW2-GigabitEthernet0/0/3]port trunk allow-pass vlan all 
[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 all 

STP

LSW1
[LSW1]stp mode mstp 
[LSW1]stp enable               
[LSW1]vlan batch 2 3
[LSW1]stp region-configuration
[LSW1-mst-region]region-name 11
[LSW1-mst-region]instance 2 vlan 2
[LSW1-mst-region]instance 3 vlan 3
[LSW1-mst-region]active region-configuration

LSW2

[LSW2]stp mode mstp 
[LSW2]stp enable 
[LSW2]stp region-configuration 
[LSW2-mst-region]region-name 11
[LSW2-mst-region]instance 2 vlan 2
[LSW2-mst-region]instance 3 vlan 3
[LSW2-mst-region]active region-configuration 

LSW3

[LSW3]stp mode mstp 
[LSW3]stp enable 
[LSW3]stp region-configuration 
[LSW3-mst-region]region-name 11
[LSW3-mst-region]instance 2 vlan 2 
[LSW3-mst-region]instance 3 vlan 3
[LSW3-mst-region]active region-configuration 

LSW4

[LSW4]stp mode mstp 
[LSW4]stp enable 
[LSW4]stp region-configuration 
[LSW4-mst-region]region-name 11
[LSW4-mst-region]instance 2 vlan 2
[LSW4-mst-region]instance 3 vlan 3
[LSW4-mst-region]active region-configuration  

指定LSW1为instance 2的主,为instance 3的备份

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

指定LSW2为instance 3的主,为instance 2的备份

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

配置VLANIF的IP地址

LSW1

[LSW1]int Vlanif 2
[LSW1-Vlanif2]ip address 172.16.2.1 24
[LSW1-Vlanif2]q
[LSW1]int Vlanif 3
[LSW1-Vlanif3]ip address 172.16.3.1 24
 

LSW2

[LSW2]int Vlanif 2
[LSW2-Vlanif2]ip address 172.16.2.2 24
[LSW2-Vlanif2]q     
[LSW2]int Vlanif 3
[LSW2-Vlanif3]ip address 172.16.3.2 24

VRRP

LSW1

[LSW1]int Vlanif 2
[LSW1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.2.254
[LSW1-Vlanif2]vrrp vrid 1 priority 200
[LSW1-Vlanif2]vrrp vrid 1 track interface Vlanif 1 reduced 150
[LSW1-Vlanif2]q
[LSW1]int Vlanif 3 
[LSW1-Vlanif3]vrrp vrid 2 virtual-ip 172.16.3.254
[LSW1-Vlanif3]vrrp vrid 2 priority 100

LSW2

[LSW2]int Vlanif 2
[LSW2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.2.254
[LSW2-Vlanif2]vrrp vrid 1 priority 100
[LSW2]int Vlanif 3
[LSW2-Vlanif3]vrrp vrid 2 virtual-ip 172.16.3.254
[LSW2-Vlanif3]vrrp vrid 2 priority 200
[LSW2-Vlanif3]vrrp vrid 2 track interface Vlanif 1 reduced 150

DHCP

LSW1

[LSW1]ip pool aa           
Info:It's successful to create an IP address pool.
[LSW1-ip-pool-aa]network 172.16.2.0 mask 24
[LSW1-ip-pool-aa]gateway-list 172.16.2.254                      
[LSW1-ip-pool-aa]dns-list 8.8.8.8
[LSW1-ip-pool-aa]q
[LSW1]ip pool bb 
Info:It's successful to create an IP address pool.
[LSW1-ip-pool-bb]network 172.16.3.0 mask 24
[LSW1-ip-pool-bb]gateway-list 172.16.3.254 
[LSW1-ip-pool-bb]dns-list 8.8.8.8
[LSW1-ip-pool-bb]q
[LSW1]dhcp enable 
[LSW1]int Vlanif 2
[LSW1-Vlanif2]dhcp select global 
[LSW1-Vlanif2]q
[LSW1]int Vlanif 3
[LSW1-Vlanif3]dhcp select global 

LSW2

[LSW2]ip pool aa                                
Info:It's successful to create an IP address pool.
[LSW2-ip-pool-aa] gateway-list 172.16.2.254                
[LSW2-ip-pool-aa] network 172.16.2.0 mask 24    
[LSW2-ip-pool-aa] dns-list 8.8.8.8
[LSW2-ip-pool-aa]q                                     
[LSW2]ip pool bb                                
Info:It's successful to create an IP address pool.
[LSW2-ip-pool-bb] gateway-list 172.16.3.254                
[LSW2-ip-pool-bb] network 172.16.3.0 mask 24  
[LSW2-ip-pool-bb] dns-list 8.8.8.8
[LSW2-ip-pool-bb] dhcp enable
[LSW2]int Vlanif 2
[LSW2-Vlanif2]dhcp select global 
[LSW2-Vlanif2]q 
[LSW2]int Vlanif 3
[LSW2-Vlanif3]dhcp select global 
 

VLAN划分

LSW3

[LSW3]vlan batch 2 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[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-GigabitEthernet0/0/2]int g0/0/3
[LSW3-GigabitEthernet0/0/3]port link-type trunk 
[LSW3-GigabitEthernet0/0/3]port trunk allow-pass vlan all 
[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 all 

LSW4


[LSW4]vlan batch 2 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[LSW4]int g0/0/1
[LSW4-GigabitEthernet0/0/1]port link-type access 
[LSW4-GigabitEthernet0/0/1]port default vlan 2
[LSW4-GigabitEthernet0/0/1]int g0/0/2   
[LSW4-GigabitEthernet0/0/2]port link-type access 
[LSW4-GigabitEthernet0/0/2]port default vlan 3
[LSW4-GigabitEthernet0/0/2]int g0/0/3
[LSW4-GigabitEthernet0/0/3]port link-type trunk 
[LSW4-GigabitEthernet0/0/3]port trunk allow-pass vlan all 
[LSW4-GigabitEthernet0/0/3]int g0/0/4
[LSW4-GigabitEthernet0/0/4]port link-type trunk 
[LSW4-GigabitEthernet0/0/4]port trunk allow-pass vlan all
 

测试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值