A-A+

华三(H3C)路由器的静态路由的配置的命令

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

本文是针对华三路由设备的静态路由配置。针对其它品牌或者其它情况,大家可以自己举一反三的来完成。

拓扑如下(比较简单,就不画图了,直接用虚线连接起来):

Lo0:1.1.1.1/24---R1-------12.12.12.0/24------R2------L00:2.2.2.2/24

H3C路由设备的配置命令:

  1. <R1>system-view  
  2. [R1]int s0/2/0  
  3. [R1-Serial0/2/0]ip add 12.12.12.1 255.255.255.0  
  4. [R1-Serial0/2/0]undo shutdown  
  5. [R1]int lo0  
  6. [R1-LoopBack0]ip add 1.1.1.1 255.255.255.0  
  7. [R1]ip route-static 2.2.2.0 255.255.255.0 12.12.12.2  
  8.    
  9. <R2>system-view  
  10. [R2]int s0/2/0  
  11. [R2-Serial0/2/0]ip add 12.12.12.2 255.255.255.0  
  12. [R2-Serial0/2/0]undo shutdown  
  13. [R2-Serial0/2/0]quit  
  14. [R2]int lo0  
  15. [R2-LoopBack0]ip add 2.2.2.2 255.255.255.0  
  16.   
  17. [R2]ip route-static 1.1.1.0 255.255.255.0 12.12.12.1  

查看R1的路由表:

  1. [R1]display ip routing-table   
  2. Routing Tables: Public  
  3.         Destinations : 7        Routes : 7  
  4.    
  5. Destination/Mask    Proto  Pre  Cost         NextHop         Interface  
  6.    
  7. 1.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0  
  8. 2.2.2.0/24          Static 60   0            12.12.12.2      S0/2/0  
  9. 12.12.12.0/24       Direct 0    0            12.12.12.1      S0/2/0   
  10. 12.12.12.1/32       Direct 0    0            127.0.0.1       InLoop0  
  11. 12.12.12.2/32       Direct 0    0            12.12.12.2      S0/2/0  
  12. 127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0  
  13. 127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0  

查看R2的路由表:

  1. [R2]display ip routing-table   
  2. Routing Tables: Public  
  3.         Destinations : 7        Routes : 7  
  4.    
  5. Destination/Mask    Proto  Pre  Cost         NextHop         Interface  
  6.    
  7. 1.1.1.0/24          Static 60   0            12.12.12.1      S0/2/0  
  8. 2.2.2.2/32          Direct 0    0            127.0.0.1       InLoop0  
  9. 12.12.12.0/24       Direct 0    0            12.12.12.2      S0/2/0  
  10.   
  11.   
  12. 12.12.12.1/32       Direct 0    0            12.12.12.1      S0/2/0  
  13. 12.12.12.2/32       Direct 0    0            127.0.0.1       InLoop0  
  14. 127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0  
  15. 127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0  

测试连通性:

  1. [R2]ping 1.1.1.1  
  2.   PING 1.1.1.1: 56  data bytes, press CTRL_C to break  
  3.     Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=255 time=15 ms  
  4.     Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=255 time=4 ms  
  5.     Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=255 time=4 ms  
  6.     Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=255 time=5 ms  
  7.     Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=255 time=2 ms  
  8.    
  9.   --- 1.1.1.1 ping statistics ---  
  10.     5 packet(s) transmitted  
  11.     5 packet(s) received  
  12.     0.00% packet loss  
  13. round-trip min/avg/max = 2/6/15 ms  

把上的静态路由删除换为默认路由:

  1. [R1]ip route-static 0.0.0.0 0.0.0.0 12.12.12.2  
  2. [R2]ip route-static 0.0.0.0 0.0.0.0 12.12.12.1  
  3.    
  4. [R2]ping 1.1.1.1  
  5.   PING 1.1.1.1: 56  data bytes, press CTRL_C to break  
  6.     Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=255 time=25 ms  
  7.     Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=255 time=14 ms  
  8.     Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=255 time=25 ms  
  9.     Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=255 time=4 ms  
  10.     Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=255 time=15 ms  
  11.    
  12.   --- 1.1.1.1 ping statistics ---  
  13.     5 packet(s) transmitted  
  14.     5 packet(s) received  
  15.     0.00% packet loss  
  16.     round-trip min/avg/max = 4/16/25 ms  
标签:

给我留言