多交换机实现全网互通

多交换机实现全网互通

实验目的

理解交换机接口的使用

理解三层交换机和二层交换机的数据转发

理解三层交换机的路由功能

理解VLAN的划分

如何实现不同VLAN之间互通

利用OSPF实现两个区域互通

实验拓扑

 

二层交换机与PC相连使用access接口

二层交换机与三层交换机相连使用trunk接口

三层交换机与三层交换机相连使用trunk接口

该实验核心层也可以使用rip路由协议,感兴趣的小伙伴可以试一试,我们此次实验使用的是OSPF路由协议

SW1-2:

interface Ethernet0/0/1

 port link-type access

 port default vlan 10

#

interface Ethernet0/0/2

 port link-type access

 port default vlan 20

#

interface Ethernet0/0/3

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

SW2-2:

interface Ethernet0/0/1

 port link-type access

 port default vlan 10

#

interface Ethernet0/0/2

 port link-type access

 port default vlan 20

#

interface Ethernet0/0/3

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

SW3-2:

interface Vlanif10

 ip address 192.168.10.254 255.255.255.0

#

interface Vlanif20

 ip address 192.168.20.254 255.255.255.0

#

interface Vlanif100

 ip address 192.168.12.1 255.255.255.252

#

interface MEth0/0/1

#

interface GigabitEthernet0/0/1

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

#

interface GigabitEthernet0/0/2

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

#

interface GigabitEthernet0/0/3

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

SW1-1-1:

interface Ethernet0/0/1

 port link-type access

 port default vlan 30

#

interface Ethernet0/0/2

 port link-type access

 port default vlan 40

#

interface Ethernet0/0/3

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

SW2-1-1:

interface Ethernet0/0/1

 port link-type access

 port default vlan 40

#

interface Ethernet0/0/2

 port link-type access

 port default vlan 50

#

interface Ethernet0/0/3

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

SW3-1-1:

interface Vlanif30

 ip address 192.168.30.254 255.255.255.0

#

interface Vlanif40

 ip address 192.168.40.254 255.255.255.0

#

interface Vlanif50

 ip address 192.168.50.254 255.255.255.0

#

interface Vlanif200

 ip address 192.168.13.1 255.255.255.252

#

interface MEth0/0/1

#

interface GigabitEthernet0/0/1

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

#

interface GigabitEthernet0/0/2

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

#

interface GigabitEthernet0/0/3

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

SW4-1:

interface Vlanif100

 ip address 192.168.12.2 255.255.255.252

#

interface Vlanif200

 ip address 192.168.13.2 255.255.255.252

#

interface MEth0/0/1

#

interface GigabitEthernet0/0/1

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

#

interface GigabitEthernet0/0/2

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

交换机配置OSPF:设备名称与拓扑图一样,路由表中设备名称与拓扑图名称不一致,但是同一设备

SW3-2:

 

ospf 1

 area 0.0.0.0

  network 192.168.10.0 0.0.0.255

  network 192.168.20.0 0.0.0.255

  network 192.168.12.0 0.0.0.3

SW3-1-1:

 

ospf 1

 area 0.0.0.0

  network 192.168.13.0 0.0.0.3

  network 192.168.30.0 0.0.0.255

  network 192.168.40.0 0.0.0.255

  network 192.168.50.0 0.0.0.255

SW4-1:

 

ospf 1

 area 0.0.0.0

  network 192.168.12.0 0.0.0.3

  network 192.168.13.0 0.0.0.3

都配置完成后,ping一下

 

 

可以看到,实现了全网互通

实验结束

备注:如有错误,请谅解!

此文章为本人学习笔记,仅供参考!如有重复!!!请联系本人!

  • 4
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
以下是具体的命令: 1. 配置路由器: ``` <Huawei> system-view [Huawei] interface gigabitethernet 0/0/0 // 进入 WAN 口 [Huawei-GigabitEthernet0/0/0] ip address 202.100.1.1 255.255.255.0 // 配置 IP 地址和子网掩码 [Huawei-GigabitEthernet0/0/0] quit [Huawei] interface gigabitethernet 0/0/1 // 进入 LAN 口 [Huawei-GigabitEthernet0/0/1] ip address 192.168.1.1 255.255.255.0 // 配置 IP 地址和子网掩码 [Huawei-GigabitEthernet0/0/1] quit [Huawei] ip route-static 0.0.0.0 0.0.0.0 202.100.1.254 // 配置默认路由 ``` 2. 配置交换机1: ``` <Huawei> system-view [Huawei] interface gigabitethernet 0/0/1 // 进入连接路由器的端口 [Huawei-GigabitEthernet0/0/1] port link-type access // 配置端口为接入模式 [Huawei-GigabitEthernet0/0/1] port default vlan 1 // 配置 VLAN 为 1 [Huawei-GigabitEthernet0/0/1] quit [Huawei] interface vlanif 1 // 进入 VLAN 1 [Huawei-Vlanif1] ip address 192.168.1.2 255.255.255.0 // 配置 IP 地址和子网掩码 [Huawei-Vlanif1] quit ``` 3. 配置交换机2: ``` <Huawei> system-view [Huawei] interface gigabitethernet 0/0/1 // 进入连接交换机1的端口 [Huawei-GigabitEthernet0/0/1] port link-type access // 配置端口为接入模式 [Huawei-GigabitEthernet0/0/1] port default vlan 1 // 配置 VLAN 为 1 [Huawei-GigabitEthernet0/0/1] quit [Huawei] interface vlanif 1 // 进入 VLAN 1 [Huawei-Vlanif1] ip address 192.168.1.3 255.255.255.0 // 配置 IP 地址和子网掩码 [Huawei-Vlanif1] quit ``` 4. 配置PC1和PC2: PC1: ``` ip address 192.168.1.4 255.255.255.0 // 配置 IP 地址和子网掩码 ip route add default gw 192.168.1.1 // 配置默认网关 ``` PC2: ``` ip address 192.168.1.5 255.255.255.0 // 配置 IP 地址和子网掩码 ip route add default gw 192.168.1.1 // 配置默认网关 ``` 这样,就可以实现全网互通了。PC1和PC2可以相互 ping 通,也可以访问互联网。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

晚风挽着浮云

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值