注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 利用手机和电池实现反地心..
 帮助

六、无类别路由选择


2008-04-28 21:29:51
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://format.blog.51cto.com/347937/74029
无类别路由查找时,它不会注重目的地址的类别,替代方式是,它会在目的地址和所有已知的路由之间逐位(bit-by-bit)执行最佳匹配。
 
无类别路由选择协议最根本的特点是,它可以在路由通告中具有携带子网掩码能力。因此,全0和全1子网现在就可以利用了。
 
作为一种已经渐渐淡出历史舞台的技术,无类别路由选择协议的理论部分我们已不需要花太大的力气去研究它了,现在给出一个无类别路由选择协议的实验,仅以此充实这篇文章,避免有人说我发水货文章。
 
下面说明一下初始配置:R1和R2为两台路由器,之间用串行链路连接,ip地址为10.1.1.x(x为路由器的编号)。每一个路由器启动一个loopback端口,ip地址配置为1.1.x.1(x为路由器的编号)。R1上配置一条默认路由指向R2。
 
下面是R1的配置:
R1#show run
Building configuration...
Current configuration : 952 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip subnet-zero
!
!
no ip domain lookup
!
ip cef
!
!
!        
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex half
!        
interface Serial1/0
 ip address 10.1.1.1 255.255.255.0
 serial restart-delay 0
 clock rate 64000
!
interface Serial1/1
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
!
ip classless
ip route 0.0.0.0 0.0.0.0 10.1.1.2
no ip http server
no ip http secure-server
!
!
!
!
!
!
!
!
!
gatekeeper
 shutdown
!
!
line con 0
 exec-timeout 0 0
 logging synchronous
 stopbits 1
line aux 0
 stopbits 1
line vty 0 4
!
!        
end
 
R2的配置:
R2#show run
Building configuration...
Current configuration : 900 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip subnet-zero
!
!
no ip domain lookup
!
ip cef
!
!
!        
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 1.1.2.1 255.255.255.0
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex half
!        
interface Serial1/0
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/1
 ip address 10.1.1.2 255.255.255.0
 serial restart-delay 0
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
!
ip classless
no ip http server
no ip http secure-server
!        
!
!
!
!
!
!
!
!
gatekeeper
 shutdown
!
!
line con 0
 exec-timeout 0 0
 logging synchronous
 stopbits 1
line aux 0
 stopbits 1
line vty 0 4
!
!
end
 
这时候我们在R1上能够ping通1.1.2.1!!!!!
 
关闭ip classless(在全局模式键入 no ip classless)再次ping 1.1.2.1,不通!
 
实验总结:
在关闭ip classless后,路由器使用无类别路由选择的原则来查找路由表,先查看是否有匹配目的地址主网络号的条目,在实验中为:   
1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
如果没有,丢弃数据包;
 
如果有,则进一步查找有无目的网络信息,在本实验中无该网络条目,于是路由器就会以不可路由的原因丢弃数据包,而不去匹配默认路由。

本文出自 “溺死的鱼” 博客,请务必保留此出处http://format.blog.51cto.com/347937/74029





    文章评论
 
2008-04-28 23:06:35
刚把holddown timer发上去 ISP架构那个文章是我看一个视频上介绍的,后面的很多policy是用bgp做的,所以bgp还是要好好搞一下

 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: