注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 服务器监控策略浅谈
 帮助

在有类路由协议中利用辅助地址路由无类掩码


2007-01-24 10:08:20
 标签:协议   [推送到技术圈]

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://3layer.blog.51cto.com/57448/16121

 

RIP V1 做为有类路由协议默认是将IP汇总成为标准的A B C 来通告的.但是利用辅助地址.可以让有类路由协议中也传送一下非标准掩码的IP.

个人认为辅助地址就是利用直连网络是一个无类的.一步步带着掩码在直连的线路上走过去.

最后体现为一个非标准掩码的路由信息.

Welcome to r1
r1>en
Password:

r1#show run
Building configuration...

Current configuration : 776 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
service password-encryption
!
hostname r1
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$G.1o$.KWnYk1FiFw/JykpObaTi0
!
no aaa new-model
ip subnet-zero
!
!
no ip domain lookup             
ip host r2 172.17.0.1           //设置主机名与ip的映射
ip host r3 192.168.1.2
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 description This is test port.
 ip address 192.168.4.1 255.255.255.252
!
interface FastEthernet0/0
 description link to r2
 ip address 172.17.0.2 255.255.0.0
 duplex half
!
router rip
 network 172.17.0.0
 network 192.168.4.0
!
ip classless
no ip http server
!
!
!
!
!
!
!
!
!
gatekeeper
 shutdown
!
banner motd ^CWelcome to r1^C
!
line con 0
stopbits 1
line aux 0
line vty 0 4
 no login
!
!
end

r1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    172.17.0.0/16 is directly connected, FastEthernet0/0
R    172.16.0.0/16 [120/2] via 172.17.0.1, 00:00:06, FastEthernet0/0
     192.168.4.0/30 is subnetted, 1 subnets
C       192.168.4.0 is directly connected, Loopback0
R    10.0.0.0/8 [120/2] via 172.17.0.1, 00:00:06, FastEthernet0/0
R    11.0.0.0/8 [120/2] via 172.17.0.1, 00:00:06, FastEthernet0/0
R    192.168.1.0/24 [120/1] via 172.17.0.1, 00:00:06, FastEthernet0/0
R    192.168.2.0/24 [120/2] via 172.17.0.1, 00:00:06, FastEthernet0/0
R    192.168.3.0/24 [120/2] via 172.17.0.1, 00:00:06, FastEthernet0/0 //没有再使用辅助地址.路由表中汇总了 3.0
r1#r2
Translating "r2"
Trying r2 (172.17.0.1)... Open
Welcome to r2
r2>en
Password:
r2#show run
Building configuration...

Current configuration : 835 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
service password-encryption
!
hostname r2
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$6ITt$xNEBQFksigYy2X44l.30p0
!
no aaa new-model
ip subnet-zero
!
!
no ip domain lookup
ip host r1 172.17.0.2
ip host r3 192.168.1.2
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
 description link to r1
 ip address 172.17.0.1 255.255.0.0
 duplex half
!
interface FastEthernet1/0
 description link to r3
 ip address 192.168.3.5 255.255.255.252 secondary      //添加一个30位掩码的辅助地址
 ip address 192.168.1.1 255.255.255.0
 duplex half
!
router rip
 network 172.17.0.0
 network 192.168.1.0
!
ip classless
no ip http server
!
!
!
!
!
!
!
!
!
gatekeeper
 shutdown
!
banner motd ^CWelcome to r2^C
!
line con 0
 stopbits 1
line aux 0
line vty 0 4
 no login
!
!
end


r2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    172.17.0.0/16 is directly connected, FastEthernet0/0
R    172.16.0.0/16 [120/1] via 192.168.3.6, 00:00:10, FastEthernet1/0
                   [120/1] via 192.168.1.2, 00:00:10, FastEthernet1/0
R    192.168.4.0/24 [120/1] via 172.17.0.2, 00:00:09, FastEthernet0/0
R    10.0.0.0/8 [120/1] via 192.168.3.6, 00:00:10, FastEthernet1/0
                [120/1] via 192.168.1.2, 00:00:10, FastEthernet1/0
R    11.0.0.0/8 [120/1] via 192.168.3.6, 00:00:10, FastEthernet1/0
                [120/1] via 192.168.1.2, 00:00:10, FastEthernet1/0
C    192.168.1.0/24 is directly connected, FastEthernet1/0
R    192.168.2.0/24 [120/1] via 192.168.3.6, 00:00:10, FastEthernet1/0
                    [120/1] via 192.168.1.2, 00:00:10, FastEthernet1/0
     192.168.3.0/30 is subnetted, 3 subnets
R       192.168.3.0 [120/1] via 192.168.1.2, 00:00:10, FastEthernet1/0
C       192.168.3.4 is directly connected, FastEthernet1/0 //直连被认为是无类的
R       192.168.3.16 [120/1] via 192.168.3.6, 00:00:11, FastEthernet1/0  // 注意这里路由了一个30位掩码的IP地址.在有类路由协议中.他是不应该从r3被通告过来的.这就是辅助地址的作用.
r2#r3
Translating "r3"
Trying r3 (192.168.1.2)... Open
Welcome to r3
r3>en
Password:
r3#show run
Building configuration...

Current configuration : 1276 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r3
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$y0hk$EiJhKbx3tTZel2U3qx2Dx/
!
no aaa new-model
ip subnet-zero
!
!
no ip domain lookup
ip host r2 192.168.1.1
ip host r1 172.17.0.2
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 description This is a test port.
 ip address 10.0.0.1 255.0.0.0
!
interface Loopback1
 description This is a test port.
 ip address 11.1.0.1 255.255.0.0
!
interface Loopback2
 description This is a test port.
 ip address 172.16.1.1 255.255.255.0
!
interface Loopback3
 description This is a test port.
 ip address 192.168.2.1 255.255.255.0
!
interface Loopback4
 description This is a test port.
 ip address 192.168.3.18 255.255.255.252
!
interface FastEthernet0/0
 description link to r2
 ip address 192.168.3.6 255.255.255.252 secondary     //添加一个30位掩码的辅助地址
 ip address 192.168.1.2 255.255.255.0
 duplex half
!
router rip
 network 10.0.0.0
 network 11.0.0.0
 network 172.16.0.0
 network 192.168.1.0
 network 192.168.2.0
 network 192.168.3.0
!
ip classless
no ip http server
!
!
!
!
!
!
!
!
!
gatekeeper
 shutdown
!
banner motd ^CWelcome to r3^C
!
line con 0
 stopbits 1
line aux 0
line vty 0 4
 no login
!
!
end

r3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

R    172.17.0.0/16 [120/1] via 192.168.1.1, 00:00:12, FastEthernet0/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, Loopback2
R    192.168.4.0/24 [120/2] via 192.168.1.1, 00:00:12, FastEthernet0/0
C    10.0.0.0/8 is directly connected, Loopback0
     11.0.0.0/16 is subnetted, 1 subnets
C       11.1.0.0 is directly connected, Loopback1
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, Loopback3
     192.168.3.0/30 is subnetted, 2 subnets
C       192.168.3.4 is directly connected, FastEthernet0/0
C       192.168.3.16 is directly connected, Loopback4
r3#

本文出自 “人类一思考,上帝都发笑” 博客,请务必保留此出处http://3layer.blog.51cto.com/57448/16121





    文章评论
 
 

发表评论

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