A-A+

华为模拟器三层交换机VALN兼路由的实验方法

2015年11月24日 站长资讯 华为模拟器三层交换机VALN兼路由的实验方法已关闭评论

实验需求:

1.创建VLAN并且能正确地划分Hybrid VLAN

2.Hybrid端口配置正确

3.Tag标签能正确标记,去除

4.利用三层交换机实现全网互通

5.设置DHCP,PC可以自动获取IP地址

以下是拓扑图及详细步骤:

一.创建VLAN并且划分hybrid VLAN正确

以下是详细步骤:

  1. LSW2  
  2. <Huawei>sys  
  3. Enter system view, return user view with Ctrl+Z.  
  4. [Huawei]  
  5. [Huawei]vlan 10  
  6. [Huawei-vlan10]vlan 20  
  7. [Huawei-vlan20]  
  8. Oct 21 2013 16:07:38-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  9. 25.191.3.1 configurations have been changed. The current change number is 5, the  
  10. change loop count is 0, and the maximum number of records is 4095.  
  11. [Huawei-vlan20]int e0/0/1  
  12. [Huawei-Ethernet0/0/1]port hybrid pvid vlan 10  
  13. Oct 21 2013 16:08:08-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  14. 25.191.3.1 configurations have been changed. The current change number is 6, the  
  15. change loop count is 0, and the maximum number of records is 4095.  
  16. [Huawei-Ethernet0/0/1]port hybrid untagged vlan 10 20  
  17. [Huawei-Ethernet0/0/1]int e0/0/2  
  18. Oct 21 2013 16:08:28-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  19.   
  20.   
  21. 25.191.3.1 configurations have been changed. The current change number is 7, the  
  22. change loop count is 0, and the maximum number of records is 4095. h  
  23. [Huawei-Ethernet0/0/2]port hybrid pvid vlan 20  
  24. [Huawei-Ethernet0/0/2]port hybrid untagged vlan 10 20  
  25. [Huawei-Ethernet0/0/2]  
  26. Oct 21 2013 16:08:48-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  27. 25.191.3.1 configurations have been changed. The current change number is 9, the  
  28. change loop count is 0, and the maximum number of records is 4095.  
  29. LSW2:  
  30. <Huawei>sys  
  31. Enter system view, return user view with Ctrl+Z.  
  32. [Huawei]vlan 30  
  33. [Huawei-vlan30]int e  
  34. Oct 21 2013 16:18:58-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  35. 25.191.3.1 configurations have been changed. The current change number is 4, the  
  36. change loop count is 0, and the maximum number of records is 4095.  
  37. [Huawei-vlan30]int e0/0/1  
  38. [Huawei-Ethernet0/0/1]port hybrid pvid vlan 30   
  39. [Huawei-Ethernet0/0/1]port hybrid untagged vlan 30  
  40. [Huawei-Ethernet0/0/1]  
  41. Oct 21 2013 16:19:28-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  42. 25.191.3.1 configurations have been changed. The current change number is 6, the  
  43. change loop count is 0, and the maximum number of records is 4095.  

二.创建Hybrid的端口

以下是详细步骤:

  1. LSW2:  
  2. [Huawei]interface GigabitEthernet 0/0/1  
  3. [Huawei-GigabitEthernet0/0/1]  
  4. [Huawei-GigabitEthernet0/0/1]port hybrid tagged vlan 10 20  
  5. [Huawei-GigabitEthernet0/0/1]  
  6. Oct 21 2013 16:26:48-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  7. 25.191.3.1 configurations have been changed. The current change number is 10, the  
  8. change loop count is 0, and the maximum number of records is 4095.  
  9. LSW3: http://www.xiaoxiongboke.com   
  10. [Huawei]interface GigabitEthernet 0/0/1  
  11. [Huawei-GigabitEthernet0/0/1]port hybrid tagged vlan 30   
  12. [Huawei-GigabitEthernet0/0/1]  
  13. Oct 21 2013 16:28:48-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  14. 25.191.3.1 configurations have been changed. The current change number is 7, the  
  15. change loop count is 0, and the maximum number of records is 4095.  

用display vlan查看配置是否正确

如图所示:

三.在确保无误之后进行三层交换机创建VLAN,配置网关的工作

以下是详细步骤:

  1. <Huawei>sys  
  2. Enter system view, return user view with Ctrl+Z.  
  3. [Huawei]vlan 10  
  4. Oct 21 2013 16:34:38-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  5. 25.191.3.1 configurations have been changed. The current change number is 4, the  
  6. change loop count is 0, and the maximum number of records is 4095.  
  7. [Huawei-vlan10]vlan 20  
  8. [Huawei-vlan20]vlan 30  
  9. [Huawei-vlan30]  
  10. Oct 21 2013 16:34:48-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  11. 25.191.3.1 configurations have been changed. The current change number is 6, the  
  12. change loop count is 0, and the maximum number of records is 4095.  
  13. [Huawei-vlan30]int vlan 10  
  14. [Huawei-Vlanif10]ip add 192.168.10.1 24  
  15. [Huawei-Vlanif10]int vlan 20  
  16. Oct 21 2013 16:35:08-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  17. 25.191.3.1 configurations have been changed. The current change number is 7, the   
  18. change loop count is 0, and the maximum number of records is 4095.  
  19. [Huawei-Vlanif20]ip add 192.168.20.1 24  
  20. Oct 21 2013 16:35:28-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  21. 25.191.3.1 configurations have been changed. The current change number is 8, the  
  22. change loop count is 0, and the maximum number of records is 4095.  
  23. [Huawei-vlan30]int vlan 30  
  24. [Huawei-Vlanif30]ip add 192.168.30.1 24  
  25. [Huawei-Vlanif30]  
  26. Oct 21 2013 16:35:48-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  27. 25.191.3.1 configurations have been changed. The current change number is 9, the  
  28. change loop count is 0, and the maximum number of records is 4095.  

四.进入VLAN创建DHCP,在此之前先开启DHCP功能

以下是详细步骤:

  1. [Huawei]dhcp enable  
  2. Info: The operation may take a few seconds. Please wait for a moment.done.  
  3. [Huawei]interface vlan 10  
  4. [Huawei-Vlanif10]  
  5. Oct 21 2013 16:42:29-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.   
  6. 25.191.3.1 configurations have been changed. The current change number is 10, the  
  7. change loop count is 0, and the maximum number of records is 4095.  
  8. [Huawei-Vlanif10]dhcp select interface  
  9. [Huawei-Vlanif10]  
  10. Oct 21 2013 16:42:49-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  11. 25.191.3.1 configurations have been changed. The current change number is 11, the  
  12. change loop count is 0, and the maximum number of records is 4095.  
  13. [Huawei-Vlanif10]int vlan 20  
  14. [Huawei-Vlanif20]dhcp select interface  
  15. [Huawei-Vlanif20]int vlan 30  
  16. Oct 21 2013 16:43:09-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  17. 25.191.3.1 configurations have been changed. The current change number is 12, the  
  18. change loop count is 0, and the maximum number of records is 4095.  
  19. [Huawei-Vlanif30]dhcp select interface  
  20. [Huawei-Vlanif30]  
  21. Oct 21 2013 16:43:19-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  22. 25.191.3.1 configurations have been changed. The current change number is 13, the   

还要将三层交换机下的两个二层接口改为Hybrid端口,并标记TAG标签

  1. [Huawei]interface GigabitEthernet 0/0/1  
  2. [Huawei-GigabitEthernet0/0/1]port hybrid tagged vlan 10 20  
  3. [Huawei-GigabitEthernet0/0/1]  
  4. Oct 21 2013 16:46:46-08:00 Huawei %%01IFNET/4/IF_STATE(l)[0]:Interface Vlanif10 h  
  5. as turned into UP state.  
  6. Oct 21 2013 16:46:46-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol  
  7. IP on the interface Vlanif10 has entered the UP state.  
  8. Oct 21 2013 16:46:46-08:00 Huawei %%01IFNET/4/IF_STATE(l)[2]:Interface Vlanif20 h  
  9. as turned into UP state.  
  10. Oct 21 2013 16:46:46-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[3]:The line protocol  
  11. IP on the interface Vlanif20 has entered the UP state.  
  12. Oct 21 2013 16:46:49-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  13. 25.191.3.1 configurations have been changed. The current change number is 14, the  
  14. change loop count is 0, and the maximum number of records is 4095.nt  
  15. [Huawei-GigabitEthernet0/0/1]int g0/0/2  
  16.   
  17.   
  18. [Huawei-GigabitEthernet0/0/2]port hybrid tagged vlan 30  
  19. [Huawei-GigabitEthernet0/0/2]  
  20. Oct 21 2013 16:47:14-08:00 Huawei %%01IFNET/4/IF_STATE(l)[4]:Interface Vlanif30 h  
  21. as turned into UP state.  
  22. Oct 21 2013 16:47:14-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[5]:The line protocol  
  23. IP on the interface Vlanif30 has entered the UP state.  
  24. Oct 21 2013 16:47:19-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  25. 25.191.3.1 configurations have been changed. The current change number is 15, the  
  26. change loop count is 0, and the maximum number of records is 4095.  

验证一下如果PC能自动获得IP地址且三台PC能够互通则前期工作完成

如图所示:

  1. Ping 192.168.20.254: 32 data bytes, Press Ctrl_C to break  
  2. From 192.168.20.254: bytes=32 seq=1 ttl=127 time=94 ms  
  3. From 192.168.20.254: bytes=32 seq=2 ttl=127 time=47 ms  
  4. From 192.168.20.254: bytes=32 seq=3 ttl=127 time=78 ms  
  5. From 192.168.20.254: bytes=32 seq=4 ttl=127 time=62 ms  
  6. From 192.168.20.254: bytes=32 seq=5 ttl=127 time=63 ms  
  7. --- 192.168.20.254 ping statistics ---  
  8. 5 packet(s) transmitted  
  9. 5 packet(s) received  
  10. 0.00% packet loss  
  11. round-trip min/avg/max = 47/68/94 ms  
  12. PC>ping 192.168.30.254  
  13. Ping 192.168.30.254: 32 data bytes, Press Ctrl_C to break  
  14. From 192.168.30.254: bytes=32 seq=1 ttl=127 time=78 ms  
  15. From 192.168.30.254: bytes=32 seq=2 ttl=127 time=47 ms  
  16. From 192.168.30.254: bytes=32 seq=3 ttl=127 time=78 ms  
  17. From 192.168.30.254: bytes=32 seq=4 ttl=127 time=78 ms  
  18. From 192.168.30.254: bytes=32 seq=5 ttl=127 time=94 ms  
  19. --- 192.168.30.254 ping statistics ---  
  20. 5 packet(s) transmitted  
  21.   
  22.   
  23. 5 packet(s) received  
  24. 0.00% packet loss  
  25. round-trip min/avg/max = 47/75/94 ms  

五,在三层交换机上创建一个新的VLAN,用于访问路由器的端口

详细步骤如下:

  1. [Huawei]  
  2. [Huawei]vlan 6  
  3. [Huawei-vlan6]  
  4. Oct 21 2013 16:58:39-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  5. 25.191.3.1 configurations have been changed. The current change number is 16, the  
  6. change loop count is 0, and the maximum number of records is 4095.  
  7. [Huawei-vlan6]int vlan 6  
  8. [Huawei-Vlanif6]ip add 1.1.1.1 24  
  9. [Huawei-Vlanif6]  
  10. Oct 21 2013 17:01:19-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  11. 25.191.3.1 configurations have been changed. The current change number is 17, the  
  12. change loop count is 0, and the maximum number of records is 4095.  
  13. [Huawei-Vlanif6]int g0/0/3  
  14. [Huawei-GigabitEthernet0/0/3]port hybrid untagged vlan all(这里要将TAG标签脱去,不然,路由器接收到的报文将无法识别)  
  15. [Huawei-GigabitEthernet0/0/3]   
  16. Oct 21 2013 17:02:58-08:00 Huawei %%01IFNET/4/IF_STATE(l)[6]:Interface Vlanif6 ha  
  17. s turned into UP state.  
  18. Oct 21 2013 17:02:58-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[7]:The line protocol  
  19. IP on the interface Vlanif6 has entered the UP state.  
  20. Oct 21 2013 17:02:59-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.  
  21. 25.191.3.1 configurations have been changed. The current change number is 18, the  
  22. change loop count is 0, and the maximum number of records is 4095.  

六.在AR1路由器中将内网端口配置网关及子网掩码

详细步骤如下:

  1. <Huawei>sys  
  2. Enter system view, return user view with Ctrl+Z.  
  3. [Huawei]  
  4. [Huawei]interface GigabitEthernet 0/0/0  
  5. [Huawei-GigabitEthernet0/0/0]ip add 1.1.1.2 24  
  6. O  
  7. [Huawei-cGigat 21 2013 14:23:20-05:13 HuaweibitEthernet0/ %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.  
  8. [Huawei-GigabitEthernet0/0/0]0/0]  

接下来陆续将后面两台路由器的接口配置完毕,并实现三台路由器互通

以下是详细步骤:

  1. AR1:  
  2. [Huawei]interface GigabitEthernet 0/0/1  
  3. [Huawei-GigabitEthernet0/0/1]ip add 202.106.1.1 24  
  4. Oct 21 2013 14:29:35-05:  
  5. [Huawei-GigabitEther13 Huawei %%01neIFNET/4/t0/0/1LINK_STATE(]l)[0]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state.  
  6. [Huawei-GigabitEthernet0/0/1]  
  7. AR2:  
  8. <Huawei>sys  
  9. Enter system view, return user view with Ctrl+Z.  
  10. [Huawei]interface GigabitEthernet 0/0/0  
  11. [Huawei-GigabitEthernet0/0/0]ip add 202.106.1.2 24  
  12. Oct 21 2013 1  
  13. [Huawei-Gi4:31:30-05:13 Huawei %%01IFNgabitEthernet0/0/0]ET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.  
  14. [Huawei-GigabitEthernet0/0/0]int g0/0/1  
  15. [Huawei-GigabitEthernet0/0/1]ip add 202.106.2.1 24  
  16. Oct 21 2013  
  17. [Huawei-Gigabi 1tEtherne4:31:51-05:13 Huawei %%01IFNt0/0/1]ET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state.   
  18. [Huawei-GigabitEthernet0/0/1]  
  19. AR3:  
  20. <Huawei>sys  
  21. Enter system view, return user view with Ctrl+Z.  
  22. [Huawei]interface GigabitEthernet 0/0/0  
  23. [Huawei-GigabitEthernet0/0/0]ip add 202.106.2.2 24  
  24. Oct 21 2013 14:34:47-05:13 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered t  
  25. [Huawei-Gigahe UP state. b  
  26. [Huawei-GigabitEthernet0/0/0]itEthernet0/0/0]  

以上是配置IP地址,接下来是做静态路由

AR1

[Huawei]ip route-static 202.106.2.0 24 202.106.1.2

AR3

[Huawei]ip route-static 202.106.1.0 24 202.106.2.1

来验证一下三台路由器是否互通了

如图所示:

七.在三层交换机上做默认路由并在AR1上做到达内网的静态路由

以下是详细步骤:

  1. LSW:  
  2. [Huawei]ip route-static 0.0.0.0 0.0.0.0 1.1.1.2  
  3. AR1:  
  4. [Huawei]ip route-static 192.168.10.0 24 1.1.1.1  
  5. [Huawei]ip route-static 192.168.20.0 24 1.1.1.1  
  6. [Huawei]ip route-static 192.168.30.0 24 1.1.1.1  

做到这一步要来个小检查,查看自己的PC能否Ping通三层交换机中所创建的VLAN的网关和AR1内网口的网关

如图所示:

八.最后一步,在AR1上做PAT即可实现全网互通

以下是详细步骤:

  1. <Huawei>sys  
  2. Enter system view, return user view with Ctrl+Z.  
  3. [Huawei]  
  4. [Huawei]acl 2000  
  5. [Huawei-acl-basic-2000]rule 5 permit source any  
  6. [Huawei-acl-basic-2000]qu  
  7. [Huawei]interface GigabitEthernet 0/0/1  
  8. [Huawei-GigabitEthernet0/0/1]nat outbound 2000  
  9. [Huawei-GigabitEthernet0/0/1]  

最后验证:

如图:

就此完成!

标签:

评论已关闭!