Static_Route > Cấu hình định tuyến tĩnh

Yêu cầu :
- Cấu hình cơ bản cho Router
- Gán IP cho các Router như hình vẽ
- Sử dụng các lệnh CDP - Cisco Discovery Protocol
- Kiểm tra trước khi định tuyến
- Cấu hình định tuyến tĩnh

Hướng dẫn :
Công việc 1 : Cấu hình cơ bản cho Router
- Thực hiện trên Router 1 :
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R1
R1(config)#no ip domain-lookup
R1(config)#enable password class
R1(config)#line console 0
R1(config-line)#exec-timeout 0 0
R1(config-line)#logging synchronous
R1(config-line)#exit
R1(config)#line vty 0 10
R1(config-line)#password cisco
R1(config-line)#login
R1(config-line)#exit
R1(config)#exit
R1#copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
R1#

- Thực hiện tương tự cho Router 2Router 3

Công việc 2 : Gán IP cho các Router

- Thực hiện trên Router 1 :

R1(config)#int fa0/0
R1(config-if)#ip address 172.16.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#

- Thực hiện trên Router 2 :

R2(config)#int fa0/1
R2(config-if)#ip address 172.16.1.254 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit

R2(config)#int fa0/0
R2(config-if)#ip address 10.10.10.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#

- Thực hiện trên Router 3 :

R3(config)#int fa0/1
R3(config-if)#ip address 10.10.10.254 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#

- Dùng lệnh show ip int brief để kiểm tra việc gán IP và trạng thái của các cổng
Công việc 3 :  Sử dụng các lệnh CDP

Cisco Discovery Protocol (CDP) là giao thức riêng của Cisco dùng để thu thập thông tin về các thiết bị lân cận. Khi sử dụng giao thức CDP, ta có thể biết được thông tin phần cứng, phần mềm của các thiết bị gần kề. Thông tin này rất hữu ích trong quá trình xử lý sự cố hay kiểm soát các thiết bị trong hệ thống mạng. Mặc định, các thiết bị Cisco đã cho phép chạy giao thức CDP, nên khi dùng lệnh show run thông tin về CDP sẽ không được hiển thị   

- Thực hiện trên Router 2 : (Router 1 và Router 3 thực hiện tương tự)

Để xem thông tin về các thông số thời gian của CDP, dùng lệnh show cdp
R2#show cdp
Global CDP information:
    Sending CDP packets every 60 seconds
    Sending a holdtime value of 180 seconds
    Sending CDPv2 advertisements is enabled

Holdtime : là khoảng thời gian thiết bị giữ gói tin mà nó nhận được từ láng giềng

Lệnh show cdp neighbors hiện thông tin về thiết bị nối trực tiếp
R2#show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
Device ID     Local Intrfce   Holdtme    Capability   Platform     Port ID
R1                 Fas 0/1            141                  R           C2800        Fas 0/0
R3                 Fas 0/0            141                  R           C2800        Fas 0/1

Local Interface : Interface của Router mình dùng để nối đến Router láng giềng
Port ID : Interface của Router láng giềng dùng để nối với Router của mình

R2#show cdp neighbors detail

Device ID: R1
Entry address(es):
  IP address : 172.16.1.1
Platform: cisco C2800, Capabilities: Router
Interface: FastEthernet0/1, Port ID (outgoing port): FastEthernet0/0
Holdtime: 172
Version :
Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Wed 18-Jul-07 06:21 by pt_rel_team
advertisement version: 2
Duplex: full
---------------------------

Device ID: R3
Entry address(es):
  IP address : 10.10.10.254
Platform: cisco C2800, Capabilities: Router
Interface: FastEthernet0/0, Port ID (outgoing port): FastEthernet0/1
Holdtime: 172
Version :
Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Wed 18-Jul-07 06:21 by pt_rel_team
advertisement version: 2
Duplex: full

ð Yêu cầu học viên thực hiện : Đứng tại một Router telnet đến các Router còn lại và thực hiện các lệnh cdp, các lệnh show cần thiết để vẽ ra một sơ đồ mạng đầy đủ như là : địa chỉ IP, tên của các Router, tên của các cổng đang hoạt động nối các Router với nhau …

Công việc 4 : Kiểm tra trước khi định tuyến

ð Thực hiện các lệnh ping trước khi định tuyến
Router 1 ping  172.16.1.254 : OK
Router 1 ping  10.10.10.1 : không được

Router 3 ping  10.10.10.1 : OK
Router 3 ping  172.16.1.254 : không được

Router 2 ping 172.16.1.1 : OK
Router 2 ping 10.10.10.254 : OK

ð Kiểm tra bảng Routing trước khi định tuyến

- Thực hiện trên Router 1 :

R1#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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

     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, FastEthernet0/0

- Thực hiện trên Router 2 :

R2#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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
C       10.10.10.0 is directly connected, FastEthernet0/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, FastEthernet0/1

- Thực hiện trên Router 3 :

R3#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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
C       10.10.10.0 is directly connected, FastEthernet0/1
Công việc 5 : Cấu hình định tuyến tĩnh

ð Cấu hình định tuyến tĩnh cho Router 1 (Next Hop)

R1(config)#ip route 10.10.10.0 255.255.255.0 172.16.1.254

ð Cấu hình định tuyến tĩnh cho Router 3 (Outgoing Interface)

R3(config)#ip route 172.16.1.0 255.255.255.0 fastEthernet 0/1

Lưu ý : cổng Fastethernet 0/1 ở câu lệnh trên là cổng đi ra của Router 3 - nằm trên Router 3

ð Kiểm tra bảng Routing sau khi định tuyến

- Thực hiện trên Router 1 :

R1#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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
S       10.10.10.0 [1/0] via 172.16.1.254
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, FastEthernet0/0

Lưu ý : S biểu thị cho kết nối Static với AD=1 khi ta chọn định tuyến Next hop và Hop count là 0 [1/0]   ( [AD/Hop count] )

- Thực hiện trên Router 3 :

R3#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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
C       10.10.10.0 is directly connected, FastEthernet0/1
     172.16.0.0/24 is subnetted, 1 subnets
S       172.16.1.0 is directly connected, FastEthernet0/1

Lưu ý : AD=0 khi ta chọn Outgoing interface để cấu hình Static route. Ở đây ta không thấy entry [1/0] trong cấu hình.

ð Thực hiện các lệnh ping sau khi định tuyến
Router 1 ping Router 3 : OK

R1#ping 10.10.10.254

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

Router 3 ping Router 1 : OK

R3#ping 172.16.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 47/59/63 ms
Download