View Single Post
Tuổi 11-08-2009, 10:59 PM   #1
adminphuong
Administrator
 
Avatar của adminphuong
 
Gia nhập: Jul 2009
Trả Lời: 152
Cấu hình RIP cơ bản
Cấu hình RIP cơ bản



Mô tả & yêu cầu

–Router A, B, C sử dụng RIP để quảng cáo thông tin định tuyến
–Router B hoạt động như DCE cung cấp xung clock cho router A và C
–Các router cấu hình RIP và quảng cáo tất cả các mạng nối trực tiếp.
–Từ router A, B và C, ta ping được hết các địa chỉ trong mạng.

Cấu hình
Router A
!
hostname Router A
no ip domain-lookup
!
interface Loopback0 ← Định nghĩa interface ảo để làm điểm kiểm tra
ip address 10.1.1.1 255.255.255.0
!
interface Ethernet0
ip address 148.1.1.1 255.255.255.0
no shutdown
no keepalive ← cho phép cổng Ethernet vẫn up khi không kết nối với bên ngoài
!
interface Serial0
ip address 192.1.1.1 255.255.255.0
no shutdown
!
router rip ← kích hoạt quá trình định tuyến RIP trên router
network 10.0.0.0 ← chỉ ra mạng sẽ quảng cáo và xác định interface nào sẽ gởi và nhận thông tin định tuyến RIP
network 148.1.0.0
network 192.1.1.0
!
no ip classless
!
end

Router B
!
hostname RouterB
no ip domain-lookup
!
interface Serial0
ip address 192.1.1.2 255.255.255.0
clock rate 64000 ← hoạt động như DCE cung cấp xung clock
no shutdown
!
interface Serial1
ip address 193.1.1.1 255.255.255.0
clock rate 64000 ← hoạt động như DCE cung cấp xung clock
no shutdown
!
router rip
network 192.1.1.0
network 193.1.1.0
!
end

+ Để xác định router nào cung cấp xung clock tức là thiết bị DCE dùng câu lệnh: show controller [type number]

Router C
!
hostname RouterC
no ip domain-lookup
!
interface Ethernet0
ip address 152.1.1.1 255.255.255.0
no shutdown
no keepalive ← vô hiệu hóa keepalive trên router cho phép interface ethernet0 vẫn up khi không kết nối ra bên ngoài
!
interface Serial0
ip address 193.1.1.2 255.255.255.0
no shutdown
!
router rip
network 152.1.0.0
network 193.1.1.0
!
no ip classless
!
end

Các bước thực hiện
Đặt hostname, đặt địa chỉ IP cho các cổng Loopback, Serial, Ethernet
Đối với RouterA

Router>en
Router#config terminal
Router(config)#hostname RouterA

RouterA(config)#interface Loopback
RouterA(config–if)# ip address 10.1.1.1 255.255.255.0
RouterA(config–if)#exit

RouterA(config)#interface Ethernet0
RouterA(config–if)#ip address 148.1.1.1 255.255.255.0
RouterA(config–if)#no shutdown
RouterA(config–if)#no keepalive
RouterA(config–if)#exit

RouterA(config)#interface Serial0
RouterA(config–if)#ip address 192.1.1.1 255.255.255.0
RouterA(config–if)#no shutdown
RouterA(config–if)#end
RouterA#

Cấu hình tương tự đối với RouterB và RouterC. Lưu ý tại RouterB có lệnh clock rate khi cấu hình cổng Serial.

RouterB(config)#interface Serial0
RouterB(config–if)#ip address 192.1.1.2 255.255.255.0
RouterB(config–if)#clock rate 64000
RouterB(config–if)#no shutdown

RouterB(config–if)#interface Serial1
RouterB(config–if)#ip address 193.1.1.1 255.255.255.0
RouterB(config–if)#clock rate 64000
RouterB(config–if)#no shutdown
RouterB(config–if)#end
RouterB#

Kiểm tra hoạt động cổng Serial tại các router bằng lệnh show interface [Type Number]

RouterA#show interface Serial0
Serial0 is up, line protocol is up
Hardware is HD64570
Internet address is 192.1.1.1/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set
Keepalive set (10 sec)
Last input 00:00:06, output 00:00:08, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: weighted fair
Output queue: 0/1000/64/0 (size/max total/threshold/drops)
Conversations 0/3/256 (active/max active/max total)
Reserved Conversations 0/0 (allocated/max allocated)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
489 packets input, 30563 bytes, 0 no buffer
Received 473 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
524 packets output, 33973 bytes, 0 underruns
0 output errors, 0 collisions, 26 interface resets
0 output buffer failures, 0 output buffers swapped out
15 carrier transitions
--More—-

RouterB#sh int s0
Serial0 is up, line protocol is up
Hardware is HD64570
Internet address is 192.1.1.2/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set
...
RouterB#show interface serial1
Serial1 is up, line protocol is up
Hardware is HD64570
Internet address is 193.1.1.1/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set
...

RouterC#show interface Serial0
Serial0 is up, line protocol is up
Hardware is HD64570
Internet address is 193.1.1.2/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set
...
Chạy giao thức định tuyến RIP trên mỗi router

RouterA(config)#router rip
RouterA(config–router)#network 10.0.0.0
RouterA(config–router)#network 148.1.0.0
RouterA(config–router)#network 192.1.1.0

RouterB(config)#router rip
RouterB(config–router)#network 192.1.1.0
RouterB(config–router)#network 193.1.1.0

RouterC(config)#router rip
RouterC(config–router)#network 152.1.0.0
RouterC(config–router)#network 193.1.1.0

Kiểm tra
Xem bảng định tuyến bằng lệnh show ip route

RouterA# show ip route
...
Gateway of last resort is not set
10.0.0.0 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Loopback0
148.1.0.0/24 is subnetted, 1 subnets
C 148.1.1.0 is directly connected, Ethernet0
R 152.1.0.0/16 [120/2] via 192.1.1.2, 00:00:20, Serial0
C 192.1.1.0/24 is directly connected, Serial0
R 193.1.1.0/24 [120/1] via 192.1.1.2, 00:00:20, Serial0

+ Dùng lệnh show ip route rip nếu chỉ muốn xem các route học từ RIP.

RouterA# show ip route rip
R 152.1.0.0/16 [120/2] via 192.1.1.2, 00:00:20, Serial0
R 193.1.1.0/24 [120/1] via 192.1.1.2, 00:00:20, Serial0

Từ router ping các địa chỉ trên mạng

RouterC#ping 192.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.1.1.1 timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms

RouterC#ping 192.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.1.1.2 timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms

RouterA#ping 148.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 148.1.1.1 timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms

RouterC#ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1 timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms

Ta có thể xem quá trình cập nhật định tuyến của RIP bằng cách dùng lệnh debug ip rip. Chú ý tại cổng serial0, RouterA không quảng cáo network học từ RouterB (152.1.0.0 và 193.1.1.0) nhưng ở các router còn lại các network này được quảng cáo. Đây là hoạt động của cơ chế split horizon: khi split horizone hoạt động, router sẽ không quảng cáo route ngược trở lại nơi nó đến.

RouterA#debug ip rip
RIP: sending v1 update to 255.255.255.255 via Ethernet0 (148.1.1.1)
network 10.0.0.0, metric 1
network 152.1.0.0, metric 3
network 192.1.1.0, metric 1
network 193.1.1.0, metric 2
RIP: sending v1 update to 255.255.255.255 via Loopback0 (10.1.1.1)
network 148.1.0.0, metric 1
network 152.1.0.0, metric 3
network 192.1.1.0, metric 1
network 193.1.1.0, metric 2
RIP: sending v1 update to 255.255.255.255 via Serial0 (192.1.1.1)
network 10.0.0.0, metric 1
network 148.1.0.0, metric 1

Khi debug chạy, router sẽ đưa ra thông tin định tuyến RIP, để ngừng debug dùng lệnh:

RouterA#undebug all

Vô hiệu hoá split horizon tại RouterA dùng lệnh tại interface mode

RouterA(config)#int s0
RouterA(config–if)#no ip split–horizon

Lúc này, để kiểm tra thông tin định tuyến tại RouterA dùng lệnh debug ip rip. Thông tin xuất hiện dưới đây (chú ý tất cả các route được quảng cáo ra cổng serial , bao gồm cả các route học từ RouterB và RouterC):

RouterA#debug ip rip
RIP: sending v1 update to 255.255.255.255 via Ethernet0 (148.1.1.1)
network 10.0.0.0, metric 1
network 152.1.0.0, metric 3
network 192.1.1.0, metric 1
network 193.1.1.0, metric 2
RIP: sending v1 update to 255.255.255.255 via Loopback0 (10.1.1.1)
network 148.1.0.0, metric 1
network 152.1.0.0, metric 3
network 192.1.1.0, metric 1
network 193.1.1.0, metric 2
RIP: sending v1 update to 255.255.255.255 via Serial0 (192.1.1.1)
network 10.0.0.0, metric 1
network 148.1.0.0, metric 1
network 152.1.0.0, metric 3
network 192.1.1.0, metric 1
network 193.1.1.0, metric 2
__________________
Theo: Viet Professionals Co. Ltd. VnPro ®

adminphuong vắng mặt   Trả lời ngay kèm theo trích dẫn này