华为交换机简单小型公司组网配置实验,实现vlanif通信

小编:霸主 更新时间:2022-05-06
华为交换机简单小型公司组网配置实验,实现vlanif通信

网络拓扑图

小型网络结构,通过vlan划分多个部门,通过vlanif三层接口进行部门之间的互通,并且实现广播域的隔离;并且各个接入交换机使用Eth-Trunk进行端口汇聚,提高接入交换机与汇聚交换机之间的带宽,并且提供一定的链路冗余功能,增加网络的可靠性。

接入路由器配置信息

提供互联网的访问,DNS解析功能等

The device is running! system-view # 进入系统视图 Enter system view, return user view with Ctrl+Z. [Huawei]sysname Ar #修改设备名称 [Ar]interface GigabitEthernet 0/0/0 #进入端口0/0/0 [Ar-GigabitEthernet0/0/0]ip address 10.11.12.13 24 #配置IP地址及子网掩码 [Ar-GigabitEthernet0/0/0]ping 10.11.12.1 #检测连接性 PING 10.11.12.1: 56 data bytes, press CTRL_C to break Reply from 10.11.12.1: bytes=56 Sequence=1 ttl=128 time=90 ms Reply from 10.11.12.1: bytes=56 Sequence=2 ttl=128 time=10 ms Reply from 10.11.12.1: bytes=56 Sequence=3 ttl=128 time=10 ms Reply from 10.11.12.1: bytes=56 Sequence=4 ttl=128 time=10 ms Reply from 10.11.12.1: bytes=56 Sequence=5 ttl=128 time=10 ms --- 10.11.12.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 10/26/90 ms [Ar-GigabitEthernet0/0/0]quit [Ar]interface GigabitEthernet 0/0/1 #进入端口0/0/1 [Ar-GigabitEthernet0/0/1]ip address 192.168.99.1 24 #配置IP地址及子网掩码,用于下联核心交换机 [Ar-GigabitEthernet0/0/1]quit #退出端口 [Ar]acl 2000 #创建acl 2000 [Ar-acl-basic-2000]rule permit source 192.168.10.0 0.0.0.255 #配置允许源IP地址及长度,这是switch A的 [Ar-acl-basic-2000]rule permit source 192.168.20.0 0.0.0.255 #配置允许源IP地址及长度,这是switch B的 [Ar-acl-basic-2000]rule permit source 192.168.99.0 0.0.0.255 #配置允许源IP地址及长度 [Ar-acl-basic-2000]quit #退出acl [Ar]interface GigabitEthernet 0/0/0 #进入端口0/0/0 [Ar-GigabitEthernet0/0/0]nat outbound 2000 #配置nat out匹配acl 2000 [Ar-GigabitEthernet0/0/0]quit #退出端口 [Ar]dns server 114.114.114.114 #配置dns服务器地址 [Ar]dns resolve #开启dns解析功能 [Ar]ip route-static 192.168.10.0 255.255.255.0 192.168.99.2 #配置访问Switch A的路由 [Ar]ip route-static 192.168.20.0 255.255.255.0 192.168.99.2 #配置访问Switch B的路由 [Ar]ip route-static 0.0.0.0 0.0.0.0 10.11.12.1 #配置默认路由指向出口网关 [Ar]ping www.baidu.com #检测网络连接性 PING www.a.shifen.com: 56 data bytes, press CTRL_C to break Reply from 182.61.200.7: bytes=56 Sequence=1 ttl=128 time=90 ms Reply from 182.61.200.7: bytes=56 Sequence=2 ttl=128 time=90 ms Reply from 182.61.200.7: bytes=56 Sequence=3 ttl=128 time=80 ms Reply from 182.61.200.7: bytes=56 Sequence=4 ttl=128 time=80 ms Reply from 182.61.200.7: bytes=56 Sequence=5 ttl=128 time=80 ms --- www.a.shifen.com ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 80/84/90 ms

核心交换机配置信息

The device is running! system-view #进入系统视图 Enter system view, return user view with Ctrl+Z. [Huawei]sysname Switch Core #修改设备名称 [Switch Core]undo info-center enable #关闭信息提示 Info: Information center is disabled. [Switch Core]vlan batch 10 20 99 #批量创建vlan Info: This operation may take a few seconds. Please wait for a moment...done. [Switch Core]interface GigabitEthernet 0/0/1 #进入端口0/0/1 [Switch Core-GigabitEthernet0/0/1]port link-type access #配置端口类型 [Switch Core-GigabitEthernet0/0/1]port default vlan 99 #配置端口默认vlan [Switch Core-GigabitEthernet0/0/1]quit #退出端口 [Switch Core]interface Eth-Trunk 1 #进入eth-trunk 1端口 [Switch Core-Eth-Trunk1]port link-type trunk #配置端口类型 [Switch Core-Eth-Trunk1]port trunk allow-pass vlan 10 #配置允许通过的vlan [Switch Core-Eth-Trunk1]mode lacp-static #配置eth-trunk端口模式为lacp [Switch Core-Eth-Trunk1]quit #退出eth-trunk端口 [Switch Core]interface Eth-Trunk 2 #进入eth-trunk 2端口 [Switch Core-Eth-Trunk2]port link-type trunk #配置端口类型 [Switch Core-Eth-Trunk2]port trunk allow-pass vlan 20 #配置允许通过的vlan [Switch Core-Eth-Trunk2]mode lacp-static #配置eth-trunk端口模式为lacp [Switch Core-Eth-Trunk2]quit #退出eth-trunk端口 [Switch Core]interface GigabitEthernet 0/0/2 #进入端口0/0/1 [Switch Core-GigabitEthernet0/0/2]eth-trunk 1 #添加端口到eth-trunk 1 Info: This operation may take a few seconds. Please wait for a moment...done. [Switch Core-GigabitEthernet0/0/2]quit #退出端口 [Switch Core]interface GigabitEthernet 0/0/3 #进入端口0/0/3 [Switch Core-GigabitEthernet0/0/3]eth-trunk 1 #添加端口到eth-trunk 1 Info: This operation may take a few seconds. Please wait for a moment...done. [Switch Core-GigabitEthernet0/0/3]quit #退出端口 [Switch Core]interface GigabitEthernet 0/0/4 #进入端口0/0/4 [Switch Core-GigabitEthernet0/0/4]eth-trunk 2 #添加端口到eth-trunk 2 Info: This operation may take a few seconds. Please wait for a moment...done. [Switch Core-GigabitEthernet0/0/4]quit #退出端口 [Switch Core]interface GigabitEthernet 0/0/5 #进入端口0/0/5 [Switch Core-GigabitEthernet0/0/5]eth-trunk 2 #添加端口到eth-trunk 2 Info: This operation may take a few seconds. Please wait for a moment...done. [Switch Core-GigabitEthernet0/0/5]quit #退出端口 [Switch Core]interface Vlanif 99 #进入vlan if99 端口 [Switch Core-Vlanif99]ip address 192.168.99.2 24 #配置IP地址及子网掩码 [Switch Core-Vlanif99]ping 192.168.99.1 #检测与路由器的连通性 PING 192.168.99.1: 56 data bytes, press CTRL_C to break Reply from 192.168.99.1: bytes=56 Sequence=1 ttl=255 time=100 ms Reply from 192.168.99.1: bytes=56 Sequence=2 ttl=255 time=50 ms Reply from 192.168.99.1: bytes=56 Sequence=3 ttl=255 time=50 ms Reply from 192.168.99.1: bytes=56 Sequence=4 ttl=255 time=50 ms Reply from 192.168.99.1: bytes=56 Sequence=5 ttl=255 time=50 ms --- 192.168.99.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 50/60/100 ms [Switch Core-Vlanif99]quit #退出端口 [Switch Core]interface Vlanif 10 #进入vlan if 10 端口 [Switch Core-Vlanif10]ip address 192.168.10.1 24 #配置IP地址及子网掩码 [Switch Core-Vlanif10]quit #退出端口 [Switch Core]interface Vlanif 20 #进入vlan if 20端口 [Switch Core-Vlanif20]ip address 192.168.20.1 24 #配置IP地址及子网掩码 [Switch Core-Vlanif20]quit #退出端口

核心交换机的DHCP配置信息

[Switch Core]ip route-static 0.0.0.0 0.0.0.0 192.168.99.1 #配置核心交换机的默认路由并指向上级路由器 [Switch Core]dhcp enable #开启dhcp功能 Info: The operation may take a few seconds. Please wait for a moment.done. [Switch Core]ip pool huawei-10 #创建IP地址池huawei-10 Info:It's successful to create an IP address pool. [Switch Core-ip-pool-huawei-10]network 192.168.10.0 mask 24 #配置地址池网段及子网掩码长度 [Switch Core-ip-pool-huawei-10]gateway-list 192.168.10.1 #配置地址池网关 [Switch Core-ip-pool-huawei-10]dns-list 114.114.114.114 #配置地址池dns地址 [Switch Core-ip-pool-huawei-10]quit #退出 [Switch Core]ip pool huawei-20 #创建IP地址池huawei-20 Info:It's successful to create an IP address pool. [Switch Core-ip-pool-huawei-20]network 192.168.20.0 mask 24 #配置地址池网段及子网掩码长度 [Switch Core-ip-pool-huawei-20]gateway-list 192.168.20.1 #配置地址池网关 [Switch Core-ip-pool-huawei-20]dns-list 114.114.114.114 #配置地址池dns地址 [Switch Core-ip-pool-huawei-20]quit #退出 [Switch Core]interface Vlanif 10 #进入vlan if 10端口 [Switch Core-Vlanif10]dhcp select global #配置dhcp分配方式为全局 [Switch Core-Vlanif10]quit #退出 [Switch Core]interface Vlanif 20 #进入vlan if 20端口 [Switch Core-Vlanif20]dhcp select global #配置dhcp分配方式为全局 [Switch Core-Vlanif20]quit #退出

接入交换机的配置信息

Switch A

The device is running! system-view #进入系统视图 Enter system view, return user view with Ctrl+Z. [Huawei]sysname Switch A #修改设备名称 [Switch A]undo info-center enable #关闭信息提示 Info: Information center is disabled. [Switch A]vlan 10 #创建vlan 10 [Switch A-vlan10]quit #退出 [Switch A]interface Eth-Trunk 1 #进入Eth-Trunk 1端口 [Switch A-Eth-Trunk1]port link-type trunk #配置端口类型 [Switch A-Eth-Trunk1]port trunk allow-pass vlan 10 #配置允许通过的vlan为10 [Switch A-Eth-Trunk1]mode lacp-static #配置Eth-Trunk模式为lacp [Switch A-Eth-Trunk1]quit #退出端口 [Switch A]interface GigabitEthernet 0/0/1 #进入端口0/0/1 [Switch A-GigabitEthernet0/0/1]eth-trunk 1 #添加端口到Eth-Trunk 1 Info: This operation may take a few seconds. Please wait for a moment...done. [Switch A-GigabitEthernet0/0/1]quit #退出端口 [Switch A]interface GigabitEthernet 0/0/2 #进入端口0/0/2 [Switch A-GigabitEthernet0/0/2]eth-trunk 1 #添加端口到Eth-Trunk 1 Info: This operation may take a few seconds. Please wait for a moment...done. [Switch A-GigabitEthernet0/0/2]quit #退出端口 [Switch A]interface GigabitEthernet 0/0/3 #进入端口0/0/3 [Switch A-GigabitEthernet0/0/3]port link-type access #配置端口类型 [Switch A-GigabitEthernet0/0/3]port default vlan 10 #配置端口默认vlan [Switch A-GigabitEthernet0/0/3]quit #退出端口 [Switch A]interface GigabitEthernet 0/0/4 #进入端口0/0/4 [Switch A-GigabitEthernet0/0/4]port link-type access #配置端口类型 [Switch A-GigabitEthernet0/0/4]port default vlan 10 #配置端口默认vlan [Switch A-GigabitEthernet0/0/4]quit #退出端口

Switch B

The device is running! system-view #进入系统视图 Enter system view, return user view with Ctrl+Z. [Huawei]sysname Switch B #修改设备名称 [Switch B]undo info-center enable #关闭信息提示 Info: Information center is disabled. [Switch B]vlan 20 #创建vlan20 [Switch B-vlan20]quit #退出 [Switch B]interface Eth-Trunk 2 #进入Eth-Trunk 2端口 [Switch B-Eth-Trunk2]port link-type trunk #配置端口类型 [Switch B-Eth-Trunk2]port trunk allow-pass vlan 20 #配置允许通过的vlan [Switch B-Eth-Trunk2]mode lacp-static #配置Eth-Trunk模式为lacp [Switch B-Eth-Trunk2]quit #退出端口 [Switch B]interface GigabitEthernet 0/0/1 #进入端口0/0/1 [Switch B-GigabitEthernet0/0/1]eth-trunk 2 #添加端口到Eth-Trunk 2 Info: This operation may take a few seconds. Please wait for a moment...done. [Switch B-GigabitEthernet0/0/1]quit #退出端口 [Switch B]interface GigabitEthernet 0/0/2 #进入端口0/0/2 [Switch B-GigabitEthernet0/0/2]eth-trunk 2 #添加端口到Eth-Trunk 2 Info: This operation may take a few seconds. Please wait for a moment...done. [Switch B-GigabitEthernet0/0/2]quit #退出端口 [Switch B]interface GigabitEthernet 0/0/3 #进入端口0/0/3 [Switch B-GigabitEthernet0/0/3]port link-type access #配置端口类型 [Switch B-GigabitEthernet0/0/3]port default vlan 20 #配置端口默认vlan [Switch B-GigabitEthernet0/0/3]quit #退出端口 [Switch B]interface GigabitEthernet 0/0/4 #进入端口0/0/4 [Switch B-GigabitEthernet0/0/4]port link-type access #配置端口类型 [Switch B-GigabitEthernet0/0/4]port default vlan 20 #配置端口默认vlan [Switch B-GigabitEthernet0/0/4]quit #退出端口

检测配置

PC1现在可以获取到在核心交换机上分配的IP地址信息,并且访问PC4,同时还可以访问百度

华为交换机简单小型公司组网配置实验,实现vlanif通信

PC1

华为交换机简单小型公司组网配置实验,实现vlanif通信

百度及PC4

PC3现在可以获取到在核心交换机上分配的IP地址信息,并且访问PC2,同时还可以访问百度

华为交换机简单小型公司组网配置实验,实现vlanif通信

PC3

华为交换机简单小型公司组网配置实验,实现vlanif通信

百度及PC2

AR接入路由器可以访问到PC1和PC4

华为交换机简单小型公司组网配置实验,实现vlanif通信

核心交换机的DHCP分配信息

地址池huawei-10分配了2个地址出去

华为交换机简单小型公司组网配置实验,实现vlanif通信

地址池huawei-20也分配了2个地址出去

华为交换机简单小型公司组网配置实验,实现vlanif通信

对以前做个的配置进行一个整合

交换机跨设备VLAN通信配置,三层vlanif通信配置

交换机当内部网关,负责内部流量的转发,路由器负责外部流量

最后#谢谢##华为交换机##路由器##上网#