三层架构实验

本文详细介绍了如何在交换机和路由器上进行eth-trunk、VLAN、Spanning Tree Protocol (STP)、Virtual Router Redundancy Protocol (VRRP)以及Dynamic Host Configuration Protocol (DHCP)的配置步骤,包括配置示例和关键命令。适合学习网络设备管理的读者参考。

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

一、实验拓扑图

在这里插入图片描述

二、实验步骤

应为交换机和路由器都需要配置,故先配置交换机
1、eth-trunk
2、vlan
3、stp
4、svi
5、vrrp
6、dhcp

三、实验配置命令

1、eth-trunk配置
SW1
[sw1]int Eth-tr
[sw1]int Eth-Trunk 0
[sw1-Eth-Trunk0]int e0/0/1
[sw1-Ethernet0/0/1]eth-trunk 0
[sw1-Ethernet0/0/4]eth-tr
[sw1-Ethernet0/0/4]eth-trunk 0
SW2
[sw2]int Eth-Trunk 0
[sw2-Eth-Trunk0]int e0/0/1
[sw2-Ethernet0/0/1]eth-trunk 0
[sw2-Ethernet0/0/1]int e0/0/4
[sw2-Ethernet0/0/4]eth-trunk 0
2、vlan配置
SW1
interface Eth-Trunk0
port link-type trunk
port trunk allow-pass vlan 2 to 4094
interface Ethernet0/0/2
port hybrid tagged vlan 1 to 2

interface Ethernet0/0/3
port hybrid tagged vlan 1 to 2

interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
SW2

interface Eth-Trunk0
port link-type trunk
port trunk allow-pass vlan 2 to 4094

interface Ethernet0/0/2
port hybrid tagged vlan 1 to 2

interface Ethernet0/0/3
port hybrid tagged vlan 1 to 2

interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
SW3

interface Ethernet0/0/1
port link-type access

interface Ethernet0/0/2
port hybrid tagged vlan 1 to 2

interface Ethernet0/0/3
port hybrid tagged vlan 1 to 2

interface Ethernet0/0/4
port link-type access
port default vlan 2
SW4

interface Ethernet0/0/1
port link-type access

interface Ethernet0/0/2
port hybrid tagged vlan 1 to 2

interface Ethernet0/0/3
port hybrid tagged vlan 1 to 2

interface Ethernet0/0/4
port link-type access
port default vlan 2
3、stp
[sw1]stp region-configuration
[sw1-mst-region]region-name haha
[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

LSW 2
[sw2]stp region-configuration
[sw2-mst-region]region-name xixi
[sw2-mst-region]instance 1 vlan 1
[sw2-mst-region]instance 2 vlan 2
[sw2-mst-region]active region-configuration
Info: This operation may take a few seconds. Please wait for a moment…done.
[sw2-mst-region]q
[sw2]stp instance 1 root secondary
[sw2]stp instance 2 root primar

LSW3
[LSW3]stp re
[LSW3]stp region-configuration
[LSW3-mst-region]region-name ha
[LSW3-mst-region]instance 1 vlan 1
[LSW3-mst-region]instance 2 vlan 2
[LSW3-mst-region]active region-configuration
LSW4
[sw4]stp region-configuration
[sw4-mst-region]region-name xi
[sw4-mst-region]instance 1 vlan 1
[sw4-mst-region]instance 2 vlan 2
[sw4-mst-region]active region-configuration
4、svi
LSW1
[LSW1]interface vlan 1
[LSW1-Vlanif1]ip address 172.16.1.1 24
[LSW1]interface vlan 2
[LSW1-Vlanif2]ip address 172.16.2.1 24
LSW2
[LSW2]interface vlan 1
[LSW2-Vlanif1]ip address 172.16.1.2 24
LSW2]interface vlan 2
[LSW2-Vlanif2]ip address 172.16.2.2 24
5、vrrp
LSW1
[LSW1]interface vlan 1
[LSW1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.254
[LSW1-Vlanif1]vrrp vrid 1 priority 120
[LSW1-Vlanif1]vrrp vrid 1 track int g 0/0/5 reduced 20
[LSW1]interface vlan 2
[LSW1-Vlanif2]vrrp vrid 2 virtual-ip 172.16.2.254
[LSW1-Vlanif2]vrrp vrid 2 priority 120
[LSW1-Vlanif2]vrrp vrid 2 track interface GigabitEthernet 0/0/5 reduced 20
6、dhcp
LSW1
[LSW1]dhcp enable
[LSW1]ip pool ha
[LSW1-ip-pool-ha]network 172.16.1.0 mask 255.255.255.0
[LSW1-ip-pool-ha]gateway-list 172.16.1.254
[LSW1-ip-pool-ha]dns-list 114.114.114.114 8.8.8.8
[LSW1-ip-pool-ha]q
[LSW1]ip pool xi
Info:It’s successful to create an IP address pool.
[LSW1-ip-pool-xi]network 172.16.2.0 mask 255.255.255.0
[LSW1-ip-pool-xi]gateway-list 172.16.2.254
[LSW1-ip-pool-xi]dns-list 114.114.114.114 8.8.8.8
[LSW1]int v1
[LSW1-Vlanif1]dhcp select global
[LSW1-Vlanif1]int v2
[LSW1-Vlanif2]dhcp select global

LSW2
[LSW2]dhcp enable
[LSW2]ip pool haha
[LSW2-ip-pool-haha]network 172.16.1.0 mask 255.255.255.0
[LSW2-ip-pool-haha]gateway-list 172.16.1.253
[LSW2-ip-pool-haha]dns-list 114.114.114.114 8.8.8.8
[LSW2-ip-pool-haha]q
[LSW2]ip pool xixi
[LSW2-ip-pool-xixi]network 172.16.2.0 mask 255.255.255.0
[LSW2-ip-pool-xixi]gateway-list 172.16.2.253
[LSW2-ip-pool-xixi]dns-list 114.114.114.114 8.8.8.8
[LSW2-ip-pool-xixi]q
[LSW2]int v1
[LSW2-Vlanif1]dhcp select global
[LSW2-Vlanif1]int v2
[LSW2-Vlanif2]dhcp select globa
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值