A-A+

h3c华三设备的静态路由配置实例

2016年02月16日 站长资讯 暂无评论

首先配置R1 R2 R3的基本配置,为相应的接口配置合理的IP 地址。同一根网线上连接的两个路由器,要配置相同的网络位,不同的主机位因为他们是位于同一个网络的不同设备。

R1配置:

  1. Router>enable   
  2. Router#config ter  
  3.    
  4. Router(config)#line console 0  
  5. Router(config-line)#exec-timeout  0 0  
  6. Router(config-line)#logging synchronous   
  7. Router(config-line)#exit   
  8.    
  9. Router(config)#no ip domain-lookup   
  10. Router(config)#ho R1  
  11.   
  12.    
  13. R1(config)#interface loopback 0  
  14. R1(config-if)#ip address 1.1.1.1 255.255.255.255  
  15. R1(config-if)#no shutdown   
  16. R1(config-if)#exit   
  17.    
  18. R1(config)#interface loopback 1  
  19. R1(config-if)#ip address 1.1.2.1 255.255.255.255  
  20. R1(config-if)#no shutdown   
  21. R1(config-if)#exit   
  22.    
  23. R1(config)#interface loopback 2  
  24. R1(config-if)#ip address 1.1.3.1 255.255.255.255  
  25. R1(config-if)#no shutdown   
  26. R1(config-if)#exit   
  27.    
  28. R1(config)#interface loopback 3  
  29. R1(config-if)#ip address 1.1.4.1 255.255.255.255  
  30. R1(config-if)#no shutdown   
  31. R1(config-if)#exit  
  32.    
  33. R1(config)#interface f0/0  
  34. R1(config-if)#ip address 12.1.1.1 255.255.255.0  
  35. R1(config-if)#no shutdown   
  36. R1(config-if)#exit  

R2配置:

  1. Router>enable   
  2. Router#config terminal   
  3. Router(config)#line console 0  
  4. Router(config-line)#exec-timeout 0 0  
  5. Router(config-line)#logging synchronous   
  6. Router(config-line)#exit   
  7.    
  8. Router(config)#no ip domain-lookup   
  9. Router(config)#ho R2  
  10.    
  11. R2(config)#interface f0/0  
  12. R2(config-if)#ip address 12.1.1.2 255.255.255.0  
  13. R2(config-if)#no shutdown   
  14. R2(config-if)#exit   
  15.    
  16. R2(config)#interface f0/1  
  17. R2(config-if)#ip address 23.1.1.2 255.255.255.0  
  18. R2(config-if)#no shutdown   
  19. R2(config-if)#exit   
  20.    
  21. R2(config)#interface loopback 0  
  22. R2(config-if)#ip address 2.2.2.2 255.255.255.255  
  23. R2(config-if)#no  shutdown   
  24. R2(config-if)#exit  

R3配置:

  1. Router>enable   
  2. Router#config terminal   
  3.    
  4. Router(config)#line console 0  
  5. Router(config-line)#exec-timeout 0 0  
  6. Router(config-line)#logging synchronous   
  7. Router(config-line)#exit   
  8. Router(config)#no ip domain-lookup   
  9.    
  10. Router(config)#ho R3  
  11.    
  12. R3(config)#interface f0/1  
  13. R3(config-if)#ip address 23.1.1.3 255.255.255.0  
  14. R3(config-if)#no shutdown   
  15. R3(config-if)#exit   
  16.    
  17. R3(config)#interface lo0  
  18. R3(config-if)#ip address 3.3.3.3 255.255.255.255  
  19. R3(config-if)#no shutdown   
  20. R3(config-if)#exit  

接下来在R1 R2 R3上配置静态路由,由于一个路由器的接口配置了IP 地址之后,对于路由器而言,就产生了到达改网络的路径,就是我们所说的直连路径。因此我们仅仅需要配置到达网络中其他地方(非直连)网络的路径即可。

R1配置:

对于R1而言直连路经就是路由表中打C 标记的路由,而2.2.2.2/32,3.3.3.3/32,23.1.1.0/24

这几条路径R1的路由表中没有(这些是非直连路径),因此需要针对这几条路径进行配置.

  1. R1#sho ip route   
  2. Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP  
  3.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  4.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  
  5.        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP  
  6.        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area  
  7.        * - candidate default, U - per-user static route, o - ODR  
  8.        P - periodic downloaded static route  
  9.    
  10. Gateway of last resort is not set  
  11.    
  12.      1.0.0.0/32 is subnetted, 4 subnets  
  13. C       1.1.1.1 is directly connected, Loopback0  
  14. C       1.1.2.1 is directly connected, Loopback1  
  15. C       1.1.3.1 is directly connected, Loopback2  
  16. C       1.1.4.1 is directly connected, Loopback3  
  17.      12.0.0.0/24 is subnetted, 1 subnets  
  18. C       12.1.1.0 is directly connected, FastEthernet0/0  
  19. R1#  
  20. spacer.gif                                                  要去哪里----目标IP地址和掩码  
  21. spacer.gifR1(config)#ip route 3.3.3.3 255.255.255.255 12.1.1.2                有谁帮我把数据转发到目的地---下一跳地址  
  22. R1(config)#ip route 23.1.1.0 255.255.255.0 12.1.1.2  
  23. spacer.gifR1(config)#ip route 2.2.2.2 255.255.255.255 f0/0                   要去那里,该从那个接口把数据发出去—出接口  

R2配置:

对于R2而言 只有 1.1.1.1-----1.1.2.1----1.1.3.1----1.1.4.1以及3.3.3.3 是不直接相连的(非直连),因此只需要针对这些网段写静态路由就可以了,对于1.1.1.1----1.1.4.1的这四条路径,可以用汇总的方式,以一条命令去完成对于四条命令的匹配.---进行汇总.同时注意,汇总的时候,有可能将1.1.5.1等等不存在的网段也汇总进去了,因此注意,在R1上(应为汇总的1.1.1.1—1.1.4.1 是R1上的路径)部署黑洞路由.

R2(config)#ip route 1.1.0.0 255.255.248.0 12.1.1.1

R2(config)#ip route 3.3.3.3 255.255.255.255 23.1.1.3

R1配置:

R1(config)#ip route 1.1.0.0 255.255.248.0 null 0

R3配置:

在R3上 我们可以认为R3上网络的终点,因此对于R3而言,到网络的任意一点,都可以被缺省路由匹配.

R3(config)#ip route 0.0.0.0 0.0.0.0 23.1.1.2

检查路由表,看看路径是否都齐全.

R1 R2 R3要有到达 1.1.1.1—1.1.2.1---1.1.3.1---1.1.4.1以及12.1.1.0/24;23.1.1.0/24;

2.2.2.2/32;3.3.3.3/32的路径.

R1配置:

  1. R1#sho ip route   
  2. Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP  
  3.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  4.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  
  5.        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP  
  6.        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area  
  7.        * - candidate default, U - per-user static route, o - ODR  
  8.        P - periodic downloaded static route  
  9.    
  10. Gateway of last resort is not set  
  11.    
  12.      1.0.0.0/8 is variably subnetted, 5 subnets, 2 masks  
  13. S       1.1.0.0/21 is directly connected, Null0  
  14. C       1.1.1.1/32 is directly connected, Loopback0  
  15. C       1.1.2.1/32 is directly connected, Loopback1  
  16. C       1.1.3.1/32 is directly connected, Loopback2  
  17. C       1.1.4.1/32 is directly connected, Loopback3  
  18.      2.0.0.0/32 is subnetted, 1 subnets  
  19. S       2.2.2.2 is directly connected, FastEthernet0/0  
  20.      3.0.0.0/32 is subnetted, 1 subnets  
  21. S       3.3.3.3 [1/0] via 12.1.1.2  
  22.      12.0.0.0/24 is subnetted, 1 subnets  
  23. C       12.1.1.0 is directly connected, FastEthernet0/0  
  24.      23.0.0.0/24 is subnetted, 1 subnets  
  25. S       23.1.1.0 [1/0] via 12.1.1.2  

R2配置:

  1. R2#sho ip route   
  2. Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP  
  3.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  4.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  
  5.        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP  
  6.        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area  
  7.        * - candidate default, U - per-user static route, o - ODR  
  8.        P - periodic downloaded static route  
  9.    
  10. Gateway of last resort is not set  
  11.    
  12.      1.0.0.0/21 is subnetted, 1 subnets  
  13. S       1.1.0.0 [1/0] via 12.1.1.1  
  14.      2.0.0.0/32 is subnetted, 1 subnets  
  15. C       2.2.2.2 is directly connected, Loopback0  
  16.      3.0.0.0/32 is subnetted, 1 subnets  
  17. S       3.3.3.3 [1/0] via 23.1.1.3  
  18.      12.0.0.0/24 is subnetted, 1 subnets  
  19. C       12.1.1.0 is directly connected, FastEthernet0/0  
  20.      23.0.0.0/24 is subnetted, 1 subnets  
  21. C       23.1.1.0 is directly connected, FastEthernet0/1  

R3配置:

  1. R3#sho ip rou  
  2. Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP  
  3.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  4.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  
  5.        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP  
  6.        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area  
  7.        * - candidate default, U - per-user static route, o - ODR  
  8.        P - periodic downloaded static route  
  9.    
  10. Gateway of last resort is 23.1.1.2 to network 0.0.0.0  
  11.    
  12.      3.0.0.0/32 is subnetted, 1 subnets  
  13. C       3.3.3.3 is directly connected, Loopback0  
  14.      23.0.0.0/24 is subnetted, 1 subnets  
  15. C       23.1.1.0 is directly connected, FastEthernet0/1  
  16. S*   0.0.0.0/0 [1/0] via 23.1.1.2  
标签:

给我留言