A-A+

基于包大小的策略路由和动态路由器的实验

2015年11月23日 站长资讯 暂无评论

组网的拓扑图和采用的路由模拟软件如下:

本文的实验采用的交换机是H3C模拟器,从官网上下载的。

【组网需求】

R1,R2,R3,R4之间跑动态路由。

从R1的S0/6/3进来的数据包:

长度为1-63的走192.168.12.2

长度为64-10000的走192.168.13.2

其他长度的报文按路由表查找。

【配置信息】

  1. R1:  
  2.    
  3. interface Serial0/6/0  
  4.  link-protocol ppp  
  5.  ip address 192.168.12.1 255.255.255.0  
  6. #  
  7. interface Serial0/6/1  
  8.  link-protocol ppp  
  9.  ip address 192.168.13.1 255.255.255.0  
  10. #  
  11. interface Serial0/6/2  
  12.  link-protocol ppp  
  13. #  
  14. interface Serial0/6/3  
  15.  link-protocol ppp  
  16.  ip address 172.16.15.1 255.255.255.0  
  17.  ip policy-based-route lab1  
  18. #  
  19.    
  20. #  
  21. ospf 1  
  22.  area 0.0.0.0  
  23.   network 192.168.12.0 0.0.0.255  
  24.   network 192.168.13.0 0.0.0.255  
  25.   network 172.16.15.0 0.0.0.255  
  26. #  
  27. policy-based-route lab1 permit node 10  
  28.    if-match packet-length 1 63  
  29.    apply ip-address next-hop 192.168.12.2  
  30. policy-based-route lab1 permit node 20  
  31.    if-match packet-length 64 10000  
  32.    apply ip-address next-hop 192.168.13.2  
  33. #  
  34.    
  35.  R2:  
  36.    
  37. interface Serial0/6/0  
  38.  link-protocol ppp  
  39.  ip address 192.168.12.2 255.255.255.0  
  40. #  
  41. interface Serial0/6/1  
  42.  link-protocol ppp  
  43.  ip address 192.168.24.1 255.255.255.0  
  44.    
  45. #  
  46. ospf 1  
  47.  area 0.0.0.0  
  48.   network 192.168.24.0 0.0.0.255  
  49.   network 192.168.12.0 0.0.0.255  
  50.    
  51. R3:  
  52.    
  53. interface Serial0/6/0  
  54.  link-protocol ppp  
  55.  ip address 192.168.34.1 255.255.255.0  
  56. #  
  57. interface Serial0/6/1  
  58.  link-protocol ppp  
  59.  ip address 192.168.13.2 255.255.255.0  
  60. #  
  61. ospf 1  
  62.  area 0.0.0.0  
  63.   network 192.168.13.0 0.0.0.255  
  64.   network 192.168.34.0 0.0.0.255  
  65. #  
  66.    
  67. R4:  
  68. #  
  69. interface Serial0/6/0  
  70.  link-protocol ppp  
  71.  ip address 192.168.34.2 255.255.255.0   
  72. http://www.xiaoxiongboke.com  
  73. #  
  74. interface Serial0/6/1  
  75.  link-protocol ppp  
  76.  ip address 192.168.24.2 255.255.255.0  
  77.    
  78. #  
  79. interface NULL0  
  80. #  
  81. interface LoopBack0  
  82.  ip address 10.1.1.1 255.255.255.255  
  83. #  
  84. ospf 1  
  85.  area 0.0.0.0  
  86.   network 192.168.24.0 0.0.0.255  
  87.   network 192.168.34.0 0.0.0.255  
  88.   network 10.1.1.1 0.0.0.0  
  89. #  
  90. R5:  
  91. #  
  92. interface Serial0/6/3  
  93.  link-protocol ppp  
  94.  ip address 172.16.15.2 255.255.255.0  
  95.    
  96.   ip route-static 0.0.0.0 0.0.0.0 172.16.15.1  

【验证】

在R5上ping 10.1.1.1 在R1上开启debugging 信息

  1. <R5>ping 10.1.1.1  
  2.   PING 10.1.1.1: 56  data bytes, press CTRL_C to   
  3.    
  4. break  
  5.     Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=253   
  6.    
  7. time=4 ms  
  8.     Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=253   
  9.    
  10. time=4 ms  
  11.     Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=253   
  12.    
  13. time=10 ms  
  14.     Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=253   
  15.    
  16. time=10 ms  
  17.     Request time out  
  18.    
  19.   --- 10.1.1.1 ping statistics ---  
  20.     5 packet(s) transmitted  
  21.     4 packet(s) received  
  22.     20.00% packet loss  
  23.     round-trip min/avg/max = 4/7/10 ms  
  24.    
  25. <R1>  
  26. *Feb 28 19:51:51:578 2013 R1 PBR/7/POLICY-ROUTING:IP   
  27.    
  28. policy based routing success : POLICY_ROUTEMAP :   
  29.    
  30. lab1, Node : 20, next-hop : 192.168.13.2  
  31. *Feb 28 19:51:51:781 2013 R1 PBR/7/POLICY-ROUTING:IP   
  32.    
  33. policy based routing success : POLICY_ROUTEMAP :   
  34.    
  35. lab1, Node : 20, next-hop : 192.168.13.2  
  36. *Feb 28 19:51:51:984 2013 R1 PBR/7/POLICY-ROUTING:IP   
  37.    
  38. policy based routing success : POLICY_ROUTEMAP :   
  39.    
  40. lab1, Node : 20, next-hop : 192.168.13.2  
  41. *Feb 28 19:51:52:187 2013 R1 PBR/7/POLICY-ROUTING:IP   
  42.    
  43. policy based routing success : POLICY_ROUTEMAP :   
  44.    
  45. lab1, Node : 20, next-hop : 192.168.13.2  
  46. *Feb 28 19:51:52:406 2013 R1 PBR/7/POLICY-ROUTING:IP   
  47.    
  48. policy based routing success : POLICY_ROUTEMAP :   
  49.    
  50. lab1, Node : 20, next-hop : 192.168.13.2  
  51.    
  52. <R5>  

如上,如果按照R1的路由表,都应当走 192.168.12.2 ,但是因为有策略路由,下一跳指向了192.168.13.2 实验完成

  1. <R1>dis ip ro  
  2. Routing Tables: Public  
  3.         Destinations : 14       Routes : 15  
  4.    
  5. Destination/Mask    Proto  Pre  Cost         NextHop         Interface  
  6.    
  7. 10.1.1.1/32         OSPF   10   3124         192.168.12.2    S0/6/0  
  8.                     OSPF   10   3124         192.168.13.2    S0/6/1  
标签:

给我留言