本文描述如何配置IPv6的静态路由。静态路由是定义了两个设备之间的明确路径的手工配置的路由。一旦在网络的拓扑更改,静态路由没有自动地更新象那样动态协议,并且必须手工重新配置。静态路由为只有一个路径对外部网络的更加小的网络是有用的。
使用的主要缺点静态路由是缺乏自动配置在拓扑更改的情况下。静态路由也实现为提供安全数据流特定类型给需要更多控制的其他网络。在使用考虑静态路由的限制是缺乏冗余和在路由手工的重新配置能变为一笔大管理开销的大型网络。
请使用
尝试进行此配置之前,请确保满足以下要求:
IPv4静态路由知识
IPv6编址方案知识
本文档中的信息根据在Cisco IOS软件版本12.4(15)T 13的Cisco 3700系列路由器。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您使用的是真实网络,请确保您已经了解所有命令的潜在影响。
有关文档规则的详细信息,请参阅 Cisco 技术提示规则。
本部分提供有关如何配置本文档所述功能的信息。
注意:有关本文档所用命令的详细信息,请使用命令查找工具(仅限注册用户)。
本文档使用以下网络设置:
本文档使用以下配置:
这是链路到视频,在Cisco支持社区的联机
,展示如何配置IPv6网络的静态路由在Cisco IOS路由器:
路由器 R1
version 12.4
!
hostname R1
!
ip cef
!
ipv6 unicast-routing
!--- Enables the forwarding of IPv6 packets.
!
interface Loopback1
no ip address
ipv6 address 1010::1/128
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
ipv6 address 2000::1/126
!
ip forward-protocol nd
!
ipv6 route 2001::/126 2000::2
ipv6 route 2020::1/128 2000::2
ipv6 route 3030::1/128 2000::2
!--- Static routes are configured in router R1, !--- to reach the networks in router R2 and R3. !--- This is done when you specify !--- the next-hop address, which in this case is !--- 2000::2 from which the output interface !--- is automatically derived.
!
end
路由器 R2
version 12.4
!
hostname R2
!
ip cef
!
ipv6 unicast-routing
!
interface Loopback2
no ip address
ipv6 address 2020::1/128
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
ipv6 address 2000::2/126
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
ipv6 address 2001::1/126
!
ip forward-protocol nd
!
ipv6 route 1010::1/128 2000::1
ipv6 route 3030::1/128 2001::2
!--- Static routes are configured to reach !--- routers R1 and R3 loopback address when you !--- specify the corresponding interface address.
!
end
路由器 R3
version 12.4
!
hostname R3
!
ip cef
!
ipv6 unicast-routing
!
interface Loopback3
no ip address
ipv6 address 3030::1/128
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
ipv6 address 2001::2/126
!
ip forward-protocol nd
!
ipv6 route 1010::1/128 2001::1
ipv6 route 2000::/126 2001::1
ipv6 route 2020::1/128 2001::1
!--- For router 3, to reach R1 and R2, !--- static routes are configured when you !--- mention 2001::1 as the next-hop address.
!
end
使用本部分可确认配置能否正常运行。
命令输出解释程序(仅限注册用户)(OIT) 支持某些 show 命令。使用 OIT 可查看对 show 命令输出的分析。
请使用
show ipv6 route静态
在路由器 R1 中R1#show ipv6 route static
IPv6 Routing Table - 7 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route, M - MIPv6
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
D - EIGRP, EX - EIGRP external
S 2001::/126 [1/0]
via 2000::2
S 2020::1/128 [1/0]
via 2000::2
S 3030::1/128 [1/0]
via 2000::2
!--- Displays the static routes learnt by router R1 through 2000::2. 在路由器 R3 中R3#show ipv6 route static
IPv6 Routing Table - 7 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route, M - MIPv6
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
D - EIGRP, EX - EIGRP external
S 1010::1/128 [1/0]
via 2001::1
S 2000::/126 [1/0]
via 2001::1
S 2020::1/128 [1/0]
via 2001::1
!--- Displays the static routes learnt by router R3 through 2001::1.
路由器R1有路由到路由器R2和R3,因此,路由器R1应该能ping路由器R2's环回地址和路由器R3。请使用ping命令为了验证同样。
在路由器 R1 中
ping路由器R2's环回地址R1#ping 2020::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2020::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/36/104 ms
!--- Router R1 is successfully able to ping !--- router R2's loopback address. ping路由器R3 R1#ping 2001::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/40/116 ms
R1#ping 3030::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3030::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/32/84 ms
!--- Similarly R1 is also able to reach R3, !--- for example, ping to R3's interface address !--- and loopback address from router R1 is successful.
注意:同样路由器R3能也到达路由器R1的Fa0/0地址2000::1和其环回地址1010::1。
请使用详细信息语法为了显示有用的信息,在本例中讨论:
show ipv6 static
在路由器 R1 中R1#show ipv6 static
IPv6 Static routes
Code: * - installed in RIB
* 2001::/126 via nexthop 2000::2, distance 1
* 2020::1/128 via nexthop 2000::2, distance 1
* 3030::1/128 via nexthop 2000::2, distance 1
!--- Displays the routes that are installed in !--- the IPv6 Routing Information Base(RIB) marked with *!
当详细信息关键字指定时,其他信息显示。以下为输出示例:
show ipv6 static detail
在路由器 R2 中R2#show ipv6 static detail
IPv6 Static routes
Code: * - installed in RIB
* 1010::1/128 via nexthop 2000::1, distance 1
Resolves to 1 paths (max depth 1)
!--- Displays the output path set, and maximum !--- resolution depth, which in this case is 1.
via FastEthernet0/0
* 3030::1/128 via nexthop 2001::2, distance 1
Resolves to 1 paths (max depth 1)
via FastEthernet0/1
!--- Displays that the route is received through !--- the next-hop 2000::1 through interface fa0/0.
注意:在无效的路由的情况下,此信息显示:
无效递归路由,原因为什么路由无效。
对于无效请处理或充分地指定的路由,原因为什么路由无效。