三层交换实验

该配置过程详细描述了交换机的Eth-Trunk通道建立、VLAN划分、trunk配置、STP以确保链路冗余、SVI接口IP分配以及VRRP协议应用以实现网关冗余。此外,还包括了DHCP服务的启用和IP地址池的设定,为网络设备动态分配IP地址。

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

1、实验要求

2、实验拓扑

3、配置

在交换配置部分一般先进行交换机的配置,最后再配置路由ip。而路由部分,先配ip再配置交换机。

一般交换的配置涉及VLAN trunk svi channel STP vrrp dhcp 等配置

该题目的配置顺序可以为:也是一般交换配置的顺序

channel,VLAN ,trunk, stp, svi, vrrp, DHCP

1、channel

[SW1]int Eth-Trunk 0
[SW1-GigabitEthernet0/0/22]int g0/0/22    
[SW1-GigabitEthernet0/0/22]eth-trunk 0
[SW1-GigabitEthernet0/0/22]int g0/0/23
[SW1-GigabitEthernet0/0/23]eth-trunk 0

[SW2]interface Eth-Trunk 0
[SW2-Eth-Trunk0]int g0/0/22
[SW2-GigabitEthernet0/0/22]eth-trunk 0
[SW2-Eth-Trunk0]int g0/0/23
[SW2-GigabitEthernet0/0/23]eth-trunk 0

2、vlan及trunk

[SW1]vlan 2
[SW1-vlan2]q
[SW1]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2  Eth
-Trunk 0    
[SW1-port-group]port link-type trunk 
[SW1-port-group]port trunk allow-pass vlan 2

[SW2]vlan 2
[SW2-vlan2]q
[SW2]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2 Eth-
Trunk 0
[SW2-port-group]port link-type trunk 
[SW2-port-group]port trunk allow-pass vlan 2

[SW3]vlan 2
[SW3-vlan2]int e0/0/2
[SW3-Ethernet0/0/2]port link-type access 
[SW3-Ethernet0/0/2]port default vlan 2
[SW3-Ethernet0/0/2]q
[SW3]int g0/0/1
[SW3-GigabitEthernet0/0/1]port link-type trunk 
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan 2
[SW3-GigabitEthernet0/0/1]int g0/0/2
[SW3-GigabitEthernet0/0/2]port link-type trunk 
[SW3-GigabitEthernet0/0/2]port trunk allow-pass vlan all 

[SW4]vlan  2
[SW4-vlan2]int e0/0/2
[SW4-Ethernet0/0/2]port link-type access 
[SW4-Ethernet0/0/2]port default vlan 2
[SW4]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2 
[SW4-port-group]port link-type trunk 
[SW4-port-group]port trunk allow-pass vlan 2

3、stp

由于题目要求的是这2个交换机设备冗余,因此我们需要干涉stp生成树的形成。

方法:让sw1成为组一的根,放VLAN1,成为组2 的备份根。sw2相反

[SW1]stp enable   
[SW1]stp region-configuration  
[SW1-mst-region]region-name a  
[SW1-mst-region]instance 1 vlan 1 
[SW1-mst-region]instance 2 vlan  2
[SW1-mst-region]active region-configuration   
[SW1-mst-region]q
[SW1]stp instance 1 root primary     
[SW1]stp instance 2 root secondary   

[SW2]stp region-configuration 
[SW2-mst-region]region-name a
[SW2-mst-region]instance 1 vlan 1
[SW2-mst-region]instance 2 vlan 2
[SW2-mst-region]active region-configuration 
[SW2-mst-region]q
[SW2]stp instance 1 root secondary 
[SW2]stp instance 2 root primary 

[SW3]stp region-configuration 
[SW3-mst-region]region-name a
[SW3-mst-region]instance 1 vlan 1
[SW3-mst-region]instance 2 vlan 2
[SW3-mst-region]active region-configuration 

[SW4]stp region-configuration
[SW4-mst-region]region-name a
[SW4-mst-region]instance 1 vlan 1
[SW4-mst-region]instance 2 vlan 2
[SW4-mst-region]active region-configuration

4、svi

是交换机可配置ip

[SW1]int Vlanif 1
[SW1-Vlanif1]ip ad 172.16.1.1 25
[SW1-Vlanif1]q
[SW1]interface Vlanif 2
[SW1-Vlanif2]ip ad 172.16.1.129 25

[SW2]int Vlanif 1
[SW2-Vlanif1]ip ad 172.16.1.2 25
[SW2-Vlanif1]q
[SW2]int Vlanif 2
[SW2-Vlanif2]ip ad 172.16.1.130 25

5、VRRP

这个协议可使网关冗余

[SW1]int Vlanif 1
[SW1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126    
[SW1-Vlanif1]vrrp vrid 1 priority 105     
[SW1-Vlanif1]vrrp vrid 1 track interface GigabitEthernet 0/0/24 
[SW1-Vlanif1]q
[SW1]int vlan 2
[SW1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254  

[SW2]int Vlanif 1
[SW2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[SW2-Vlanif1]q
[SW2]int vlan 2
[SW2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
[SW2-Vlanif2]vrrp vrid 1 priority 105
[SW2-Vlanif2]vrrp vrid 1 track interface g0/0/24 

6、DHCP

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


[SW2]dhcp enable 
[SW2]ip pool 1
[SW2-ip-pool-1]network 172.16.1.0 mask 25
[SW2-ip-pool-1]gateway-list 172.16.1.126
[SW2-ip-pool-1]dns-list 114.114.114.114
[SW2-ip-pool-1]q
[SW2]ip pool 2
[SW2-ip-pool-2]network 172.16.1.128 mask 25
[SW2-ip-pool-2]gateway-list 172.16.1.254
[SW2-ip-pool-2]dns-list 114.114.114.114
[SW2]int Vlanif 1
[SW2-Vlanif1]dhcp select global 
[SW2-Vlanif1]q
[SW2]int vlan 2
[SW2-Vlanif2]dhcp select global

4、验证

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值