拓扑图如下:
条件:
六台pc机IP地址如下:
pc1: 192.168.10.2
pc2: 192.168.20.2
pc3: 192.168.30.2
pc4: 192.168.40.2
pc5: 192.168.50.2
pc6: 192.168.60.2
后加的三台pc机:
pc7: 192.168.2.2
pc8: 192.168.70.2
pc9: 192.168.80.2
================================================================================================
交换机
二层交换机5台
三层交换机1台
路由器AR1220两台路由
================================================================================================
多臂路由配置:
sw1配置命令如下:
<Huawei>system-view //进系统视图
[Huawei]sysname SW-1 //修改主机名为sw-1
[SW-1]vlan batch 10 20 //创建vlan 10 20
[SW-1]int e0/0/1 //进e0/0/1接口
[SW-1-Ethernet0/0/1]port link-type access //工作模式为access模式
[SW-1-Ethernet0/0/1]port default vlan 10 //将e0/0/1接口划分到vlan10
[SW-1-Ethernet0/0/1]int e0/0/2 //切换接口
[SW-1-Ethernet0/0/2]port link-type access //工作模式为access模式
[SW-1-Ethernet0/0/2]port default vlan 20 //将e0/0/2接口划分到vlan20
[SW-1-Ethernet0/0/2]int e0/0/3 //切换接口
[SW-1-Ethernet0/0/3]port link-type trunk //工作模式为trunk模式
[SW-1-Ethernet0/0/3]port trunk allow-pass vlan all //让所有vlan通过此接口
===============================================================================================
sw2配置命令如下:
<Huawei>system-view //进系统视图
[Huawei]sysname SW-2 //修改主机名SW-2
[SW-2]vlan batch 30 40 //创建vlan 30 40
[SW-2]int e0/0/1 //进e0/0/1接口
[SW-2-Ethernet0/0/1]port link-type access //设置工作模式为access模式
[SW-2-Ethernet0/0/1]port default vlan 30 //将e0/0/1接口划分到vlan30
[SW-2-Ethernet0/0/1]int e0/0/2 //切换接口
[SW-2-Ethernet0/0/2]port link-type access //设置工作模式为access模式
[SW-2-Ethernet0/0/2]port default vlan 40 //将e0/0/2接口划分到vlan40
[SW-2-Ethernet0/0/2]int e0/0/3 //切换接口
[SW-2-Ethernet0/0/3]port link-type trunk //设置工作模式为Trunk模式
[SW-2-Ethernet0/0/3]port trunk allow-pass vlan all //让所有vlan通过此接口
===============================================================================================
sw3配置命令如下:
<Huawei>system-view //进系统视图
[Huawei]sysname SW-3 //修改主机名为SW-3
[SW-3]vlan batch 50 60 //创建vlan 50 60
[SW-3]int e0/0/1 //进e0/0/1接口
[SW-3-Ethernet0/0/1]port link-type access //设置工作模式为access模式
[SW-3-Ethernet0/0/1]port default vlan 50 //将e0/0/1接口划分到vlan50
[SW-3-Ethernet0/0/1]int e0/0/2 //切换接口
[SW-3-Ethernet0/0/2]port link-type access //设置工作模式为access模式
[SW-3-Ethernet0/0/2]port default vlan 60 //将e0/0/2接口划分到vlan60
[SW-3-Ethernet0/0/2]int e0/0/3 //切换接口
[SW-3-Ethernet0/0/3]port link-type trunk //设置工作模式为trunk模式
[SW-3-Ethernet0/0/3]port trunk allow-pass vlan all //让所有vlan通过此接口
===============================================================================================
sw4配置命令如下:
<Huawei>system-view //进系统视图
[Huawei]sysname SW-4 //修改主机名为sw-4
[SW-4]vlan batch 10 20 30 40 50 60 //创建vlan 10 20 30 40 50 60
[SW-4]port-group 1 //创建vlan工作组为1
[SW-4-port-group-1]group-member g0/0/1 to g0/0/3 //将g0/0/1到g0/0/3接口设置到vlan1工作组里面
[SW-4-port-group-1]port link-type trunk //设置工作模式为Trunk模式
[SW-4-port-group-1]port trunk allow-pass vlan all //让所有vlan通过此接口
[SW-4-port-group-1]q //退到系统视图
[SW-4]int Vlanif 10 //进vlanif10
[SW-4-Vlanif10]ip address 192.168.10.1 24 //配置IP地址和子网掩码
[SW-4-Vlanif10]int vlanif 20 //切换接口
[SW-4-Vlanif20]ip address 192.168.20.1 24 //配置IP地址和子网掩码
[SW-4-Vlanif20]int vlanif 30 //切换接口
[SW-4-Vlanif30]ip address 192.168.30.1 24 //配置IP地址和子网掩码
[SW-4-Vlanif30]int vlanif 40 //切换接口
[SW-4-Vlanif40]ip address 192.168.40.1 24 //配置IP地址和子网掩码
[SW-4-Vlanif40]int vlanif 50 //切换接口
[SW-4-Vlanif50]ip address 192.168.50.1 24 //配置IP地址和子网掩码
[SW-4-Vlanif50]int vlanif 60 //切换接口
[SW-4-Vlanif60]ip address 192.168.60.1 24 //配置IP地址和子网掩码
================================================================================================
sw-5配置命令如下:
<Huawei>system-view //进系统视图
[Huawei]sysname SW-5 //修改主机名为sw-5
[SW-5]vlan 70 //创建vlan 70
[SW-5]int e0/0/1 //进e0/0/1接口
[SW-5-Ethernet0/0/1]port link-type access //设置工作模式为access模式
[SW-5-Ethernet0/0/1]port default vlan 70 //将e0/0/1接口配置vlan 70
[SW-5-Ethernet0/0/1]int e0/0/2 //切换接口
[SW-5-Ethernet0/0/2]port link-type trunk //工作模式为trunk模式
[SW-5-Ethernet0/0/2]port trunk allow-pass vlan all //让所有vlan通过此接口
[SW-5-Ethernet0/0/2]int e0/0/3 //切换接口
[SW-5-Ethernet0/0/3]port link-type trunk //工作模式为Trunk模式
[SW-5-Ethernet0/0/3]port trunk allow-pass vlan all //让所有vlan通过此接口
================================================================================================
sw-6配置命令如下:
<Huawei>system-view //进系统视图
[Huawei]sysname SW-6 //修改主机名为sw-6
[SW-6]vlan 80 //创建vlan 80
[SW-6]int e0/0/1 //进e0/0/1接口
[SW-6-Ethernet0/0/1]port link-type access //设置工作模式为access模式
[SW-6-Ethernet0/0/1]port default vlan 80 //将e0/0/1接口配置vlan 80
[SW-6-Ethernet0/0/1]int e0/0/2 //切换接口
[SW-6-Ethernet0/0/2]port link-type trunk //设置工作模式为Trunk模式
[SW-6-Ethernet0/0/2]port trunk allow-pass vlan all //让所有vlan通过此接口
================================================================================================
AR-2配置命令如下:
<Huawei>system-view //进系统视图
[Huawei]sysname AR-2 //修改主机名为AR-2
[AR-2]int g0/0/0.1 //进g0/0/0.1子接口
[AR-2-GigabitEthernet0/0/0.1]dot1q termination vid 70 //关联vlan 70
[AR-2-GigabitEthernet0/0/0.1]ip address 192.168.70.1 24 //配置IP地址和子网掩码
[AR-2-GigabitEthernet0/0/0.1]arp broadcast enable //开启arp广播
[AR-2-GigabitEthernet0/0/0.1]int g0/0/0.2 //切换子接口
[AR-2-GigabitEthernet0/0/0.2]dot1q termination vid 80 //关联vlan 80
[AR-2-GigabitEthernet0/0/0.2]arp broadcast enable //开启arp广播
[AR-2-GigabitEthernet0/0/0.2]int g0/0/0 //切换接口
[AR-2-GigabitEthernet0/0/0]ip address 192.168.3.2 24 //配置IP地址和子网掩码
==============================================================================================
单臂路由配置如下:
sw5配置命令如下:
<Huawei>system-view //进系统视图
[Huawei]sysname SW-5 //修改主机名为SW-5
[Huawei]vlan batch 70 80 //创建vlan 70 80
[SW-5]int e0/0/1 //进e0/0/1接口
[SW-5-Ethernet0/0/1]port link-type access //工作模式为access模式
[SW-5-Ethernet0/0/1]port default vlan 70 //将e0/0/1接口加入到vlan 70
[SW-5-Ethernet0/0/1]int e0/0/2 //切换接口
[SW-5-Ethernet0/0/2]port link-type trunk //工作模式为Trunk模式
[SW-5-Ethernet0/0/2]port trunk allow-pass vlan all //让所有vlan通过此接口
[SW-5-Ethernet0/0/2]int e0/0/3 //切换接口
[SW-5-Ethernet0/0/3]port link-type trunk //工作模式为Trunk模式
[SW-5-Ethernet0/0/3]port trunk allow-pass vlan all //让所有vlan通过此接口
==============================================================================================
sw6配置命令如下:
<Huawei>system-view //进系统视图
[Huawei]sysname SW-6 //修改主机名SW-6
[SW-6]vlan 80 //创建vlan 80
[SW-6]int e0/0/1 //进e0/0/1接口
[SW-6-Ethernet0/0/1]port link-type access //工作模式为access模式
[SW-6-Ethernet0/0/1]port default vlan 80 //将e0/0/1接口加入到vlan 80
[SW-6-Ethernet0/0/1]int e0/0/2 //切换接口
[SW-6-Ethernet0/0/2]port trunk allow-pass vlan all //让所有vlan通过此接口
==============================================================================================
AR-2配置命令如下:
<Huawei>system-view //进系统视图
[Huawei]sysname AR-2 //修改主机名AR-2
[AR-2]int g0/0/1.1 //进g0/0/1.1子接口
[AR-2-GigabitEthernet0/0/1.1]ip address 192.168.70.1 24 //配置IP地址和子网掩码
[AR-2-GigabitEthernet0/0/1.1]dot1q termination vid 70 //关联vlan 70
[AR-2-GigabitEthernet0/0/1.1]arp broadcast enable //开启arp广播
[AR-2-GigabitEthernet0/0/1.1]int g0/0/1.2 //切换子接口
[AR-2-GigabitEthernet0/0/1.2]ip address 192.168.80.1 24 //配置IP地址和子网掩码
[AR-2-GigabitEthernet0/0/1.2]arp broadcast enable //开启arp广播
=============================================================================================
ping 通的图如下:
pc8去ping pc9的IP地址
==============================================================================================
pc机上配置IP地址和子网掩码 在pc机上有命令行 在命令行里ping 对端的ip地址看看能不能ping通 如果能说明配置成功
如果不能ping通,则注意以下几点:
1.子接口是不是进错了
2.交换机和交换机是不是没有配置成Trunk模式
3.交换机和pc机是否设置了access模式
==============================================================================================
AR-1配置命令如下:
<Huawei>system-view //进系统视图
[Huawei]sysname AR-1 //修改主机名AR-1
[AR-1]int g0/0/0 //进g0/0/0接口
[AR-1-GigabitEthernet0/0/0]ip address 192.168.1.2 24 //配置IP地址和子网掩码
[AR-1-GigabitEthernet0/0/0]int g0/0/1 //切换接口
[AR-1-GigabitEthernet0/0/1]ip address 192.168.3.1 24 //配置IP地址和子网掩码
[AR-1-GigabitEthernet0/0/1]int g2/0/0 //切换接口
[AR-1-GigabitEthernet2/0/0]ip address 192.168.2.1 24 //配置IP地址和子网掩码
配置静态路由指定下一条ip地址如下:
[AR-1]ip route-static 192.168.10.0 24 192.168.1.1 //从10网段跳到1.1路由上
[AR-1]ip route-static 192.168.20.0 24 192.168.1.1 //从20网段跳到1.1路由上
[AR-1]ip route-static 192.168.30.0 24 192.168.1.1 //从30网段跳到1.1路由上
[AR-1]ip route-static 192.168.40.0 24 192.168.1.1 //从40网段跳到1.1路由上
[AR-1]ip route-static 192.168.50.0 24 192.168.1.1 //从50网段跳到1.1路由上
[AR-1]ip route-static 192.168.60.0 24 192.168.1.1 //从60网段跳到1.1路由上
==============================================================================================
sw4配置指定静态路由指定下一条IP地址命令如下:
[SW-4]ip route-static 192.168.2.0 24 192.168.1.2 //从2.0网段跳到1.2路由上
[SW-4]ip route-static 192.168.3.0 24 192.168.1.2 //从3.0网段跳到1.2路由上
[SW-4]ip route-static 192.168.70.0 24 192.168.1.2 //从70.0网段跳到1.2路由上
[SW-4]ip route-static 192.168.80.0 24 192.168.1.2 //从80.0网段跳到1.2路由上
=============================================================================================