取消
显示结果 
搜索替代 
您的意思是: 
cancel
6609
查看次数
72
有帮助
7
评论
ywanxin
Cisco Employee
Cisco Employee
本帖最后由 ywanxin 于 2015-3-20 10:17 编辑
什么是无编号接口?
请考虑下面列出的网络。 路由器 A 有一个串行接口 S0 和一个以太网接口 E0。
路由器 A 的 Ethernet 0 接口可以配置为下面显示的 IP 地址:
interface Ethernet0ip address 172.16.10.254 255.255.255.0
从逻辑上来说,要在接口 S0 上启用 IP,您需要在此接口上配置一个唯一的 IP 地址。 但是,也可以在串行接口上启用 IP 并启动它,而不为其分配唯一 IP 地址。 这是通过借用路由器的其他某个接口上已配置的 IP 地址来实现的。 为此,需要按照如下所示使用 ip unnumbered 接口模式命令。
interface Serial 0ip unnumbered Ethernet 0
ip unnumbered <类型> <编号> 接口模式命令会从指定的接口将 IP 地址借用到已配置此命令的接口上。 使用ip unnumbered 命令会导致两个接口共享 IP 地址。 因此,在我们的示例中,在以太网接口上配置的 IP 地址也分配给了串行接口,涉及到的两个接口均能正常运行。 如下所示,可以使用 show ip interface brief 命令的输出进行验证:
RouterA# show ip interface brief Interface IP-Address OK? Method Status ProtocolEthernet0 172.16.10.254 YES manual up upSerial0 172.16.10.254 YES manual up up
正如您在上面的 show ip interface brief 命令输出中所看到的,串行接口有一个与以太网接口相同的 IP 地址,并且两个接口的功能都完全正常。 从路由器的其他某个功能正常的接口借用地址的接口被称为“无编号接口”。 在我们的示例中,Serial 0 就是无编号接口。
无编号接口的唯一缺点就是无法进行远程测试和管理。 您应该记得,无编号接口应当从正常运行的接口借用地址。 如果无编号接口指向的接口无法正常工作(即,未显示“Interface 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
IP 和未编号 IP
在 Cisco 路由器上,连接到一个网段的每个接口都必须属于一个唯一子网。 直连的路由器具有连接到同一网段的接口,并从同一子网分配 IP 地址。 如果路由器需要向非直连的网络发送数据,会在其路由表内查找,然后将数据包转发给通向目的地的直连下一跳。 如果路由表中没有路由,路由器会将数据包转发给它的最后选用网关。 当直接连接到最终目标的路由器收到数据包时,会将数据包直接发送给终端主机。
IP 路由表中包含子网路由或主要的网络路由。 每个路由都有一个或多个直连的下一跳地址。 默认情况下,子网路由在主网络边界处聚合或汇总,以便减小路由表的大小。
注意: 上面所讨论的聚合机制假设使用了传统的距离矢量路由协议,如 Routing Information Protocol (RIP) 或 Interior Gateway Routing Protocol (IGRP)。
让我们考虑将 IP 地址分配给使用 B 类网络的路由器上的接口,该网络已经使用八位子网划分进行了子网划分。 每个接口都要求一个唯一子网。 尽管每个点对点串行连接只有两个端点需要编址,但如果我们为每个串行接口分配一整个子网,就会为每个只需要两个地址的接口使用 254 个可用的地址。 如果我们为每个串行接口使用无编号 IP,就可以节省地址空间; LAN 接口的地址被“借用”,并作为路由来自串行接口的更新和数据包的源地址。 这样就节省了地址空间。 无编号 IP 只对点对点链路有意义。
接收路由更新的路由器将更新的源地址安装为其路由表中的下一跳。 通常,下一跳是直连网络节点。 但如果我们使用无编号 IP,就不是这样了。因为每个串行接口都从其他 LAN 接口、其他子网接口,或其他主要网络中的接口“借用”IP 地址。 如果配置了无编号 IP,通过无编号 IP 接口获知的路由会将该接口,而不是路由更新的源地址作为下一跳。 因此,由于路由更新的源来自非直连的下一跳,我们避免了无效的下一跳地址问题。
配置示例
注意: 在这些配置示例的信息根据Cisco IOS软件版本12.2(10b)® 在Cisco 2500系列路由器和测试了。
让我们看看有关无编号 IP 的四个不同的配置示例。
注意: 我们使用了环回接口而不是以太网接口。
同一主网,不同子网
图 1 显示,在串行链路的任一端,我们具备相同的主网,但子网不同。
图1 – 网络图




路由器 1.1.1.1
路由器 2.2.2.2
Current configuration:interface Ethernet0 ip address 171.68.178.196 255.255.255.192 interface Serial0 ip unnumbered Ethernet0router igrp 10 network 171.68.0.0
Current configuration:interface Ethernet 0 ip address 171.68.179.1 255.255.255.192 interface Serial 0 ip unnumbered Ethernet0 router igrp 10 network 171.68.0.0

Router 1.1.1.1# show ip route

171.68.0.0/26 is subnetted, 3 subnets
I 171.68.179.0 [100/8976] via 171.68.179.1, 00:00:02, Serial0
C 171.68.178.192 is directly connected, Ethernet0
I 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

Type escape sequence to abort.
Sending 5, 100-byte ICMP 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

Router 2.2.2.2# show ip route

171.68.0.0/26 is subnetted, 3 subnets
C 171.68.179.0 is directly connected, Ethernet0
I 171.68.178.192 [100/8976] via 171.68.178.196, 00:00:02, Serial0
I 171.68.0.0 [100/8976] via 171.68.178.196, 00:00:02, Serial0

Router 2.2.2.2# ping 171.68.178.196

Type escape sequence to abort.
Sending 5, 100-byte ICMP 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
Current configuration:interface Ethernet0 ip address 171.68.178.196 255.255.0.0 interface Serial0 ip unnumbered Ethernet0 router igrp 10 network 171.68.0.0
Current configuration:interface Ethernet 0 ip address 172.68.1.1 255.255.0.0 interface Serial 0 ip unnumbered Ethernet0 router igrp 10 network 172.68.0.0

Router 1.1.1.1# show ip route

C 171.68.0.0/16 is directly connected, Ethernet0
I 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 ICMP 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

Router 2.2.2.2# show ip route

I 171.68.0.0/16 [100/8976] via 171.68.178.196, 00:00:21, Serial0
C 172.68.0.0/16 is directly connected, Ethernet0

Router 2.2.2.2# ping 171.68.178.196

Sending 5, 100-byte ICMP 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
Current configuration:interface Ethernet0 ip address 171.68.178.196 255.255.255.192interface Serial0 ip unnumbered Ethernet0 router igrp 10 network 171.68.0.0
Current configuration:interface Ethernet 0 ip address 172.68.1.1 255.255.0.0interface Serial 0 ip unnumbered Ethernet0 router igrp 10 network 172.68.0.0

Router 1.1.1.1# show ip route
171.68.0.0/26 is subnetted, 1 subnets
C 171.68.178.192 is directly connected, Ethernet0
I 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
Type escape sequence to abort.
Sending 5, 100-byte ICMP 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
Router 2.2.2.2# show ip route
171.68.0.0/16 is variably subnetted, 2 subnets, 2 masks
I 171.68.178.192/32 [100/8976] via 171.68.178.196, 00:00:48, Serial0
I 171.68.0.0/16 [100/8976] via 171.68.178.196, 00:00:48, Serial0
C 172.68.0.0/16 is directly connected, Ethernet0
Router 2.2.2.2# ping 171.68.178.196
Type escape sequence to abort.
Sending 5, 100-byte ICMP 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
注意: 在 Cisco IOS 软件版本 11.0(2) 之前的版本中,您需要为路由器 2.2.2.2 中的主网 171.68.0.0/16 放置一个静态路由。
在此场景中,子网信息丢失,因为该信息被当做主机路由处理。 在 Cisco IOS 软件版本 11.0(2) 及更高版本中,Interior Gateway Routing Protocol (IGRP) 和 Routing Information Protocol (RIP) 通过在未编号的点对点链路中发送主网的汇总路由来解决此问题。
两个不同的主网和它们各自的子网
图 4 显示,在串行链路的两端,我们具备两个不同的主网,两者都带有各自的子网。
图 4 – 网络图




路由器 1.1.1.1
路由器 2.2.2.2
Current configuration:interface Ethernet0 ip address 171.68.178.196 255.255.255.192 interface Serial0 ip unnumbered Ethernet0 router igrp 10 network 171.68.0.0
Current configuration:interface Ethernet 0 ip address 172.68.1.1 255.255.255.192 interface Serial 0 ip unnumbered Ethernet0 router igrp 10 network 172.68.0.0

Router 1.1.1.1# show ip route

171.68.0.0/26 is subnetted, 1 subnets
C 171.68.178.192 is directly connected, Ethernet0
172.68.0.0/16 is variably subnetted, 2 subnets, 2 masks
I 172.68.0.0/16 [100/8976] via 172.68.1.1, 00:00:02, Serial0
I 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

Type escape sequence to abort.
Sending 5, 100-byte ICMP 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

Router 2.2.2.2# show ip route

171.68.0.0/16 is variably subnetted, 2 subnets, 2 masks
I 171.68.178.192/32 [100/8976] via 171.68.178.196, 00:00:22, Serial0
I 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
C 172.68.1.0 is directly connected, Ethernet0

Router 2.2.2.2# ping 171.68.178.196

Type escape sequence to abort.
Sending 5, 100-byte ICMP 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
注意: 在 Cisco IOS 软件版本 11.0(2) 之前的版本中,您需要为路由器 2.2.2.2 中的主网 171.68.0.0/16 和路由器 1.1.1.1 中的主网 172.68.0.0/16 放置一个静态路由。
在此场景中,子网信息丢失,因为该信息被当做主机路由处理。 在 Cisco IOS 软件版本 11.0(2) 及更高版本中,IGRP 和 RIP 通过在未编号的点对点链路中发送主网的汇总路由来解决此问题。

评论
blgao
Cisco Employee
Cisco Employee
好文章!
taosun2
Cisco Employee
Cisco Employee
赞!!!
yanzha4
Spotlight
Spotlight
好,详细的总结
congx
Cisco Employee
Cisco Employee
楼主好人 么么哒
shlei
Cisco Employee
Cisco Employee
赞!!!
siyzhang
Spotlight
Spotlight
好文章!
XuLei18879
Level 1
Level 1
在什么地方用呢?
入门指南

使用上面的搜索栏输入关键字、短语或问题,搜索问题的答案。

我们希望您在这里的旅程尽可能顺利,因此这里有一些链接可以帮助您快速熟悉思科社区:









快捷链接