實驗開始前,先說點與實驗無關的事情,在前兩篇路由配置的文章中,有很多的網友參與進來進行讨論,有非51cto的網友,也有51cto的朋友,在這裡要感謝一下gairuhe朋友,他多次提出意見,建議我使用可以使用真正的IOS來進行實驗模拟的Dynamips軟體,并且建議我在文章中把路由表也貼出來,這樣會看得更加直覺和友善,這些建議都很好,在此謝謝衆多網友的支援!
言歸正傳,Boson Netsim的實驗規劃,預設路由下一個實驗應該是RIP協定的配置。衆所周知,RIP(Routing Information Protocol),即路由資訊協定,它與IGRP,OSPF等一樣都是屬于IGP(Interior Gateway Protocol)——内部網關協定,它是一種曆史很悠久的協定了,但是迄今為止,RIP還在小型網絡中很流行,因為它是基于跳數來對路徑進行度量的(僅僅隻靠跳數來進行度量也成為了RIP為人所诟病的地方),這樣使得RIP相比之下顯得最簡單,并且大多數的路由器也都支援RIP。據說,RIP還可以保證不同廠商的路由器互聯時能有良好的相容性。下面再說說RIP的大概工作機理。
RIP把每經過一個路由器稱為經過了一跳,而每經過一跳,RIP就會将他的路徑成本(metric)加1,這樣的話,跳數越多的則路徑越長,而RIP會優先選擇一條到達目标網絡跳數少的路徑,他支援的最大跳數是15跳,超過則被認為是不可達。接下來看看我的實驗。
順便說一下,在最近幾次的實驗中,我都将以這幅圖作為實驗的拓撲圖。和前兩次一樣,關鍵語句我都有注解,一來這樣友善想學習的朋友,二來也可以作為我自己以後備查,呵呵,下面看看我的配置:
r1的配置:
Press Enter to Start
Router>
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname router1
router1(config)#interface e0
router1(config-if)#ip address 192.168.1.2 255.255.255.0
router1(config-if)#no shut
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
router1(config-if)#interface s0
router1(config-if)#ip address 192.168.2.1 255.255.255.0
router1(config-if)#clock rate 6400
%LINK-3-UPDOWN: Interface Serial0, changed state to up
router1(config-if)#exit
%LINK-3-UPDOWN: Interface Serial0, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to down
router1(config)#router rip //啟用rip協定
router1(config-router)#network 192.168.1.0 //需要給出與本路由器直連的網絡
router1(config-router)#network 192.168.2.0 //此處分别為192.168.1.0和192.168.2.0
router1(config-router)#exit
router1(config)#exit
router1#copy running startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to up
r2的配置:
Router#con terminal
Router(config)#hostname router2
router2(config)#interface s0
router2(config-if)#ip address 192.168.2.2 255.255.255.0
router2(config-if)#no shut
router2(config-if)#interface e0
router2(config-if)#ip address 192.168.3.1 255.255.255.0
router2(config-if)#exit
router2(config)#router rip
router2(config-router)#network 192.168.3.0
router2(config-router)#network 192.168.2.0
router2(config-router)#exit
router2(config)#exit
router2#copy running-config startup-config
router2#ping 192.168.2.1 //試ping一下,完全正确
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
router2#ping 192.168.2.2
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
pc1的配置:
Boson BOSS 5.0
Copyright 1998-2003 Boson Software, Inc.
Use the command help to get started
Press Enter to begin
C:>ipconfig /ip 192.168.1.1 255.255.255.0
C:>ipconfig /dg 192.168.1.2
C:>ping 192.168.3.2
Pinging 192.168.3.2 with 32 bytes of data: //正式開始測試,完全正确
Reply from 192.168.3.2: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.3.2: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 60ms, Average = 55ms
C:>ping 192.168.3.1
Pinging 192.168.3.1 with 32 bytes of data:
Reply from 192.168.3.1: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.3.1: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
C:>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:
Reply from 192.168.2.2: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.2.2: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
C:>ping 192.168.2.1
Pinging 192.168.2.1 with 32 bytes of data:
Reply from 192.168.2.1: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.2.1: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
C:>ping 192.168.1.2
Pinging 192.168.1.2 with 32 bytes of data:
Reply from 192.168.1.2: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.1.2: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
pc2 的配置:
C:>ipconfig /ip 192.168.3.2 255.255.255.0
C:>ipconfig /dg 192.168.3.1
C:>ping 192.168.1.1
Pinging 192.168.1.1 with 32 bytes of data: //正式測試,完全正确
Reply from 192.168.1.1: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.1.1: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Pinging 192.168.3.2 with 32 bytes of data:
C:>
下面是show run檢視的r1的部配置設定置情況:
interface Serial0
ip address 192.168.2.1 255.255.255.0
no ip directed-broadcast
!
interface Ethernet0
ip address 192.168.1.2 255.255.255.0
router rip
network 192.168.1.0
network 192.168.2.0
ip classless
no ip http server
line con 0
transport input none
line aux 0
line vty 0 4
no scheduler allocate
end
show run檢視的r2的部配置設定置情況:
ip address 192.168.2.2 255.255.255.0
ip address 192.168.3.1 255.255.255.0
network 192.168.3.0
不知道這樣能不能看得直覺些,希望大家繼續提出意見,我會一一改進的~~~
本文轉自 victoryan 51CTO部落格,原文連結:http://blog.51cto.com/victoryan/38714