Nguồn: Sách CCNA Labpro
LAB 3-4: GIAO THỨC ĐỊNH TUYẾN RIP
Mô tả và yêu cầu:
- Lab này cấu hình định tuyến IP dùng địa cỉ mạng lớp B (131.108.0.0/16), với subnet mask lớp C (255.255.255.0 hay /24).
- Cấu hình giao thức định tuyến RIP trên R1 và R2 để từ Router ping được tất cả địa chỉ trên mạng.
Cấu hình:
R1:
!
hostname R1
!
interface loopback0
ip address 131.108.4.1 255.255.255.0
exit
!
interface loopback1
ip address 131.108.5.1 255.255.255.0
exit
!
interface loopback2
ip address 131.108.6.1 255.255.255.0
exit
!
interface Ethernet0
ip address 131.108.1.1 255.255.255.0
no shutdown
no keepalive
exit
!
interface Serial0
ip address 131.108.3.1 255.255.255.0
clock rate 64000
no shut
exit
!
router rip
network 131.108.0.0
!
end
!
hostname R1
!
interface loopback0
ip address 131.108.4.1 255.255.255.0
exit
!
interface loopback1
ip address 131.108.5.1 255.255.255.0
exit
!
interface loopback2
ip address 131.108.6.1 255.255.255.0
exit
!
interface Ethernet0
ip address 131.108.1.1 255.255.255.0
no shutdown
no keepalive
exit
!
interface Serial0
ip address 131.108.3.1 255.255.255.0
clock rate 64000
no shut
exit
!
router rip
network 131.108.0.0
!
end
R2:
!
hostname R2
!
interface loopback0
ip address 131.108.7.1 255.255.255.0
exit
!
interface loopback1
ip address 131.108.8.1 255.255.255.0
exit
!
interface loopback2
ip address 131.108.9.1 255.255.255.0
exit
!
interface Ethernet0
ip address 131.108.2.1 255.255.255.0
no shutdown
no keepalive
exit
!
interface Serial0
ip address 131.108.3.2 255.255.255.0
no shut
exit
!
router rip
network 131.108.0.0
!
end
!
hostname R2
!
interface loopback0
ip address 131.108.7.1 255.255.255.0
exit
!
interface loopback1
ip address 131.108.8.1 255.255.255.0
exit
!
interface loopback2
ip address 131.108.9.1 255.255.255.0
exit
!
interface Ethernet0
ip address 131.108.2.1 255.255.255.0
no shutdown
no keepalive
exit
!
interface Serial0
ip address 131.108.3.2 255.255.255.0
no shut
exit
!
router rip
network 131.108.0.0
!
end
Các bước thực hiện:
- Đặt hostname, cấu hình cho các cổng loopback, Ethernet và serial trên R1 và R2.
Đặt Hostname:
Router(config)#hostname R1
R1(config)# _
Router(config)#hostname R2
R2(config)# _
Router(config)#hostname R1
R1(config)# _
Router(config)#hostname R2
R2(config)# _
Xác định thiết bị nào là DCE và DTE:
R1#show controllers S0
Interface Serial0
Hardware is PowerQuiCC MPC860
DCE V.35, no clock
...
R2#show controllers S1
HD unit 0, idb = 0xFBDB0, driver structure at 0x1020C8
buffer size 1524 HD unit 0, V.35 DTE cable
cpb = 0x1, eda = 0x483C, cda = 0x4850
...
R1#show controllers S0
Interface Serial0
Hardware is PowerQuiCC MPC860
DCE V.35, no clock
...
R2#show controllers S1
HD unit 0, idb = 0xFBDB0, driver structure at 0x1020C8
buffer size 1524 HD unit 0, V.35 DTE cable
cpb = 0x1, eda = 0x483C, cda = 0x4850
...
Cấu hình địa chỉ IP cho các cổng của R1:
R1(config)#interface loopback0
R1(conig–if)# ip address 131.108.4.1 255.255.255.0
R1(config–if)#interface loopback1
R1(conig–if)# ip address 131.108.5.1 255.255.255.0
R1(config–if)#interface loopback2
R1(conig–if)# ip address 131.108.6.1 255.255.255.0
R1(conig–if)# exit
R1(config)#interface Ethernet0
R1(conig–if)#ip address 131.108.1.1 255.255.255.0
R1(conig–if)#no shutdown
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
%LINK-5-UPDOWN: Line protocol on Interface Ethernet0, changed state to up
R1(conig–if)#no keepalive
R1(conig–if)# exit
R1(config)#interface Serial0
R1(conig–if)#ip address 131.108.3.1 255.255.255.0
R1(conig–if)#clock rate 128000
R1(conig–if)#no shut
R1(config)#interface loopback0
R1(conig–if)# ip address 131.108.4.1 255.255.255.0
R1(config–if)#interface loopback1
R1(conig–if)# ip address 131.108.5.1 255.255.255.0
R1(config–if)#interface loopback2
R1(conig–if)# ip address 131.108.6.1 255.255.255.0
R1(conig–if)# exit
R1(config)#interface Ethernet0
R1(conig–if)#ip address 131.108.1.1 255.255.255.0
R1(conig–if)#no shutdown
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
%LINK-5-UPDOWN: Line protocol on Interface Ethernet0, changed state to up
R1(conig–if)#no keepalive
R1(conig–if)# exit
R1(config)#interface Serial0
R1(conig–if)#ip address 131.108.3.1 255.255.255.0
R1(conig–if)#clock rate 128000
R1(conig–if)#no shut
Tương tự đối với R2:
R2(config)#interface loopback0
R2(conig–if)# ip address 131.108.7.1 255.255.255.0
R2(config)#interface loopback1
R2(conig–if)# ip address 131.108.8.1 255.255.255.0
R2(config)#interface loopback2
R2(conig–if)# ip address 131.108.9.1 255.255.255.0
R2(config)#interface Ethernet0
R2(conig–if)#ip address 131.108.2.1 255.255.255.0
R2(conig–if)#no shutdown
R2(conig–if)#no keepalive
R2(conig–if)# exit
R2(config)#interface Serial1
R2(conig–if)#ip address 131.108.3.2 255.255.255.0
R2(conig–if)#no shut
R2(config)#interface loopback0
R2(conig–if)# ip address 131.108.7.1 255.255.255.0
R2(config)#interface loopback1
R2(conig–if)# ip address 131.108.8.1 255.255.255.0
R2(config)#interface loopback2
R2(conig–if)# ip address 131.108.9.1 255.255.255.0
R2(config)#interface Ethernet0
R2(conig–if)#ip address 131.108.2.1 255.255.255.0
R2(conig–if)#no shutdown
R2(conig–if)#no keepalive
R2(conig–if)# exit
R2(config)#interface Serial1
R2(conig–if)#ip address 131.108.3.2 255.255.255.0
R2(conig–if)#no shut
- Kiểm tra bảng định tuyến IP trên các Router
R1# show ip route
...
Gateway of last resort is not set
131.108.0.0/24 is subnetted, 5 subnets
C 131.108.6.0 is directly connected, Loopback2
C 131.108.5.0 is directly connected, Loopback1
C 131.108.4.0 is directly connected, Loopback0
C 131.108.3.0 is directly connected, Serial0
C 131.108.1.0 is directly connected, Ethernet0
R2# show ip route
...
Gateway of last resort is not set
131.108.0.0/24 is subnetted, 5 subnets
C 131.108.9.0 is directly connected, Loopback2
C 131.108.8.0 is directly connected, Loopback1
C 131.108.7.0 is directly connected, Loopback0
C 131.108.3.0 is directly connected, Serial1
C 131.108.2.0 is directly connected, Ethernet0
...
Gateway of last resort is not set
131.108.0.0/24 is subnetted, 5 subnets
C 131.108.6.0 is directly connected, Loopback2
C 131.108.5.0 is directly connected, Loopback1
C 131.108.4.0 is directly connected, Loopback0
C 131.108.3.0 is directly connected, Serial0
C 131.108.1.0 is directly connected, Ethernet0
R2# show ip route
...
Gateway of last resort is not set
131.108.0.0/24 is subnetted, 5 subnets
C 131.108.9.0 is directly connected, Loopback2
C 131.108.8.0 is directly connected, Loopback1
C 131.108.7.0 is directly connected, Loopback0
C 131.108.3.0 is directly connected, Serial1
C 131.108.2.0 is directly connected, Ethernet0
- Chạy giao thức định tuyến RIP trên cả hai router:
R1(config)#router rip
R1(config–router)#network 131.108.0.0
R1(config–router)#end
R1#copy run start ← lưu cấu hình vào NVRAM
R2(config)#router rip
R2(config–router)network 131.108.0.0
R2(config–router)#end
R2#copy run start
R1(config–router)#network 131.108.0.0
R1(config–router)#end
R1#copy run start ← lưu cấu hình vào NVRAM
R2(config)#router rip
R2(config–router)network 131.108.0.0
R2(config–router)#end
R2#copy run start
Xem quá trình cập nhật định tuyến trên Router
R1#debug ip rip
RIP protocol debugging is on
R1#debug ip rip events
RIP event debugging is on
R1#debug ip rip
RIP protocol debugging is on
R1#debug ip rip events
RIP event debugging is on
- Xem bảng định tuyến trên R1 và R2:
R1# show ip route
...
Gateway of last resort is not set
131.108.0.0/24 is subnetted, 5 subnets
R 131.108.9.0/24 [120/1] via 131.108.3.2, 00:00:00, Serial0
R 131.108.8.0/24 [120/1] via 131.108.3.2, 00:00:00, Serial0
R 131.108.7.0/24 [120/1] via 131.108.3.2, 00:00:00, Serial0
C 131.108.6.0 is directly connected, Loopback2
C 131.108.5.0 is directly connected, Loopback1
C 131.108.4.0 is directly connected, Loopback0
C 131.108.3.0 is directly connected, Serial0
R 131.108.2.0/24 [120/1] via 131.108.3.2, 00:00:00, Serial0
C 131.108.1.0 is directly connected, Ethernet0
R2# show ip route
...
Gateway of last resort is not set
131.108.0.0/24 is subnetted, 5 subnets
C 131.108.9.0 is directly connected, Loopback2
C 131.108.8.0 is directly connected, Loopback1
C 131.108.7.0 is directly connected, Loopback0
R 131.108.6.0/24 [120/1] via 131.108.3.1, 00:00:00, Serial1
R 131.108.5.0/24 [120/1] via 131.108.3.1, 00:00:00, Serial1
R 131.108.4.0/24 [120/1] via 131.108.3.1, 00:00:00, Serial1
C 131.108.3.0 is directly connected, Serial1
C 131.108.2.0 is directly connected, Ethernet0
R 131.108.1.0/24 [120/1] via 131.108.3.1, 00:00:00, Serial1
...
Gateway of last resort is not set
131.108.0.0/24 is subnetted, 5 subnets
R 131.108.9.0/24 [120/1] via 131.108.3.2, 00:00:00, Serial0
R 131.108.8.0/24 [120/1] via 131.108.3.2, 00:00:00, Serial0
R 131.108.7.0/24 [120/1] via 131.108.3.2, 00:00:00, Serial0
C 131.108.6.0 is directly connected, Loopback2
C 131.108.5.0 is directly connected, Loopback1
C 131.108.4.0 is directly connected, Loopback0
C 131.108.3.0 is directly connected, Serial0
R 131.108.2.0/24 [120/1] via 131.108.3.2, 00:00:00, Serial0
C 131.108.1.0 is directly connected, Ethernet0
R2# show ip route
...
Gateway of last resort is not set
131.108.0.0/24 is subnetted, 5 subnets
C 131.108.9.0 is directly connected, Loopback2
C 131.108.8.0 is directly connected, Loopback1
C 131.108.7.0 is directly connected, Loopback0
R 131.108.6.0/24 [120/1] via 131.108.3.1, 00:00:00, Serial1
R 131.108.5.0/24 [120/1] via 131.108.3.1, 00:00:00, Serial1
R 131.108.4.0/24 [120/1] via 131.108.3.1, 00:00:00, Serial1
C 131.108.3.0 is directly connected, Serial1
C 131.108.2.0 is directly connected, Ethernet0
R 131.108.1.0/24 [120/1] via 131.108.3.1, 00:00:00, Serial1
- Kiểm tra hoạt động bằng cách ping các mạng ở xa (tất cả các lệnh ping phải thành công)
R1#ping 131.108.9.1
R1#ping 131.108.8.1
R1#ping 131.108.7.1
R1#ping 131.108.2.1
R2#ping 131.108.4.1
R2#ping 131.108.5.1
R2#ping 131.108.6.1
R2#ping 131.108.1.1
R1#ping 131.108.8.1
R1#ping 131.108.7.1
R1#ping 131.108.2.1
R2#ping 131.108.4.1
R2#ping 131.108.5.1
R2#ping 131.108.6.1
R2#ping 131.108.1.1
Ví dụ ping thành công:
R1#ping 131.108.9.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 131.108.9.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/32 ms
R1#ping 131.108.9.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 131.108.9.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/32 ms