华为s3700之Vlan,Trunk,及路由表 您所在的位置:网站首页 华为交换机查看路由表容量 华为s3700之Vlan,Trunk,及路由表

华为s3700之Vlan,Trunk,及路由表

2024-02-25 23:38| 来源: 网络整理| 查看: 265

1 VLAN技术及应用 1.1 VLAN 1.1.1 广播域 1.1.2 VLNA -----虚拟局域网 1.2 VLAN配置 1.2.1 实验环境 1.2.1 配置vlan步骤 1.2.2 批量增删vlan 2 Trunk 2.1 Trunk原理 2.2 配置trunk 2.3.1 查看接口配置 display this 2.3.2 清空接口Ethernet 0/0/7的所有配置,恢复默认 2.3.3 链路聚合Eth-Trunk 3 网络层解析 3.1 路由表 3.1.1 路由器产生路由表----直连路由 3.2.2 静态路由--------指定下一跳

1 VLAN技术及应用 1.1 VLAN

学习 → 广播 → 转发 → 更新

//pc1 ping pc4 display mac-address MAC address table of slot 0: ------------------------------------------------------------------------------- MAC Address VLAN/ PEVLAN CEVLAN Port Type LSP/LSR-ID VSI/SI MAC-Tunnel ------------------------------------------------------------------------------- 5489-9845-1d5f 1 - - Eth0/0/2 dynamic 0/- 5489-9829-3af2 1 - - Eth0/0/3 dynamic 0/- ------------------------------------------------------------------------------- Total matching items on slot 0 displayed = 2 //pc1 ping pc4 display mac-address MAC address table of slot 0: ------------------------------------------------------------------------------- MAC Address VLAN/ PEVLAN CEVLAN Port Type LSP/LSR-ID VSI/SI MAC-Tunnel ------------------------------------------------------------------------------- 5489-9845-1d5f 1 - - Eth0/0/2 dynamic 0/- 5489-9829-3af2 1 - - Eth0/0/3 dynamic 0/- 5489-98ed-50b8 1 - - Eth0/0/1 dynamic 0/- ------------------------------------------------------------------------------- Total matching items on slot 0 displayed = 3

1.1.1 广播域 学习 → 广播 → 转发 → 更新

广播域,指接收同样广播信息的节点的集合,可以接受相同广播的范围广播泛滥, 在相同广播域主机过多造成的不良现象交换机的所有接口默认属于同一个广播域(广播时, 交换机会向除了数据发送的主机之外的所有其他主机广播,广播的范围为一个广播域,当广播域主机比较多,广播量很大→广播泛滥,占用大量交换机内存空间,运行变慢卡顿,甚至出现宕机) 1.1.2 VLNA -----虚拟局域网解决广播泛滥造成的不良现象增加安全提高带宽利用率减低数据传递的延迟

1.2 VLAN配置 1.2.1 实验环境

实验:1台S3770交换机,6台PC (192.168.0.1/24-192.168.0.6/24)vlan1 pc1-2 vlan2 pc3-4 vlan3 pc3-4 1.2.1 配置vlan步骤创建vlan system-view → vlan 2 → vlan 3默认所有端口都在vlan1删除vlan(系统视图下) system-view → undo vlan 2查看vlan (任意试图下)display vlan批量添加vlan system-view → vlan batch 10 to 20批量删除vlan undo vlan batch 10 to 20将接口加入到相应的vlan [Huawei]interface ethernet 0/0/3 //进入3号接口 [Huawei-Ethernet0/0/3]port link-type access //将接口定义为接入链路,代表即将规划到某一个vlan中 [Huawei-Ethernet0/0/3]port default vlan 2 //将3号接口加入vlan2 的广播域,表示将来此接口只会传递vlan2区域的数据 ..............省略 // 依次添加 Eth/0/0/3 ~ Eth0/0/6 到对应vlan 验证 display vlan [Huawei-Ethernet0/0/5]display vlan //查看 The total number of vlans is : 3 -------------------------------------------------------------------------------- U: Up; D: Down; TG: Tagged; UT: Untagged; MP: Vlan-mapping; ST: Vlan-stacking; #: ProtocolTransparent-vlan; *: Management-vlan; -------------------------------------------------------------------------------- VID Type Ports -------------------------------------------------------------------------------- 1 common UT:Eth0/0/1(U) Eth0/0/2(U) Eth0/0/7(D) Eth0/0/8(D) Eth0/0/9(D) Eth0/0/10(D) Eth0/0/11(D) Eth0/0/12(D) Eth0/0/13(D) Eth0/0/14(D) Eth0/0/15(D) Eth0/0/16(D) Eth0/0/17(D) Eth0/0/18(D) Eth0/0/19(D) Eth0/0/20(D) Eth0/0/21(D) Eth0/0/22(D) GE0/0/1(D) GE0/0/2(D) 2 common UT:Eth0/0/3(U) Eth0/0/4(U) 3 common UT:Eth0/0/5(U) Eth0/0/6(U) VID Status Property MAC-LRN Statistics Description -------------------------------------------------------------------------------- 1 enable default enable disable VLAN 0001 2 enable default enable disable VLAN 0002 3 enable default enable disable VLAN 0003 如某个接口划分错误, 可以重新配置vlan,进入对应接口 → port link-type access → port default vlan 编号 → display vlan 编号1.2.2 批量增删vlan vlan batch 10 to 20undo vlan batch 10 to 20 port-group batch 1 to 5 undo port-group batch 1 to 5 port-group group-member 接口1 接口2 接口3 .。。。

2 Trunk 2.1 Trunk原理

access 接入链路 ,可以承载一个vlan的数据trunk 中继链路 ,可以承载多个vlan的数据两交换机连接接口默认归属于Vlan1

2.2 配置trunk system-view → interface ethernet 0/0/7 → port link-type trunk 和 port trunk allow-pass vlan all

取消trunk标记 undo port trunk allow-pass vlan all两台交换机的两个接口都要配置Trunk system-view //1 进入系统视图 Enter system view, return user view with Ctrl+Z. [Huawei]in e0/0/7 //2 进入交换机接口 [Huawei-Ethernet0/0/7]port link-type trunk //3 将接口配置为中继链路 [Huawei-Ethernet0/0/7]port trunk allow-pass vlan all //4 放行所有vlan的数据通过 [Huawei-Ethernet0/0/7]display vlan //查看 The total number of vlans is : 3 -------------------------------------------------------------------------------- U: Up; D: Down; TG: Tagged; UT: Untagged; MP: Vlan-mapping; ST: Vlan-stacking; #: ProtocolTransparent-vlan; *: Management-vlan; -------------------------------------------------------------------------------- VID Type Ports -------------------------------------------------------------------------------- 1 common UT:Eth0/0/1(U) Eth0/0/2(U) Eth0/0/7(U) Eth0/0/8(D) Eth0/0/9(D) Eth0/0/10(D) Eth0/0/11(D) Eth0/0/12(D) Eth0/0/13(D) Eth0/0/14(D) Eth0/0/15(D) Eth0/0/16(D) Eth0/0/17(D) Eth0/0/18(D) Eth0/0/19(D) Eth0/0/20(D) Eth0/0/21(D) Eth0/0/22(D) GE0/0/1(D) GE0/0/2(D) 2 common UT:Eth0/0/3(U) Eth0/0/4(U) TG:Eth0/0/7(U) 3 common UT:Eth0/0/5(U) Eth0/0/6(U) TG:Eth0/0/7(U)

2.3 链路聚合 2.3.1 查看接口配置 display this

查看配置 display current-configuration[Huawei-Ethernet0/0/7]display this # interface Ethernet0/0/7 port link-type trunk port trunk allow-pass vlan 2 to 4094 # return [Huawei-Ethernet0/0/7]

2.3.2 清空接口Ethernet 0/0/7的所有配置,恢复默认 system-view → clear configuration interface Ethernet 0/0/7 → interface ethernet 0/0/7 → undo shutdown

system-view //1 进入系统视图 Enter system view, return user view with Ctrl+Z. [Huawei]clear configuration interface ethernet 0/0/7 //2 恢复接口默认配置,恢复后接口会被关闭 Warning: All configurations of the interface will be cleared, and its state will be shutdown. Continue? [Y/N] :y Info: Total execute 2 command(s), 2 successful, 0 failed. [Huawei]in e0/0/7 //3 进入该接口 [Huawei-Ethernet0/0/7]undo shutdown //4 开启接口

2.3.3 链路聚合Eth-Trunk

system-view → interface eth-trunk 1 → trunkport ethernet 0/0/7 0/0/8 → port link-type trunk → port trunk allow-pass vlan all [Huawei]interface eth-trunk 1 //1 进入eth-trunk 1号接口 [Huawei-Eth-Trunk1]trunkport ethernet 0/0/7 0/0/8 //2 捆绑7号,8号接口 Info: This operation may take a few seconds. Please wait for a moment...done. [Huawei-Eth-Trunk1]port link-type trunk //3 将这个链路聚合接口设置为中继链路trunk [Huawei-Eth-Trunk1]port trunk allow-pass vlan all //4 放行所有vlan的数据通过 [Huawei-Eth-Trunk1]display vlan The total number of vlans is : 3 -------------------------------------------------------------------------------- U: Up; D: Down; TG: Tagged; UT: Untagged; MP: Vlan-mapping; ST: Vlan-stacking; #: ProtocolTransparent-vlan; *: Management-vlan; -------------------------------------------------------------------------------- VID Type Ports -------------------------------------------------------------------------------- 1 common UT:Eth0/0/1(U) Eth0/0/2(U) Eth0/0/9(D) Eth0/0/10(D) Eth0/0/11(D) Eth0/0/12(D) Eth0/0/13(D) Eth0/0/14(D) Eth0/0/15(D) Eth0/0/16(D) Eth0/0/17(D) Eth0/0/18(D) Eth0/0/19(D) Eth0/0/20(D) Eth0/0/21(D) Eth0/0/22(D) GE0/0/1(D) GE0/0/2(D) Eth-Trunk1(U) 2 common UT:Eth0/0/3(U) Eth0/0/4(U) TG:Eth-Trunk1(U) 3 common UT:Eth0/0/5(U) Eth0/0/6(U) TG:Eth-Trunk1(U) VID Status Property MAC-LRN Statistics Description -------------------------------------------------------------------------------- 1 enable default enable disable VLAN 0001 2 enable default enable disable VLAN 0002 3 enable default enable disable VLAN 0003

两交换机都要重新进行配置 3 网络层解析 3.1 路由表 交换机通过mac地址表 网关:转发数据到不同网段 路由器可以实现不同范围网络的连接,路由器要依靠路由表来传递数据 3.1.1 路由器产生路由表----直连路由 1 直连路由网络配置

同样配置第二台电脑 直连路由生成—路由接口配置IP好并开启后自动生成 system-view → in g0/0/0 → ip address 192.168.1.254 24 → in g0/0/1 → ip address 192.168.2.1 24

system-view Enter system view, return user view with Ctrl+Z. [Huawei]interface g0/0/0 [Huawei-GigabitEthernet0/0/0]ip address 192.168.1.254 24 //gibabitethernet0/0/0配置IP [Huawei-GigabitEthernet0/0/0]in g0/0/1 [Huawei-GigabitEthernet0/0/1]ip address 192.168.2.1 24 gibabitethernet0/0/1配置IP 查看路由表 display ip routing-table | include /24 查看路由表信息,过滤包含/24的内容 [Huawei]display ip routing-table | include /24 Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 10 Routes : 10 Destination/Mask Proto Pre Cost Flags NextHop Interface 192.168.1.0/24 Direct 0 0 D 192.168.1.254 GigabitEthernet0/0/0 192.168.2.0/24 Direct 0 0 D 192.168.2.1 GigabitEthernet0/0/1 查看IP地址 display ip interface brief [Huawei]display ip interface brief *down: administratively down ^down: standby (l): loopback (s): spoofing The number of interface that is UP in Physical is 3 The number of interface that is DOWN in Physical is 1 The number of interface that is UP in Protocol is 3 The number of interface that is DOWN in Protocol is 1 Interface IP Address/Mask Physical Protocol GigabitEthernet0/0/0 192.168.1.254/24 up up GigabitEthernet0/0/1 192.168.2.1/24 up up GigabitEthernet0/0/2 unassigned down down NULL0 unassigned up up(s) [Huawei]

3.2.2 静态路由--------指定下一跳 新增路由器AR2,并配置AR2的三个接口IP

[Huawei-ui-console0]interface g0/0/0 [Huawei-GigabitEthernet0/0/0]ip address 192.168.2.2 24 //0号接口ip,离192.168.3.0和4.0网络最近的ip接口 [Huawei-GigabitEthernet0/0/0]in g0/0/1 [Huawei-GigabitEthernet0/0/1]ip address 192.168.3.254 24 //1号接口ip,3.0网段的网关 [Huawei-GigabitEthernet0/0/1]in g0/0/2 [Huawei-GigabitEthernet0/0/2]ip address 192.168.4.254 24 //2号接口ip,4.0网段的网关 [Huawei-GigabitEthernet0/0/2]display ip interface brief //查看接口ip概要 *down: administratively down ^down: standby (l): loopback (s): spoofing The number of interface that is UP in Physical is 4 The number of interface that is DOWN in Physical is 0 The number of interface that is UP in Protocol is 4 The number of interface that is DOWN in Protocol is 0 Interface IP Address/Mask Physical Protocol GigabitEthernet0/0/0 192.168.2.2/24 up up GigabitEthernet0/0/1 192.168.3.254/24 up up GigabitEthernet0/0/2 192.168.4.254/24 up up NULL0 unassigned up 配置完后查看路由表------默认静态路由, 不能联通两个路由器的情况 [Huawei]display ip routing-table | include /24 Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 13 Routes : 13 Destination/Mask Proto Pre Cost Flags NextHop Interface 192.168.2.0/24 Direct 0 0 D 192.168.2.2 GigabitEthernet0/0/ 0 192.168.3.0/24 Direct 0 0 D 192.168.3.254 GigabitEthernet0/0/ 1 192.168.4.0/24 Direct 0 0 D 192.168.4.254 GigabitEthernet0/0/ 2 [Huawei]

静态路由配置 AR1路由器配置 ip route-static 192.168.4.0 24

192.168.2.2 //可以去192.168.4.0 网段 AR2 ip route-static 192.168.1.0 24 192.168.2.1 //可以去192.168.1.0 网段


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有