了解和配置 ip unnumbered 命令 内容 前言前提条件需求使用的组件惯例什么是无编号接口? P 和未编号 P 配置示例同一主网, 不同子网不同的主网, 没有子网带有子网的主网, 没有子网的主网两个不同的主网和它们各自的子网相关信息 前言 本文档介绍无编号 P 的概念, 并提供几个配置示例以供参考 通过 ip unnumbered 配置命令, 您可以在串行接口上启用 P 处理, 而无需为该接口分配明确的 P 地址 无编号的 P 接口可以 借用 路由器上已经配置的另一个接口的 P 地址, 以节约网络和地址空间 前提条件 需求 本文档没有任何特定的要求 使用的组件 本文档不限于特定的软件和硬件版本 惯例 有关文档规则的详细信息, 请参阅 isco 技术提示规则 什么是无编号接口? 请考虑下面列出的网络 路由器 A 有一个串行接口 S0 和一个以太网接口 E0 路由器 A 的 Ethernet 0 接口可以配置为下面显示的 P 地址 : ip address 172.16.10.254 255.255.255.0 从逻辑上来说, 要在接口 S0 上启用 P, 您需要在此接口上配置一个唯一的 P 地址 但是, 也可以在串行接口上启用 P 并启动它, 而不为其分配唯一 P 地址 这是通过借用路由器的其他某个接口上已配置的 P 地址来实现的 为此, 需要按照如下所示使
用 ip unnumbered 接口模式命令 ip unnumbered Ethernet 0 ip unnumbered < 类型 > < 编号 > 接口模式命令会从指定的接口将 P 地址借用到已配置此命令的接口上 使用 ip unnumbered 命令会导致两个接口共享 P 地址 因此, 在我们的示例中, 在以太网接口上配置的 P 地址也分配给了串行接口, 涉及到的两个接口均能正常运行 如下所示, 可以使用 show ip interface brief 命令的输出进行验证 : RouterA# show ip interface brief nterface P-Address OK? Method Status Protocol Ethernet0 172.16.10.254 YES manual up up Serial0 172.16.10.254 YES manual up up 正如您在上面的 show ip interface brief 命令输出中所看到的, 串行接口有一个与以太网接口相同的 P 地址, 并且两个接口的功能都完全正常 从路由器的其他某个功能正常的接口借用地址的接口被称为 无编号接口 在我们的示例中,Serial 0 就是无编号接口 无编号接口的唯一缺点就是无法进行远程测试和管理 您应该记得, 无编号接口应当从正常运行的接口借用地址 如果无编号接口指向的接口无法正常工作 ( 即, 未显示 nterface status UP Protocol UP ), 则无编号接口也无法正常工作 这也是为什么我们建议将无编号接口指向环回接口, 因为环回接口不会发生故障 最后, 请记住,ip unnumbered 命令仅在点对点接口上起作用 当您在多路访问接口 ( 即以太网 ) 或环回接口上配置该命令时, 会显示以下信息 : RouterA(config)# int e0 RouterA(config-if)# ip unnumbered serial 0 Point-to-point (non-multi-access) interfaces only RouterA(config-if)# ip unnumbered loopback 0 Point-to-point (non-multi-access) interfaces only P 和未编号 P 在 isco 路由器上, 连接到一个网段的每个接口都必须属于一个唯一子网 直连的路由器具有连接到同一网段的接口, 并从同一子网分配 P 地址 如果路由器需要向非直连的网络发送数据, 会在其路由表内查找, 然后将数据包转发给通向目的地的直连下一跳 如果路由表中没有路由, 路由器会将数据包转发给它的最后选用网关 当直接连接到最终目标的路由器收到数据包时, 会将数据包直接发送给终端主机 P 路由表中包含子网路由或主要的网络路由 每个路由都有一个或多个直连的下一跳地址 默认情况下, 子网路由在主网络边界处聚合或汇总, 以便减小路由表的大小 注意 : 上面所讨论的聚合机制假设使用了传统的距离矢量路由协议, 如 Routing nformation Protocol (RP) 或 nterior Gateway Routing Protocol (GRP) 让我们考虑将 P 地址分配给使用 B 类网络的路由器上的接口, 该网络已经使用八位子网划分进行了子网划分 每个接口都要求一个唯一子网 尽管每个点对点串行连接只有两个端点需要编址, 但如果我们为每个串行接口分配一整个子网, 就会为每个只需要两个地址的接口使用 254 个可用的地址 如果我们为每个串行接口使用无编号 P, 就可以节省地址空间 ; LAN 接口的地址被 借用, 并作为路由来自串行接口的更新和数据包的源地址 这样就节省了地址空间 无编号 P 只对点对点链路有意义 接收路由更新的路由器将更新的源地址安装为其路由表中的下一跳 通常, 下一跳是直连网络节点 但如果我们使用无编号 P, 就不是这样了 因为每个串行接口都从其他 LAN 接口 其他子网接口, 或其他主要网络中的接口 借用 P 地址 如果配置了无编号 P, 通过无编号 P 接口获知的路由会将该接口, 而不是路由更新的源地址作为下一跳 因此, 由于路由更新的源来自非直连的下一跳, 我们避免了无效的下一跳地址问题 配置示例 注意 : 在这些配置示例的信息根据 isco OS 软件版本 12.2(10b) 在 isco 2500 系列路由器和测试了 让我们看看有关无编号 P 的四个不同的配置示例 注意 : 我们使用了环回接口而不是以太网接口 同一主网, 不同子网 图 1 显示, 在串行链路的任一端, 我们具备相同的主网, 但子网不同 图 1 网络图
路由器 1.1.1.1 路由器 2.2.2.2 ip address 171.68.178.196 255.255.255.192 ip address 171.68.179.1 255.255.255.192 Router 1.1.1.1# show ip route 171.68.0.0/26 is subnetted, 3 subnets 171.68.179.0 [100/8976] via 171.68.179.1, 00:00:02, Serial0 171.68.178.192 is directly connected, Ethernet0 171.68.0.0 [100/8976] via 171.68.179.1, 00:00:02, Serial0 Router 1.1.1.1# ping 171.68.179.1 Sending 5, 100-byte MP Echos to 171.68.179.1, timeout is 2 seconds: Success rate is 100 percent (5/5), round-trip min/avg/max = 28/30/32 ms 171.68.0.0/26 is subnetted, 3 subnets 171.68.179.0 is directly connected, Ethernet0 171.68.178.192 [100/8976] via 171.68.178.196, 00:00:02, Serial0 171.68.0.0 [100/8976] via 171.68.178.196, 00:00:02, Serial0 Sending 5, 100-byte MP Echos to 171.68.178.196, timeout is 2 seconds: Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/32 ms 在此场景中, 有关子网的路由信息被正确维护 不同的主网, 没有子网 图 2 显示, 在串行链路的任一端, 我们具备不同的主网, 没有子网 图 2 网络图 路由器 1.1.1.1 路由器 2.2.2.2 ip address 171.68.178.196 255.255.0.0 ip address 172.68.1.1 255.255.0.0 network 172.68.0.0
Router 1.1.1.1# show ip route 171.68.0.0/16 is directly connected, Ethernet0 172.68.0.0/16 [100/8976] via 172.68.1.1, 00:01:26, Serial0 Router 1.1.1.1# ping 172.68.1.1 Sending 5, 100-byte MP Echos to 172.68.1.1, timeout is 2 seconds: Success rate is 100 percent (5/5), round-trip min/avg/max = 28/28/28 ms 171.68.0.0/16 [100/8976] via 171.68.178.196, 00:00:21, Serial0 172.68.0.0/16 is directly connected, Ethernet0 Sending 5, 100-byte MP Echos to 171.68.178.196, timeout is 2 seconds: Success rate is 100 percent (5/5), round-trip min/avg/max = 28/29/32 ms 带有子网的主网, 没有子网的主网 图 3 显示, 在串行链路的一端, 我们具备带有子网的主网 ; 在另一端, 我们具备没有子网的主网 图 3 网络图 路由器 1.1.1.1 路由器 2.2.2.2 ip address 171.68.178.196 255.255.255.192 ip address 172.68.1.1 255.255.0.0 network 172.68.0.0 Router 1.1.1.1# show ip route 171.68.0.0/26 is subnetted, 1 subnets 171.68.178.192 is directly connected, Ethernet0 172.68.0.0/16 [100/8976] via 172.68.1.1, 00:00:03, Serial0 Router 1.1.1.1# ping 172.68.1.1 Sending 5, 100-byte MP Echos to 172.68.1.1, timeout is 2 seconds: Success rate is 100 percent (5/5), round-trip min/avg/max = 28/31/32 ms 171.68.0.0/16 is variably subnetted, 2 subnets, 2 masks 171.68.178.192/32 [100/8976] via 171.68.178.196, 00:00:48, Serial0 171.68.0.0/16 [100/8976] via 171.68.178.196, 00:00:48, Serial0 172.68.0.0/16 is directly connected, Ethernet0 Sending 5, 100-byte MP Echos to 171.68.178.196, timeout is 2 seconds: Success rate is 100 percent (5/5), round-trip min/avg/max = 28/29/32 ms 注意 : 在 isco OS 软件版本 11.0(2) 之前的版本中, 您需要为路由器 2.2.2.2 中的主网 171.68.0.0/16 放置一个静态路由
在此场景中, 子网信息丢失, 因为该信息被当做主机路由处理 在 isco OS 软件版本 11.0(2) 及更高版本中,nterior Gateway Routing Protocol (GRP) 和 Routing nformation Protocol (RP) 通过在未编号的点对点链路中发送主网的汇总路由来解决此问题 两个不同的主网和它们各自的子网 图 4 显示, 在串行链路的两端, 我们具备两个不同的主网, 两者都带有各自的子网 图 4 网络图 路由器 1.1.1.1 路由器 2.2.2.2 ip address 171.68.178.196 255.255.255.192 ip address 172.68.1.1 255.255.255.192 network 172.68.0.0 Router 1.1.1.1# show ip route 171.68.0.0/26 is subnetted, 1 subnets 171.68.178.192 is directly connected, Ethernet0 172.68.0.0/16 is variably subnetted, 2 subnets, 2 masks 172.68.0.0/16 [100/8976] via 172.68.1.1, 00:00:02, Serial0 172.68.1.0/32 [100/8976] via 172.68.1.1, 00:00:02, Serial0 Router 1.1.1.1# ping 172.68.1.1 Sending 5, 100-byte MP Echos to 172.68.1.1, timeout is 2 seconds: Success rate is 100 percent (5/5), round-trip min/avg/max = 32/81/280 ms 171.68.0.0/16 is variably subnetted, 2 subnets, 2 masks 171.68.178.192/32 [100/8976] via 171.68.178.196, 00:00:22, Serial0 171.68.0.0/16 [100/8976] via 171.68.178.196, 00:00:22, Serial0 172.68.0.0/26 is subnetted, 1 subnets 172.68.1.0 is directly connected, Ethernet0 Sending 5, 100-byte MP Echos to 171.68.178.196, timeout is 2 seconds: Success rate is 100 percent (5/5), round-trip min/avg/max = 28/31/32 ms 注意 : 在 isco OS 软件版本 11.0(2) 之前的版本中, 您需要为路由器 2.2.2.2 中的主网 171.68.0.0/16 和路由器 1.1.1.1 中的主网 172.68.0.0/16 放置一个静态路由 在此场景中, 子网信息丢失, 因为该信息被当做主机路由处理 在 isco OS 软件版本 11.0(2) 及更高版本中,GRP 和 RP 通过在未编号的点对点链路中发送主网的汇总路由来解决此问题 相关信息 故障排除技术说明
文件创建日期 : May 09, 2011 http://www.cisco.com/cisco/web/support/n/110/1105/1105754_20.html