交换综合实验

实验报告

一 实验要求

1.内网IP地址使用172.16.0.0/16

2.SW1和SW2之间互为备份

3.VRRP/stp/vlan/eth-trunk均使用

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

5.ISP只配置IP地址

6.所有电脑可以正常访问ISP路由器环回

二 实验拓补

三 实验步骤

首先,先配置VLAN

SW3vlan 2

SW3-vlan2vlan 3

SW4vlan 2

SW4-vlan2vlan 3

更改链路类型:

SW3int g0/0/1

SW3-GigabitEthernet0/0/1port link-type access

SW3-GigabitEthernet0/0/1port default vlan 2

SW3-GigabitEthernet0/0/1int g0/0/2

SW3-GigabitEthernet0/0/2port link-type access

SW3-GigabitEthernet0/0/2port link-type access

SW3port-group group-member GigabitEthernet 0/0/3 to GigabitEthernet 0/0/4

SW3-port-groupport link-type trunk

SW3-port-groupport trunk allow-pass vlan 2 3

SW4int g0/0/1

SW4-GigabitEthernet0/0/1port link-type access

SW4-GigabitEthernet0/0/1port default vlan 2

SW4-GigabitEthernet0/0/2port link-type access

SW4-GigabitEthernet0/0/2port default vlan 3

SW4port-group group-member GigabitEthernet 0/0/3 to GigabitEthernet 0/0/4

SW4-port-groupport link-type trunk

SW4-port-groupport trunk allow-pass vlan 2 3

网关设备:

SW1port-group group-member g0/0/3 to g0/0/4

SW1-port-groupport link-type trunk

SW1-port-groupport trunk allow-pass vlan 2 3

SW2port-group group-member g0/0/3 to g0/0/4

SW2-port-groupport link-type trunk

SW2-port-groupport trunk allow-pass vlan 2 3

SW1int vlanif 2

SW1-Vlanif2ip add 172.16.0.1 26

SW1-Vlanif2int vlanif 3

SW1-Vlanif3ip add 172.16.0.65 26

SW2int vlanif 2

SW2-Vlanif2ip add 172.16.0.2 26

SW2int vlanif 3

SW2-Vlanif3ip add 172.16.0.66 26

好 此时我们来查看一下配置情况 如下图

SW1:

SW2:

解决环路问题:(通过做链路聚合接口解决)

SW1int Eth-Trunk 0

SW2int Eth-Trunk 0

SW1-Eth-Trunk0trunkport GigabitEthernet 0/0/1 to 0/0/2

SW2-Eth-Trunk0trunkport GigabitEthernet 0/0/1 to 0/0/2

SW1-Eth-Trunk0port link-type trunk

SW1-Eth-Trunk0port trunk allow-pass vlan 2 3 10 20

SW2-Eth-Trunk0port link-type trunk

SW2-Eth-Trunk0port trunk allow-pass vlan 2 3 10 20

其他线路通过MSTP防环

SW1stp enable

SW1stp mode mstp

SW1stp region-configuration

SW1-mst-regionregion-name abc // 其他四个交换机名字要相同

SW1-mst-regionrevision-level 1

SW1-mst-regioninstance 1 vlan 2

SW1-mst-regioninstance 2 vlan 3

SW1-mst-regionactive region-configuration

SW2stp enable

SW2stp mode mstp

SW2stp region-configuration

SW2-mst-regionregion-name abc

SW2-mst-regionrevision-level 1

SW2-mst-regioninstance 1 vlan 2

SW2-mst-regioninstance 2 vlan 3

SW2-mst-regionactive region-configuration

SW3stp enable

SW3stp mode mstp

SW3stp region-configuration

SW3-mst-regionregion-name abc

SW3-mst-regionrevision-level 1

SW3-mst-regioninstance 1 vlan 2

SW3-mst-regioninstance 2 vlan 3

SW3-mst-regionactive region-configuration

SW4stp enable

SW4stp mode mstp

SW4stp region-configuration

SW4-mst-regionregion-name abc

SW4-mst-regionrevision-level 1

SW4-mst-regioninstance 1 vlan 2

SW4-mst-regioninstance 2 vlan 3

SW4-mst-regionactive region-configuration

SW3int g0/0/1

SW3-GigabitEthernet0/0/1stp edged-port enable

SW3-GigabitEthernet0/0/1int g0/0/2

SW3-GigabitEthernet0/0/2stp edged-port enable

SW4int g0/0/1

SW4-GigabitEthernet0/0/1stp edged-port enable

SW4-GigabitEthernet0/0/1int g0/0/2

SW4-GigabitEthernet0/0/2stp edged-port enable

SW3stp bpdu-protection

SW4stp bpdu-protection

SW1stp instance 1 root primary

SW1stp instance 2 root secondary

SW2stp instance 1 root secondary

SW2stp instance 2 root primary

网关备份:

Vlan2主网关:

SW1int vlanif 2

SW1-Vlanif2vrrp vrid 1 virtual-ip 172.16.0.62

SW1-Vlanif2vrrp vrid 1 priority 120

Vlan2备份网关:

SW2int vlanif 2

SW2-Vlanif2vrrp vrid 1 virtual-ip 172.16.0.62

Vlan3主网关:

SW2int vlanif 3

SW2-Vlanif3vrrp vrid 2 virtual-ip 172.16.0.126

SW2-Vlanif3vrrp vrid 2 priority 120

Vlan3备份网关

SW1int vlanif 3

SW1-Vlanif3vrrp vrid 2 virtual-ip 172.16.0.126

我们来查询一下配置情况:

由于网关的切换问题

下一步 配置监听接口

SW1int vlanif 2

SW1-Vlanif2vrrp vrid 1 track interface g0/0/5 reduced 30

SW2int vlanif 3

SW2-Vlanif3vrrp vrid 2 track interface g0/0/5 reduced 30

Vlan2的地址下发

SW1dhcp enable

SW1ip pool aa

SW1-ip-pool-aanetwork 172.16.0.0 mask 26

SW1-ip-pool-aagateway-list 172.16.0.62

SW1-ip-pool-aadns-list 8.8.8.8

SW1int vlanif 2

SW1-Vlanif2dhcp select global

SW2dhcp enable

SW2ip pool aa

SW2-ip-pool-aanetwork 172.16.0.0

SW2-ip-pool-aanetwork 172.16.0.0 mask 26

SW2-ip-pool-aagateway-list 172.16.0.62

SW2-ip-pool-aadns-list 8.8.8.8

SW2int vlanif 2

SW2-Vlanif2dhcp select global

Vlan3的地址下发

SW1ip pool bb

SW1-ip-pool-bbnetwork 172.16.0.64 mask 26

SW1-ip-pool-bbgateway-list 172.16.0.126

SW1-ip-pool-bbdns-list 8.8.8.8

SW1int Vlanif 3

SW1-Vlanif3dhcp select global

SW2ip pool bb

SW2-ip-pool-bbnetwork 172.16.0.64 mask 26

SW2-ip-pool-bbgateway-list 172.16.0.126

SW2-ip-pool-bbdns 8.8.8.8

SW2int Vlanif 3

SW2-Vlanif3dhcp select global

地址池配置完成

我们来ping测试

w

可见 已经实现了pc之间的互通

下一步,我们要实现全网通

首先 我们先配IP地址

SW1vlan 10

SW1int g0/0/5

SW1-GigabitEthernet0/0/5port link-type access

SW1-GigabitEthernet0/0/5port default vlan 10

SW1int Vlanif 10

SW1-Vlanif10ip add 172.16.0.129 26

SW2vlan 20

SW2-GigabitEthernet0/0/5port link-type access

SW2-GigabitEthernet0/0/5port default vlan 20

SW2int Vlanif 20

SW2-Vlanif20ip add 172.16.0.193 26

R1;

ISP:

下一步 配置路由协议,使得内网互通

SW1ospf 1 router-id 1.1.1.1

SW1-ospf-1a 0

SW1-ospf-1-area-0.0.0.0net 172.16.0.0 0.0.0.63

SW1-ospf-1-area-0.0.0.0net 172.16.0.64 0.0.0.63

SW1-ospf-1-area-0.0.0.0net 172.16.0.128 0.0.0.63

SW2ospf 1 router-id 2.2.2.2

SW2-ospf-1a 0

SW2-ospf-1-area-0.0.0.0net 172.16.0.0 0.0.0.63

SW2-ospf-1-area-0.0.0.0net 172.16.0.64 0.0.0.63

SW2-ospf-1-area-0.0.0.0net 172.16.0. 0.0.0.63

R1ospf 1 router-id 3.3.3.3

R1-ospf-1a 0

R1-ospf-1-area-0.0.0.0net 172.16.0.128 0.0.0.63

R1-ospf-1-area-0.0.0.0net 172.16.0.192 0.0.0.63

好 我们此时已经配置完成 全网互通 我们查一下OSPF配置情况

IP学习情况

我们顺便再用ping命令测试是否内网通

下一步 配置NAT,使得内网访问公网

R1acl 2000

R1-acl-basic-2000rule permit source 172.16.0.0 0.0.0.255

R1int g0/0/0

R1-GigabitEthernet0/0/0nat outbound 2000

R1ip route-static 0.0.0.0 0 12.0.0.2

R1ospf 1

R1-ospf-1default-route-advertise

好 我们来ping测试一下 内网是否能访问公网

好 配置完成,实验到此结束

相关推荐
鲁邦通物联网7 小时前
DP动力定位系统网关替换实践:通信报文、接口迁移与测试基线设计
网络·数据库·海事网关·海事网络安全·海事网络安全网关·智慧航运·船舶远程监控
SHENGWEI胜为9 小时前
胜为CZDF-624六类24口免打配线架怎么安装?机房布线实操解析
服务器·网络·综合布线·rj45接口·胜为光通信·六类配线架
图映 图片处理9 小时前
浏览器本地压缩图片安全吗:基于网络请求与文件传输的验证方法
服务器·网络·安全
吴声子夜歌10 小时前
Kubernetes进阶实战——网络模型与网络策略(四)
网络·kubernetes
半个布点11 小时前
AUTOSAR COM 模块详解|Signal、I‑PDU、发送模式、网关、滤波全梳理
网络
半个布点11 小时前
AUTOSAR CanIf 模块完整详解
网络
天启HTTP13 小时前
爬虫返回403错误?从请求特征到网络环境逐步排查
网络·爬虫·tcp/ip
Java后端的Ai之路14 小时前
Anthropic 官方文章《Building always-on agents》构建指南
开发语言·网络·python
国科安芯15 小时前
光链路捕获的那一刻:商业激光通信终端捕获跟踪伺服与探测前端的低噪声供电
前端·网络·卫星·电源芯片·抗辐照芯片·在轨