06 2009

Rip V2案例研究:水平分隔(ip split-horizon)。以及兼容V1

Posted by Yangybcy in CISCO

与V1兼容可以指定某些接口 
The interface-level "compatibility switches" recommended by RFC 1723 are implemented in Cisco IOS with the commands ip rip send version and ip rip receive version.

 

主要再研究一下ip splist-horizon

当前实验的示意图如上:
在这个网络中,如果R2的F0/0口上取消掉水平分隔(no ip split-horizon)后,通过Debug可以看到。

R2:
*Mar  1 00:29:31.411: RIP: sending v1 update to 255.255.255.255 via FastEthernet0/0 (192.168.5.1)
*Mar  1 00:29:31.411: RIP: build update entries
*Mar  1 00:29:31.411:   subnet 192.168.5.0 metric 1
*Mar  1 00:29:31.415:   subnet 192.168.5.16 metric 1
*Mar  1 00:29:31.415:   subnet 192.168.5.32 metric 2   这个路由条目明明是从通过F0/0口学到的。关闭掉水平分隔后,V1就会又从这个口发送出去!
*Mar  1 00:29:31.415:   subnet 192.168.5.64 metric 2
*Mar  1 00:29:31.415: RIP: sending v2 update to 224.0.0.9 via FastEthernet0/0 (192.168.5.1)
*Mar  1 00:29:31.419: RIP: build update entries
*Mar  1 00:29:31.419:   192.168.5.0/28 via 0.0.0.0, metric 1, tag 0
*Mar  1 00:29:31.419:   192.168.5.16/28 via 0.0.0.0, metric 1, tag 0
*Mar  1 00:29:31.423:   192.168.5.32/28 via 192.168.5.2, metric 2, tag 0  (这个路由条目也是不应该出现在这儿的。)
*Mar  1 00:29:31.427:   192.168.5.64/28 via 0.0.0.0, metric 2, tag 0
R2#

 

打开IP split-horizon后。Debug如下:
R2#
*Mar  1 00:32:21.503: RIP: sending v1 update to 255.255.255.255 via FastEthernet0/0 (192.168.5.1)
*Mar  1 00:32:21.503: RIP: build update entries
*Mar  1 00:32:21.503:   subnet 192.168.5.16 metric 1
*Mar  1 00:32:21.507:   subnet 192.168.5.64 metric 2
*Mar  1 00:32:21.507: RIP: sending v2 update to 224.0.0.9 via FastEthernet0/0 (192.168.5.1)
*Mar  1 00:32:21.507: RIP: build update entries
*Mar  1 00:32:21.507:   192.168.5.16/28 via 0.0.0.0, metric 1, tag 0
*Mar  1 00:32:21.511:   192.168.5.64/28 via 0.0.0.0, metric 2, tag 0

我们可以在这儿看到Rip 进程就不会通过0/0口发送从F0、0口接收到的5.32这个网段的路由条目 。
*Mar  1 00:32:23.511: RIP: received v2 update from 192.168.5.18 on FastEthernet0/1
*Mar  1 00:32:23.511:      192.168.5.64/28 via 0.0.0.0 in 1 hops
*Mar  1 00:32:27.767: RIP: received v2 update from 192.168.5.2 on FastEthernet0/0
*Mar  1 00:32:27.767:      192.168.5.32/28 via 0.0.0.0 in 1 hops
*Mar  1 00:32:34.275: RIP: sending v2 update to 224.0.0.9 via FastEthernet0/1 (192.168.5.17)
*Mar  1 00:32:34.275: RIP: build update entries
*Mar  1 00:32:34.275:   192.168.5.0/28 via 0.0.0.0, metric 1, tag 0
*Mar  1 00:32:34.279:   192.168.5.32/28 via 0.0.0.0, metric 2, tag 0

收藏与分享
06 2009

RIP V2

Posted by Yangybcy in CISCO

 

RIPv2 is defined in RFC 1723[1] and is supported in IOS versions 11.1 and later. RIPv2 is not a new protocol; rather, it is RIPv1 with some extensions to bring it more up-to-date with modern routing environments. These extensions are:
[1] Supplemental to this RFC are RFC 1721, "RIP Version 2 Protocol Analysis," and RFC 1722, "RIP Version 2 Protocol Applicability Statement."
  • Subnet masks carried with each route entry
  • Authentication of routing updates
  • Next-hop addresses carried with each route entry
  • External route tags
  • Multicast route updates
The most important of these extensions is the addition of a Subnet Mask field to the routing update entries, enabling the use of variable-length subnet masks and qualifying RIPv2 as a classless routing protocol.
RIPv2 is the first of the classless routing protocols discussed in this book. As such, this chapter serves as an introduction to classless routing, as well as to RIPv2.

 

All of the operational procedures, timers, and stability functions of RIPv1 remain the same in version 2, with the exception of the broadcast updates. RIPv2 multicasts updates to other RIPv2-speaking routers, using the reserved class D address 224.0.0.9. The advantage of multicasting is that devices on the local network that are not concerned with RIP routing do not have to spend time "unwrapping" broadcast packets from the router. The multicast updates are examined further in the section, "Compatibility with RIPv1."

 

RIP V2 Message Format:

 

RIP V2认证:
 

Authentication

A security concern with any routing protocol is the possibility of a router accepting invalid routing updates. The source of invalid updates may be an attacker trying to maliciously disrupt the internetwork or trying to capture packets by tricking the router into sending them to the wrong destination. A more mundane source of invalid updates may be a malfunctioning router. RIPv2 includes the capability to authenticate the source of a routing update by including a password.

Authentication is supported by modifying what would normally be the first route entry of the RIP message, as shown in Figure 7.7. With authentication the maximum number of entries a single update can carry is reduced to 24. The presence of authentication is indicated by setting the Address Family Identifier field to all ones (0xFFFF). The Authentication Type for simple password authentication is two (0×0002), and the remaining 16 octets carry an alphanumeric password of up to 16 characters. The password is left justified in the field, and if the password is less than 16 octets, the unused bits of the field are set to zero.

Figure 7.7. The RIPv2 authentication information, when configured, is carried in the first route entry space.

 

Note

Simple password authentication for RIPv2 is in plain text.(RIP V2使用的是明文认证。)

在CISCO IOS 上可以使用MD5认证。

Figure 7.8 shows an analyzer capture of a RIPv2 message with authentication. The figure also shows a difficulty with the default RIP authentication: The password is transmitted in plain text. Anyone who can capture a packet containing a RIPv2 update message can read the authentication password.

Figure 7.8. When simple password authentication is used, the password is carried in plain text and can be read by anyone who can "sniff" the packet carrying the update.

 

Note

The Cisco IOS supports MD5 authentication for RIPv2.

 

Although RFC 1723 describes only simple password authentication, foresight is shown by including the Authentication Type field. Cisco IOS takes advantage of this feature and provides the option of using MD5 authentication instead of simple password authentication.[8] Cisco uses the first and last route entry spaces for MD5 authentication purposes.

[8] MD5 is described in RFC 1321. A good discussion of MD5 can also be found in the following book: Charlie Kaufman, Radia Perlman, and Mike Spencer. Network Security: Private Communication in a Public World. Prentice Hall, 1995, pp. 120–122.

MD5 is a one-way message digest or secure hash function, produced by RSA Data Security, Inc. It is also occasionally referred to as a cryptographic checksum because it works in somewhat the same way as an arithmetic checksum. MD5 computes a 128-bit hash value from a plain text message of arbitrary length (a RIPv2 update, for instance) and a password. This "fingerprint" is transmitted along with the message. The receiver, knowing the same password, calculates its own hash value. If nothing in the message has changed, the receiver’s hash value should match the sender’s value transmitted with the message.

Figure 7.9 shows an update from the same router of Figure 7.8, but with MD5 authentication. The authentication type is three, and no password can be seen. Notice that Cisco is using both the first and the last route entry space for authentication information. Because this usage is not part of the open RIPv2 standard, the analyzer indicates "Authentication out of Place."

Figure 7.9. This update was originated from the same router as the update in Figure 7.8., but MD5 authentication is being used.

 

 

 

 

    在RFC1723中只对RIP 只提出了 明文 认证。CISCO利用第一个路由条目和最后一个路由条目来完成了MD5认证。
    V2 仍然使用的是520端口。
   

  • Subnet masks carried with each route entry
  • Authentication of routing updates
  • Next-hop addresses carried with each route entry
  • External route tags
  • Multicast route updates

V2在每一个路由条目中都带有子网掩码
可以在路由更新包中使用验证
每个路由条目中都带有下一跳地址。
可以使用扩展路由tag
使用组播方式发送更新包。

收藏与分享
05 2009

Review Questions OF RIP V1

Posted by Yangybcy in CISCO

Review Questions
1: What port does RIP use?
A: RIP uses UDP port 520.

2: What metric does RIP use? How is the metric used to indicate an unreachable network?
A: RIP uses a hop count metric. An unreachable network is indicated by setting the hop count to 16, which RIP interprets as an infinite distance.

3: What is the update period for RIP?
A: RIP sends periodic updates every 30 seconds minus a small random variable to prevent the updates of neighboring routers from becoming synchronized.
 
4: How many updates must be missed before a route entry will be marked as unreachable?
 A:A route entry is marked as unreachable if six updates are missed.

5: What is the purpose of the garbage collection timer?
A: The garbage collection timer, or flush timer, is set when a route is declared unreachable. When the timer expires, the route is flushed from the route table. This process allows an unreachable route to remain in the routing table long enough for neighbors to be notified of its status.
 
6: Why is a random timer associated with triggered updates? What is the range of this timer?
A: The random timer, whose range is 1 to 5 seconds, prevents a "storm" of triggered updates during a topology change.

7: What is the difference between a RIP Request message and a RIP Response message?
A: A Request message asks a router for an update. A Response message is an update.
 
8: Which two types of Request messages does RIP use?
A: A Request message may either ask for a full update or in some special cases it may ask for specific routes.
 
9: Under what circumstances will a RIP response be sent?
A: A Response is sent when the update timer expires, or upon reception of a Request message.
 
10: Why does RIP hide subnets at major network boundaries?
A: RIP updates do not include the subnet mask of the destination address, so a RIP router depends on the subnet masks of its own interfaces to determine how an attached major network address is subnetted. If a router does not have an attachment to a particular major network address, it has no way to know how that major network is subnetted. Therefore, no subnets of a major network address can be advertised into another major network.
 
 

收藏与分享
05 2009

OFFset-list in RIP on the CISCO Router (控制RIP度量值)

Posted by Yangybcy in CISCO

本章研究一下offset-list,随便用它来实现自定义RIP度量值的目的。

现有一个实验网络,共有3台设备。且连接示意如上图:
现在R3上一个网络。10.3.0.0/24。
R3正常使用的链路是以太网链路,串行链路只作为当以太网链路DOWN后,备份链路。但是当RIP 配好后。会发现从R1到R3的最优路径是R1走串行链路直接到R3了。这显然是与我们的要求不符。

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

      10.0.0.0/24 is subnetted, 1 subnets
R       10.3.0.0 [120/1] via 192.168.1.3, 00:00:00, Serial0/0
     192.168.0.0/30 is subnetted, 2 subnets
C       192.168.0.0 is directly connected, FastEthernet0/0
R       192.168.0.4 [120/1] via 192.168.1.3, 00:00:00, Serial0/0
                    [120/1] via 192.168.0.2, 00:00:16, FastEthernet0/0
C    192.168.1.0/24 is directly connected, Serial0/0

R1#show ip rip
R1#show ip rip da
10.0.0.0/8 auto-summary
10.3.0.0/24
[1] via 192.168.1.3, 00:00:03, Serial0/0
192.168.0.0/24 auto-summary
192.168.0.0/30 directly connected, FastEthernet0/0
192.168.0.4/30
[1] via 192.168.0.2, 00:00:19, FastEthernet0/0
[1] via 192.168.1.3, 00:00:03, Serial0/0
192.168.1.0/24 auto-summary
192.168.1.0/24 directly connected, Serial0/0

在这里我们可以通过使用offset-list来自定义从S0/0口到10.3。0.0的度量值。

 

 

使用OFFset-list 之前:
 R1#show ip rip database
10.0.0.0/8    auto-summary
10.3.0.0/24
    [1] via 192.168.1.3, 00:00:18, Serial0/0
192.168.0.0/24    auto-summary
192.168.0.0/30    directly connected, FastEthernet0/0
192.168.0.4/30
    [1] via 192.168.0.2, 00:00:27, FastEthernet0/0
    [1] via 192.168.1.3, 00:00:18, Serial0/0
192.168.1.0/24    auto-summary
192.168.1.0/24    directly connected, Serial0/0
R1#

使用offset-list后:
*Mar  1 00:25:28.867: %SEC-6-IPACCESSLOGNP: list 1 permitted 0 0.0.0.0 -> 10.3.0.0, 1 packet
匹配数据包。

R1#show ip rip database
10.0.0.0/8    auto-summary
10.3.0.0/24
    [7] via 192.168.1.3, 00:00:13, Serial0/0    (这儿的7就是原有的1跳+offset中设置的6。这儿RIP还没有完成最优路径的选择。只是对原路径做出的一个度量值的判断。后面一次的show idb就可以看到RIP已经对到10.3.0.0这个网段的路径做了最优选择,改走192.168.0.2出去了。)
192.168.0.0/24    auto-summary
192.168.0.0/30    directly connected, FastEthernet0/0
192.168.0.4/30
    [1] via 192.168.0.2, 00:00:21, FastEthernet0/0
    [1] via 192.168.1.3, 00:00:13, Serial0/0
192.168.1.0/24    auto-summary
192.168.1.0/24    directly connected, Serial0/0  

R1#show ip route
Gateway of last resort is not set

 

结果验证:
R1#traceroute 10.3.0.1

Type escape sequence to abort.
Tracing the route to 10.3.0.1

  1 192.168.0.2 116 msec 80 msec 68 msec
  2 192.168.0.6 140 msec *  132 msec

 

 

     10.0.0.0/24 is subnetted, 1 subnets
R       10.3.0.0 [120/2] via 192.168.0.2, 00:00:06, FastEthernet0/0(RIP已经完成最优路径的选择)
     192.168.0.0/30 is subnetted, 2 subnets
C       192.168.0.0 is directly connected, FastEthernet0/0
R       192.168.0.4 [120/1] via 192.168.1.3, 00:00:04, Serial0/0
                    [120/1] via 192.168.0.2, 00:00:06, FastEthernet0/0
C    192.168.1.0/24 is directly connected, Serial0/0
R1#R1#show ip rip da
10.0.0.0/8    auto-summary
10.3.0.0/24
    [2] via 192.168.0.2, 00:00:10, FastEthernet0/0
192.168.0.0/24    auto-summary
192.168.0.0/30    directly connected, FastEthernet0/0
192.168.0.4/30
    [1] via 192.168.0.2, 00:00:10, FastEthernet0/0
    [1] via 192.168.1.3, 00:00:11, Serial0/0
192.168.1.0/24    auto-summary
192.168.1.0/24    directly connected, Serial0/0

收藏与分享
05 2009

a passive-interface in rip on the cisco router

Posted by Yangybcy in CISCO


首先在3台路由器上启用RIP V2、no auto-summary、后
R1#show ip rip database
10.0.0.0/8    auto-summary
10.2.0.0/24
    [1] via 192.168.0.2, 00:00:36, FastEthernet0/0
10.2.1.0/24
    [1] via 192.168.0.2, 00:00:36, FastEthernet0/0
10.3.0.0/24
    [1] via 192.168.0.3, 00:00:38, FastEthernet0/0
10.3.1.0/24
    [1] via 192.168.0.3, 00:00:38, FastEthernet0/0
192.168.0.0/24    auto-summary
192.168.0.0/24    directly connected, FastEthernet0/0

可以看到 RIP已经成功交换数据后。

现在在RIP中执行passive-interface f0/0后。查看RIP database
R3#show ip rip database
10.0.0.0/8    auto-summary
10.2.0.0/24
    [1] via 192.168.0.2, 00:00:22, FastEthernet0/0
10.2.1.0/24
    [1] via 192.168.0.2, 00:00:22, FastEthernet0/0
10.3.0.0/24    directly connected, Loopback0
10.3.1.0/24    directly connected, Loopback1
192.168.0.0/24    auto-summary
192.168.0.0/24    directly connected, FastEthernet0/0
发现虽然在f0/0口上没有发送V2的组播更新,但还没有及时更新到idb中。
R3#clear ip route *
R3#
*Mar  1 00:06:52.223: rip_route_adjust for FastEthernet0/0 coming up
*Mar  1 00:06:52.227: RIP: sending request on Loopback0 to 224.0.0.9
*Mar  1 00:06:52.227: RIP: sending request on Loopback1 to 224.0.0.9
*Mar  1 00:06:52.227: rip_route_adjust for Loopback0 coming up
*Mar  1 00:06:52.231: RIP: sending request on Loopback0 to 224.0.0.9
*Mar  1 00:06:52.235: RIP: sending request on Loopback0 to 224.0.0.9
*Mar  1 00:06:52.239: RIP: sending request on Loopback1 to 224.0.0.9
*Mar  1 00:06:52.243: rip_route_adjust for Loopback1 coming up
*Mar  1 00:06:52.247: RIP: sending request on Loopback1 to 224.0.0.9
*Mar  1 00:06:52.251: RIP: remove FastEthernet0/0 from RIP idb list
*Mar  1 00:06:52.251: RIP: remove Loopback0 from RIP idb list
*Mar  1 00:06:52.251: RIP: remove Loopback1 from RIP idb list
*Mar  1 00:06:52.271: RIP: add Loopback0 to RIP idb list
*Mar  1 00:06:52.271: RIP: add Loopback1 to RIP idb list
*Mar  1 00:06:52.275: RIP: sending request on Loopback0 to 224.0.0.9
*Mar  1 00:06:52.279: RIP: sending request on Loopback1 to 224.0.0.9
*Mar  1 00:06:52.279: RIP: add FastEthernet0/0 to RIP idb list
*Mar  1 00:06:52.315: RIP: ignored v2 packet from 10.3.0.1 (sourced from one of our addresses)
*Mar  1 00:06:52.315: RIP: ignored v2 packet from 10.3.1.1 (sourced from one of our addresses)
*Mar  1 00:06:52.315: RIP: ignored v2 packet from 10.3.0.1 (sourced from one of our addresses)
*Mar  1 00:06:52.315: RIP: ignored v2 packet from 10.3.0.1 (sourced from one of our addresses)
*Mar  1 00:06:52.319: RIP: ignored v2 packet from 10.3.1.1 (sourced from one of our addresses)
*Mar  1 00:06:52.319: RIP: ignored v2 packet from 10.3.1.1 (sourced from one of our addresses)
*Mar  1 00:06:52.319: RIP: ignored v2 packet from 10.3.0.1 (sourced from one of our addresses)
*Mar  1 00:06:52.319: RIP: ignored v2 packet from 10.3.1.1 (sourced from one of our addresses)
*Mar  1 00:06:52.463: RIP-TIMER: age timer expired
*Mar  1 00:06:54.255: RIP: sending v2 flash update to 224.0.0.9 via Loopback0 (10.3.0.1)
*Mar  1 00:06:54.255: RIP: Update contains 2 routes
*Mar  1 00:06:54.255: RIP: Update queued
*Mar  1 00:06:54.259: RIP: sending v2 flash update to 224.0.0.9 via Loopback1 (10.3.1.1)
*Mar  1 00:06:54.259: RIP: Update contains 2 routes
*Mar  1 00:06:54.259: RIP: Update queued
*Mar  1 00:06:54.263: RIP: Update sent via Loopback0
*Mar  1 00:06:54.263: RIP: Update sent via Loopback1
*Mar  1 00:06:54.267: RIP: ignored v2 packet from 10.3.0.1 (sourced from one of our addresses)
*Mar  1 00:06:54.267: RIP: ignored v2 packet from 10.3.1.1 (sourced from one of our addresses)
*Mar  1 00:07:02.463: RIP-TIMER: age timer expired
*Mar  1 00:07:12.463: RIP-TIMER: age timer expired
再到R1上show idb后发现:
R1#show ip rip database
192.168.0.0/24    auto-summary
192.168.0.0/24    directly connected, FastEthernet0/0
  在R1上面并没有R2和R3的网段存在,说明passive-interface已经配置成功了。但是现在怎样才能获取到R2和R3的路由呢? 这儿就要用到neighbor命令了!!
  在R2上neighbor 192.168.0.1后。debug ip rip events后发现如下信息:
*Mar  1 00:27:01.695: RIP: sending v2 update to 192.168.0.1 via FastEthernet0/0 (192.168.0.2)
在普通情况下的RIP V2 的Sending信息为:
*Mar  1 00:27:01.803: RIP: sending v2 update to 224.0.0.9 via Loopback1 (10.2.1.1)

 

 在R1(192.168.0.1)上通过debug可以看到。R2的 Rip V2 Update包已经成功的发送到R1上面:
*Mar  1 00:36:11.071: RIP: received v2 update from 192.168.0.2 on FastEthernet0/0

R1#sh ip rip d
10.0.0.0/8    auto-summary
10.2.0.0/24
    [1] via 192.168.0.2, 00:00:09, FastEthernet0/0
10.2.1.0/24
    [1] via 192.168.0.2, 00:00:09, FastEthernet0/0
192.168.0.0/24    auto-summary
192.168.0.0/24    directly connected, FastEthernet0/0

通过show idb 可以看到R2上的路由信息已经成功的send 到了R1上。既然R1上面有了R2的信息,那R3上面有R2的信息没呢?

R3#show ip rip database
10.0.0.0/8    auto-summary
10.3.0.0/24    directly connected, Loopback0
10.3.1.0/24    directly connected, Loopback1
192.168.0.0/24    auto-summary
192.168.0.0/24    directly connected, FastEthernet0/0

可以看到在R3上面没有任何关于R2的信息。说明我们需要的目的已经达到!

passive-interface 将指定的接口 设定为被动接口,即只接收路由信息,但不通过该接口对外发送路由更新!
Neighbor   有目的的发送路由更新。(在RIP中V1使用的是广播方式、V2使用的是组播方式。其它路由不在本章的考虑范围!)

 

收藏与分享
05 2009

关于 RIP auto-summary 在小子网中的问题

Posted by Yangybcy in CISCO

    今天上班,本想着做关于passive-interface实验的!   结果在配置RIP V2的过程是,发现一个很让人郁闷的情况。

1、所有路由器均运行RIP V2。末执行no autosum-address命令。
配置情况如下:

R1:
R1#show run | begin rip
router rip
 version 2
 network 10.0.0.0
 network 192.168.0.0
!

R2#show run | begin rip
router rip
 version 2
 network 10.0.0.0
 network 192.168.0.0

R3#show run | begin rip
router rip
 version 2
 network 10.0.0.0
 network 192.168.0.0

然后出来的路由为:
R1#show ip rip database
10.0.0.0/8    auto-summary
10.0.0.0/8
    [1] via 192.168.0.3, 00:00:05, FastEthernet0/0
    [1] via 192.168.0.2, 00:00:26, FastEthernet0/0
10.1.0.0/24    directly connected, Loopback0
10.1.1.0/24    directly connected, Loopback1
10.1.2.0/24    directly connected, Loopback2
192.168.0.0/24    auto-summary
192.168.0.0/24    directly connected, FastEthernet0/0
 

这该死的RIP自动执行了auto-summary后。就把俺的10网段给summary了!!!!  
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

     10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C       10.1.2.0/24 is directly connected, Loopback2
C       10.1.1.0/24 is directly connected, Loopback1
R       10.0.0.0/8 [120/1] via 192.168.0.3, 00:00:15, FastEthernet0/0
                   [120/1] via 192.168.0.2, 00:00:06, FastEthernet0/0
C       10.1.0.0/24 is directly connected, Loopback0
C    192.168.0.0/24 is directly connected, FastEthernet0/0
R1#

然后在R1上执行tracert一个正确的目的地址:
R1#traceroute 10.3.2.1

Type escape sequence to abort.
Tracing the route to 10.3.2.1

  1 192.168.0.3 36 msec
    192.168.0.2 40 msec *
RIP虽说多走些弯路,但还算能够把包送到目的地。下面再来试一下tracert 一个不存在的目的地址:
R1#traceroute 10.3.3.1

Type escape sequence to abort.
Tracing the route to 10.3.3.1

  1 192.168.0.2 64 msec
    192.168.0.3 72 msec
    192.168.0.2 32 msec
  2 192.168.0.1 20 msec
    192.168.0.3 64 msec
    192.168.0.1 28 msec
  3 192.168.0.1 12 msec *  120 msec
  4  *  *  *
tracert 10.3.3.1   系统会在route-table里面发现到达目的地有两条等价的路由。

R       10.0.0.0/8 [120/1] via 192.168.0.3, 00:00:15, FastEthernet0/0
                   [120/1] via 192.168.0.2, 00:00:06, FastEthernet0/0

于是会自动的链路负载均衡,从出来的结果可以看到 数据走到了192。168.0。2这个R2的F0/0接口上。通过抓 R2的F0/0接口的数据包,不难看出。

数据包达到了R2后。R2发现自己上并无10.3.3.1这个段的地址,于是回复time-to-live并Redirect(重定向)地址到192.168.0。1
 

然后抓R3的包发现。

呵呵 这样的结果是挺好耍的。!  不过这样容易产生很多不必要的网络流量!   如果在一个大型网络中,这又是一个不小的广播风暴。

 取消掉auto-summary后。路由表即正常:
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

     10.0.0.0/8 is variably subnetted, 9 subnets, 2 masks
R       10.3.1.0/24 [120/1] via 192.168.0.3, 00:00:02, FastEthernet0/0
R       10.2.0.0/24 [120/1] via 192.168.0.2, 00:00:16, FastEthernet0/0
R       10.3.0.0/24 [120/1] via 192.168.0.3, 00:00:02, FastEthernet0/0
                    [120/1] via 192.168.0.2, 00:00:16, FastEthernet0/0
R       10.2.1.0/24 [120/1] via 192.168.0.2, 00:00:16, FastEthernet0/0
C       10.1.2.0/24 is directly connected, Loopback2
C       10.1.1.0/24 is directly connected, Loopback1
R       10.0.0.0/8 [120/1] via 192.168.0.3, 00:00:59, FastEthernet0/0
                   [120/1] via 192.168.0.2, 00:01:10, FastEthernet0/0
R       10.3.2.0/24 [120/1] via 192.168.0.3, 00:00:02, FastEthernet0/0
C       10.1.0.0/24 is directly connected, Loopback0
C    192.168.0.0/24 is directly connected, FastEthernet0/0

OK   再次tracert 发现结果正常了。
R1#traceroute 10.3.2.1

Type escape sequence to abort.
Tracing the route to 10.3.2.1

  1 192.168.0.3 308 msec *  208 msec

通过 show ip rip database可以看出,RIP已经学到了具体的网络>
R1#show ip rip database
10.0.0.0/8    auto-summary
10.0.0.0/8
    [1] via 192.168.0.3, 00:02:39, FastEthernet0/0
    [1] via 192.168.0.2, 00:02:50, FastEthernet0/0
10.1.0.0/24    directly connected, Loopback0
10.1.1.0/24    directly connected, Loopback1
10.1.2.0/24    directly connected, Loopback2
10.2.0.0/24
    [1] via 192.168.0.2, 00:00:05, FastEthernet0/0
10.2.1.0/24
    [1] via 192.168.0.2, 00:00:05, FastEthernet0/0
10.3.0.0/24
    [1] via 192.168.0.3, 00:00:21, FastEthernet0/0
    [1] via 192.168.0.2, 00:00:05, FastEthernet0/0
10.3.1.0/24
    [1] via 192.168.0.3, 00:00:21, FastEthernet0/0
10.3.2.0/24
    [1] via 192.168.0.3, 00:00:21, FastEthernet0/0
192.168.0.0/24    auto-summary
192.168.0.0/24    directly connected, FastEthernet0/0

收藏与分享
05 2009

RIP 的一些测试

Posted by Yangybcy in CISCO

抓包文件:

R0-to-R1.cap

 

R1_to_R2.cap

 

RIP V1的一些测试

debug ip rip trigger  

*Mar  1 00:32:46.903: RIP-TIMER: sending timer on Loopback1 expired

*Mar  1 00:32:52.447: RIP-TIMER: sending timer on Loopback0 expired

*Mar  1 00:32:52.867: RIP-TIMER: age timer expired

*Mar  1 00:33:02.867: RIP-TIMER: age timer expired

*Mar  1 00:33:03.331: RIP-TIMER: sending timer on FastEthernet0/1 expired

*Mar  1 00:33:10.491: RIP-TIMER: sending timer on Loopback2 expired

*Mar  1 00:33:12.867: RIP-TIMER: age timer expired

*Mar  1 00:33:14.547: RIP-TIMER: sending timer on Loopback1 expired

*Mar  1 00:33:20.623: RIP-TIMER: sending timer on Loopback0 expired

*Mar  1 00:33:22.867: RIP-TIMER: age timer expired

总算通过debug 看到了CISCO的失效时间+-5。

3个路由器上都运行RIP V1。

R0:

router rip

 network 10.0.0.0

 network 192.168.0.0

R1:

router rip

 network 192.168.0.0

 network 192.168.1.0

 no auto-summary

R2:

router rip

 network 10.0.0.0

 network 192.168.1.0

 no auto-summary

在R1上show ip route时,可以看到

R    10.0.0.0/8 [120/1] via 192.168.1.2, 00:00:26, FastEthernet0/1

                [120/1] via 192.168.0.1, 00:00:16, FastEthernet0/0

到10.0.0.0/8这个网段有两条 等价的路径 分别via192.168.1.2和192.168.0.1 。但是实际上192.168.1.2与192.168.0.1所指向的10.0.0.0是不同的网络。   所以V1的有类路由,真的很笨!!!!

R1上debug ip route ev data

*Mar  1 00:51:02.847: RIP: Update contains 1 routes

*Mar  1 00:51:04.811: RIP: sending v1 update to 255.255.255.255 via FastEthernet0/0 (192.168.0.1)

*Mar  1 00:51:04.811: RIP: Update contains 1 routes

*Mar  1 00:51:04.811: RIP: Update queued

*Mar  1 00:51:04.815: RIP: Update sent via FastEthernet0/0

*Mar  1 00:51:20.703: RIP: sending v1 update to 255.255.255.255 via Loopback0 (10.1.0.1)

*Mar  1 00:51:20.703: RIP: Update contains 4 routes

*Mar  1 00:51:20.707: RIP: Update queued

*Mar  1 00:51:20.707: RIP: Update sent via Loopback0

*Mar  1 00:51:23.999: RIP: sending v1 update to 255.255.255.255 via Loopback2 (10.1.2.1)

*Mar  1 00:51:23.999: RIP: Update contains 4 routes

*Mar  1 00:51:23.999: RIP: Update queued

*Mar  1 00:51:24.003: RIP: Update sent via Loopback2

*Mar  1 00:51:29.727: RIP: sending v1 update to 255.255.255.255 via Loopback1 (10.1.1.1)

*Mar  1 00:51:29.727: RIP: Update contains 4 routes

*Mar  1 00:51:29.731: RIP: Update queued

*Mar  1 00:51:29.731: RIP: Update sent via Loopback1

*Mar  1 00:51:30.607: RIP: received v1 update from 192.168.0.2 on FastEthernet0/0

*Mar  1 00:51:30.607: RIP-DB: network_update with 192.168.1.0/24 succeeds

*Mar  1 00:51:30.611: RIP-DB: adding 192.168.1.0/0 (metric 1) via 192.168.0.2 on FastEthernet0/0 to RIP database

但是我通过抓包却又无法看到:Update contains 4 routes  这个东东!!!  郁闷 。。。。。。

总结发现: Rip V1属于有类路由,这类路由优点是配置简单。但很容易发生路由错误。就像上图中的10网段的路由错误的简单认为是指向的同一个网络。且V1使用的是广播方式发送路由更新包(255.255.255.255)

升级为 V2后,可以看到 V2的路由更新包 立即使用224.0.0.9以组播方式发送。且在更新中带上了网络掩码!

*Mar  1 00:55:03.867: RIP: sending v2 update to 224.0.0.9 via Loopback0 (10.1.0.1)

*Mar  1 00:55:03.867: RIP: Update contains 4 routes

*Mar  1 00:55:03.867: RIP: Update queued

*Mar  1 00:55:03.871: RIP: Update sent via Loopback0

*Mar  1 00:55:03.875: RIP: ignored v2 packet from 10.1.0.1 (sourced from one of our addresses)

*Mar  1 00:55:05.527: RIP: sending v2 update to 224.0.0.9 via Loopback2 (10.1.2.1)

*Mar  1 00:55:05.527: RIP: Update contains 4 routes

*Mar  1 00:55:05.531: RIP: Update queued

*Mar  1 00:55:05.531: RIP: Update sent via Loopback2

*Mar  1 00:55:05.535: RIP: ignored v2 packet from 10.1.2.1 (sourced from one of our addresses)

*Mar  1 00:55:08.031: RIP: received v2 update from 192.168.0.2 on FastEthernet0/0

*Mar  1 00:55:08.035: RIP-DB: network_update with 192.168.1.0/30 succeeds

*Mar  1 00:55:08.035: RIP-DB: adding 192.168.1.0/30 (metric 1) via 192.168.0.2 on FastEthernet0/0 to RIP database

*Mar  1 00:55:08.035: RIP-DB: add 192.168.1.0/30 (metric 1) via 192.168.0.2 on FastEthernet0/0

*Mar  1 00:55:08.035: RIP-DB: Adding new rndb entry 192.168.1.0/30

*Mar  1 00:56:32.255: RIP-DB: network_update with 10.0.0.0/24 succeeds

*Mar  1 00:56:32.255: RIP-DB: adding 10.0.0.0/24 (metric 2) via 192.168.0.2 on FastEthernet0/0 to RIP database

*Mar  1 00:56:32.259: RIP-DB: network_update with 10.0.1.0/24 succeeds

*Mar  1 00:56:32.259: RIP-DB: adding 10.0.1.0/24 (metric 2) via 192.168.0.2 on FastEthernet0/0 to RIP database

*Mar  1 00:56:32.259: RIP-DB: network_update with 10.0.2.0/24 succeeds

*Mar  1 00:56:32.263: RIP-DB: adding 10.0.2.0/24 (metric 2) via 192.168.0.2 on FastEthernet0/0 to RIP database

*Mar  1 00:56:32.263: RIP-DB: network_update with 192.168.1.0/30 succeeds

*Mar  1 00:56:32.263: RIP-DB: adding 192.168.1.0/30 (metric 1) via 192.168.0.2 on FastEthernet0/0 to RIP database

这样出来的路由

R       10.0.0.0/8 [120/1] via 192.168.0.1, 00:00:00, FastEthernet0/0

R       10.0.1.0/24 [120/1] via 192.168.1.2, 00:00:20, FastEthernet0/1

可以看到网络掩码做到了最小化。

 

收藏与分享
28 2009

Operation of RIP

Posted by Yangybcy in CISCO

RIP V1:
使用UDP封装报文,收发均使用520端口。有两种数据报类型:Request(请求)、Response(回应)。使用Hop count(跳)来度量网络。1表示是与发出通告的路由器相直连的网络,16跳表示网络不可达。
RIP Timers and Stability Features
每30s在RIP Enable的接口上Broadcost Response messages。 Response messages or update contains the router's full route table with exception of entries suppressed by the split horizon rule。RIP更新由一个随机变量决定(25-35s之间)。CISCO IOS中使用RIP_JITTER来决定更新时间随机变量(4.5s)。所以CISCO中的RIP更新时间在25-35之间。

The Update Messages use broadcast 255.255.255.255 is the all-hosts .

RIP也使用一些其它的计时器。在CISCO IOS中使用 invalid times.当一条新的路由条目建立后,超时计时器就会被初始化为180S。当有一条路由的更新在180S(6个更新周期)内还没有被收到,那么这条路由的跳数将变成16,即被标记为不可达的路由。

  垃圾计时器(The garbage collection)或刷新计时器(Flush timer),它设置的时间长度一般比限时计时器长240-60S(IETF中规定的为120S)。如果该路由被通告为一条度量值不可达的路由,同时从路由选择表中删除该路由。
  [The garbage collection or flush timer,is set to 240s -60s longer than the expiration thme.the route will be advertised with the unreachable metric until the garbage collection timer expires,at which time thd route will be removed from thd route table.]

  第3个计时器 抑制计时器(Holddown Times)。

  RIP使用带有毒性逆转(Poison reverse)的水平分隔(Split horizon)和触发更新(Triggered updates)。不像普通的定期更新,触发更新在只有路由的度量值发生改变时就会产生,而且触发更新不会引起接收路由器重围它们的更新计时器;




RIP Message Format (RIP消息格式)
  每条消息包含一个命令标识(Command)、一个版本号(Version Number)和路由条目(最大25条)。每个路由条目包括地址族标识(Address Family Identifier)、路由可达的IP地址和路由的跳楼。
  RIP消息的开头部分(头部)占用4个8bit字节,而每个路由条目占20个8bit字节。因此RIP消息的最大为4+(25*20)=504个8bit字节,再加上8个字节的UDP头部,RIP数据报文的大小 (不含IP包的头部)最大可达514个8bit字节。
  Each message contains a command and version number and can contain entries for up 25 routes. Each route entry includes and address family identifier, the ip address reachable by the route,and the hop count for the route. if a router must send an update with more than 25entries,multiple RIP Message must be produced.Note that the initial portion of the message is 4 octets,and each route entry is 20 octets, therefore the maximum message size is 4+(25*20) = 504octets . including an eight-byte UDP Header will make thd maximum RIP datagram size(not including the IP Header)512 octets.


  Command will always be set to either one,signifying a Request message, or two,signifying q response message. there are other commands, but the are all either obsolete or reserved for private use.
  Command --只取值1或2,1表示该消息是请求消息,2表示该消息是响应消息。其它的取值都不被使用或者保留用作私有用途。

  version will be set to one for RIP V1.
  版本(Version) 这个就不说了。RIPV1就设置为1。

  Address family identifier is set to two for ip . The only exception to this is a request for a router's (or host's) full route table,as discussed in the following section
  地址族标识(Address family identifier,AFI) –对于IP该项设置为2。只有一个例外情况,该消息是路由器(或主机)整个路由选择表的请求,

  

收藏与分享
25 2009

在OSPF中使用route-map来控制路由重发布

Posted by Yangybcy in CISCO

在OSPF中使用route-map来控制路由重发布

在一个大型的公司中,有多套生产网络。1套监控网络,1套收费网络。现因收费网络设备故障率较高,决定将部份地点的收费网络单点的并向当地的监控网络。然后在监控网络中心与收费网络相联。以此来快速解决收费网络的单点故障。

但是不能在收费网络中出现监控网络的路由信息。与是使用 Route-map和Redistribute 配合使用。

在R0上有3个Loopback接口。IP地址分别为:172.16.0/1/2.1 

R0通过交换网络与2620(R1)、3640(R2)相联。中间走OSPF area 100

R1、R2通过以太网口与R3相联。

在R1和R2上做Redistribute。

router ospf 1

 log-adjacency-changes

 redistribute ospf 2 metric 222 subnets

 network 192.168.1.0 0.0.0.255 area 100

!

router ospf 2

 log-adjacency-changes

 redistribute connected

 redistribute ospf 1 subnets route-map 20

 network 192.168.2.4 0.0.0.3 area 1

!

ip classless

ip http server

!

access-list 20 permit 172.16.1.0 0.0.0.3 log

route-map 20 permit 10

 match ip address 20

 set metric 55555

 set tag 7503

!

R2上显示Log:

01:07:14: %SEC-6-IPACCESSLOGS: list 20 permitted 172.16.1.1 1 packet

然后在R3 show ip route可以看到路由以E2方式成功引入:

O E2    172.16.1.1 [110/55555] via 192.168.2.5, 00:00:01, Ethernet0/1

参考资料:http://www.cisco.com/en/US/docs/ios/12_0t/12_0t3/feature/guide/policyrt.html 

 

http://blog.sina.com.cn/s/blog_56e2acee010008n6.html

 

http://www.pcppc.cn/zuwang/guanliyuan/zuwang_81669.html

点击下载此文件(PDF格式)

点击下载此文件(配置文件)

点击下载此文件(配置文件和Net文件)

收藏与分享
23 2009

07年wolf路由交换ccie视频下载(下)

Posted by Yangybcy in CISCO

视频来源:www.56cto.com

 注:只能单线程下载

07年wolf路由交换ccie视频:18-TRUNK-VTP.rar

07年wolf路由交换ccie视频:19-STP PortFast Rstp Mstp.rar

07年wolf路由交换ccie视频:20-Password恢复 Rstp Mstp EtherChannel.rar

07年wolf路由交换ccie视频:21-IRDP HSRP VRRP GLBP.rar

07年wolf路由交换ccie视频:22-Vlan路由 Security NTP.rar

07年wolf路由交换ccie视频:23-MPLS(1).rar

07年wolf路由交换ccie视频:24-MPLS(2).rar

07年wolf路由交换ccie视频:25-组播Multicast1.rar

07年wolf路由交换ccie视频:26-组播Multicast2.rar

07年wolf路由交换ccie视频:27-QOS介绍.rar

07年wolf路由交换ccie视频:28-NAT网络地址转换.rar

07年wolf路由交换ccie视频:29-PPP.rar

解压密码:www.56cto.com
 

收藏与分享
Pages: 上一页 1 2 3 4 5 6 7 8 下一页