Router_Basic > Cấu hình cơ bản cho router

CẤU HÌNH CƠ BẢN CHO ROUTER
Yêu cầu
- Kết nối cáp console (rolled-over) với router và bật công tắt nguồn cho router
- Dùng Hyper Terminal để kết nối với router
- Đăng nhập vào các mode của router
- Xoá cấu hình hiện có của router
- Đặt các loại mật khẩu truy cập
- Mã hóa mật khẩu và đặt mật khẩu secret
- Cấu hình cơ bản cho router
Hướng dẫn Công việc 1 :Kết nối cáp console và bật công tắt nguồn cho router.
Công việc 2 :Dùng Hyper Terminal để kết nối với router.
Công việc 3 :Đăng nhập vào các mode của router.
Sau khi khởi động router ta sẽ nhận được thông báo như sau :
--- System Configuration Dialog --- Continue with configuration dialog? [yes/no]:
Có nghĩa là : bạn có muốn cấu hình router theo các câu hỏi hướng dẫn hay không ? chỗ này chúng ta chọn no bằng cách gõ phím n sau đó enter
Continue with configuration dialog? [yes/no]: n
Press RETURN to get started! Router>

- Tiếp theo chúng ta sẽ vào được user mode : Router> User mode là mode có quyền hạn sử dụng thấp nhất ta chỉ có thể thực hiện một số lệnh cơ bản, đứng ở mode này ta không thể cấu hình cũng như xem được cấu hình hiện có của router
- Từ user mode muốn vào privilege mode : Router#
ta gõ enable
Router>enable
Router#
- Từ Privilege mode muốn vào config mode :Router(config)#
ta gõconfigure terminalhay có thể gõ tắt làconf t
Router#configure terminal
Router(config)#

- Từ config mode muốn trở về privilege mode có 3 cách : Router(config)#exit
Router#
hoặc Router(config)#end
Router#
hoặc Router(config)#ctrl + z
Router#
- Từ privilege mode muốn trở về user mode có 2 cách : Router#exit
Router>
hoặc Router#disable
Router>
Công việc 4 : Xoá cấu hình hiện có của router.
Để xoá cấu hình của router đứng ở privilege mode thực hiện câu lệnh Router#erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm] [OK]
Erase of nvram: complete
Router#

Tiếp theo ta khởi động lại router bằng cách gõ lệnh : Router#reload
Proceed with reload? [confirm]
%SYS-5-RELOAD: Reload requested by console. Reload Reason: Reload Command.
System Bootstrap, Version 12.3(8r)T8, RELEASE SOFTWARE (fc1)
Cisco 1841 (revision 5.0) with 114688K/16384K bytes of memory.
Self decompressing the image :
########################################################################## [OK]
Restricted Rights Legend
Và chúng ta thực hiện lại việc đăng nhập router như đã hướng dẫn ở công việc 3
Công việc 5 : Đặt các loại mật khẩu truy cập
Mật khẩu có phân biệt chữ hoa hay chữ thường, không quá 25 ký tự, có thể dùng
khoảng trắng trong mật khẩu. Tuy nhiên ký tự đầu tiên của mặt khẩu không được là khoảng trắng.

ð Đặt password khi đăng nhập vào privilege mode :
giả sử ta đặt password là cisco thì ta thực hiện câu lệnh sau đây ở mode config
Router(config)#enable password cisco
Lưu ý :
từ user mode vào privilege mode sẽ có hỏi password nếu ta thực hiện câu lệnh trên, nhưng từ privilege mode vào config mode thì luôn luôn không có hỏi password
ð Đặt password cho cổng console :
giả sử ta đặt password là vdc thì ta thực hiện câu lệnh sau đây ở mode config
Router(config)#line console 0
Router(config-line)#password vdc
Router(config-line)#login
Router(config-line)#exit
Router(config)#

ð Lưu lại cấu hình khi có sự thay đổi
Thực hiện ở privilege mode
Router#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
Router#


hoặc có thể gõ tắt như sau
Router#copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
Router#


hoặc có thể gõ ngắn gọn hơn là
Router#wr
Building configuration...
[OK]
Router#

ð Kiểm tra lại tác dụng của các loại mật khẩu vừa đặt
- Khởi động lại router bằng câu lệnh reload ở privilege mode :
Router#reload
Sau khi khởi động xong chúng ta sẽ bị hỏi password của cổng console
Gõ vào vdc
Ta sẽ vào được user mode, từ user mode muốn vào privilege mode ta phải gõ tiếp
password là cisco, từ privilege mode muốn vào config mode ta không bị hỏi password
Công việc 6 : Mã hóa mật khẩu và đặt mật khẩu secret

ð Kiểm tra các loại mật khẩu đã đặt ở trên bằng cách xem cấu hình hiện đang chạy của router.
- Thực hiện ở privilege mode :
Router#show running-config
hoặc có thể gõ ngắn gọn hơn
Router#show run

Building configuration...
Current configuration : 402 bytes
!
version 12.4
no service password-encryption
!
hostname Router
!
enable password cisco
!
ip ssh version 1
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
ip classless
!
line con 0
password vdc
login

line vty 0 4
login
!
end
ð Mã hoá password
Ta mã hoá tất cả password dạng clear-text trong router theo thuật toán MD7
Router(config)#service password-encryption
ð Kiểm tra lại cấu hình sau khi mã hoá
Router#show run
Building configuration...
Current configuration : 415 bytes
!
version 12.4
service password-encryption
!
hostname Router
!
enable password 7 0822455D0A16
!
ip ssh version 1
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
ip classless
!
line con 0
password 7 0837484D
login

line vty 0 4
login
!
end
ð Đặt mật khẩu Secret
Giả sử ta đặt password secret là vip thì mặc định password này sẽ được mã hoá theo thuật toán MD5
Router(config)#enable secret vip
Lưu ý :
Lúc này password mà ta đã đặt khi đăng nhập vào privilege mode bằng câu lệnh :
Router(config)#enable password cisco
sẽ không được ưu tiên bằng password vip . Do đó khi nhập vào mode privilege ta phải gõ password là vip , nếu ta gõ là cisco thì nó không vào được

ð Kiểm tra lại cấu hình sau khi đặt mật khẩu Secret

Router#show run
Building configuration...
Current configuration : 462 bytes
!
version 12.4
service password-encryption
!
hostname Router
!
enable secret 5 $1$mERr$leLpNmH/lVzjPN.O9z69n0
enable password 7 0822455D0A16

!
ip ssh version 1
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
ip classless
!
line con 0
password 7 0837484D
line vty 0 4

login
!
end
login
Công việc 7 : Cấu hình cơ bản cho router
ð Đặt tên cho router
Router(config)#hostname xuantung
RA(config)#

ð Tắt cơ chế dò tìm tên miền của router
RA(config)#no ip domain-lookup
ð Ngăn ngừa việc ngắt console sau 120 giây bằng cách tắt cơ chế timeout console
RA(config)#line console 0
RA(config-line)#exec-timeout 0 0
RA(config-line)#exit
RA(config)#

ð Lưu lại cấu hình
RA#copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
RA#

Khi kết thúc bài thực hành học viên phải xoá cấu hình do mình tạo ra trong quá trình thực hành bằng câu lệnh
Lưu ý :
RA#erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete
RA#reload
Proceed with reload? [confirm]
%SYS-5-RELOAD: Reload requested by console. Reload Reason: Reload Command.
System Bootstrap, Version 12.3(8r)T8, RELEASE SOFTWARE (fc1)
Cisco 1841 (revision 5.0) with 114688K/16384K bytes of memory.

chức các bạn thành công !!!!

Lab OSPF > Cấu hình cơ bản của OSPF 1

Yêu cầu
-          Thực hiện các cấu hình cơ bản cho mỗi router
-          Cấu hình định tuyến trên tất cả các router
-          Cấu hình thay đổi Router-ID
-          Thực hiện các lệnh show kiểm tra hoạt động của OSPF
-          Cấu hình COST trong ospf
-          Cấu hình thay đổi thời gian Hello-interval và Dead-interval
Hướng dẫn
Công việc 1 :  Thực hiện các cấu hình cơ bản cho mỗi router.
Công việc 2Cấu hình định tuyến trên tất cả các router.
- Gán IP cho các interface như hình vẽ
- Bật OSPF bằng 2 cách :
Cách 1 Cấu hình quảng bá đường mạng (network/subnet work)
Router1(config)#router ospf 1
Router1(config-router)#network 172.16.1.16 0.0.0.15 area 0
Router1(config-router)#network 192.168.10.0 0.0.0.3 area 0
Router1(config-router)#network 192.168.10.4 0.0.0.3 area 0
Cách 2 Cấu hình trực tiếp đến IP của từng cổng
Router1(config)#router ospf 1
Router1(config-router)#network 172.16.1.17 0.0.0.0 area 0
Router1(config-router)#network 192.168.10.1 0.0.0.0 area 0
Router1(config-router)#network 192.168.10.5 0.0.0.0 area 0

- Cấu hình tương tự cho router 2 và router 3
Công việc 3Cấu hình thay đổi Router ID
Số Router ID của giao thức OSPF là duy nhất cho mỗi router tham gia vào định tuyến OSPF. Router ID có dạng của một địa chỉ IP. Các router Cisco được cấp Router ID bởi một trong ba cách sau đây (xếp theo độ ưu tiên từ cao đến thấp)
1. Gán bằng lệnh router-id.
Router1(config)#router ospf 1
Router1(config-router)#router-id 1.1.1.1
2. Địa chỉ IP cao nhất trong các địa chỉ IP loopback của router.
3. Địa chỉ IP cao nhất trong các địa chỉ IP của các cổng đang ở trạng thái active.
ð Sau khi thay đổi router-id để có tác dụng lên router ta phải :
-          khởi động lại router bằng lệnh reload
-          hoặc chạy lệnh : clear ip ospf process (chọn yes)
ð Router ID được hiển thị trong kết quả xuất ra của các câu lệnh  :
#show ip protocols
#show  ip ospf
#show ip ospf interface

ð Tưong tự router id của router 2, router 3 là : 2.2.2.23.3.3.3

Router1#show ip protocols
Routing Protocol is "ospf 1"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Router ID 1.1.1.1
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    172.16.1.16 0.0.0.15 area 0
    192.168.10.0 0.0.0.3 area 0
    192.168.10.4 0.0.0.3 area 0
  Routing Information Sources: 
    Gateway         Distance      Last Update
    192.168.10.6         110      00:11:46
    192.168.10.2         110      00:11:46
  Distance: (default is 110)

Router1#show ip ospf
 Routing Process "ospf 1" with ID 1.1.1.1
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
 Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
 Number of external LSA 1. Checksum Sum 0x00fecf
 Number of opaque AS LSA 0. Checksum Sum 0x000000
 Number of DCbitless external and opaque AS LSA 0
 Number of DoNotAge external and opaque AS LSA 0
 Number of areas in this router is 1. 1 normal 0 stub 0 nssa
 External flood list length 0
    Area BACKBONE(0)
        Number of interfaces in this area is 3
        Area has no authentication
        SPF algorithm executed 3 times
        Area ranges are
        Flood list length 0

Router1#show ip ospf interface
FastEthernet0/0 is up, line protocol is up
  Internet address is 172.16.1.17/28, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1
  Transmit Delay is 1 sec, State DR, Priority 1
  Designated Router (ID) 1.1.1.1, Interface address 172.16.1.17
  No backup designated router on this network
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:00
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 1
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 0, Adjacent neighbor count is 0
  Suppress hello for 0 neighbor(s)
Serial0/0/1 is up, line protocol is up
  Internet address is 192.168.10.5/30, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type POINT-TO-POINT, Cost: 64
  Transmit Delay is 1 sec, State POINT-TO-POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:00
  Index 2/2, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 1
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 1 , Adjacent neighbor count is 1
    Adjacent with neighbor 192.168.10.6
  Suppress hello for 0 neighbor(s)
Serial0/0/0 is up, line protocol is up
  Internet address is 192.168.10.1/30, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type POINT-TO-POINT, Cost: 64
  Transmit Delay is 1 sec, State POINT-TO-POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:01
  Index 3/3, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 1
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 1 , Adjacent neighbor count is 1
    Adjacent with neighbor 192.168.10.2
  Suppress hello for 0 neighbor(s)

Công việc 4Thực hiện các lệnh show kiểm tra hoạt động của OSPF

Router1#show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/-          00:00:39    192.168.10.6    Serial0/0/1
2.2.2.2           1   FULL/-          00:00:39    192.168.10.2    Serial0/0/0

Lưu ý : trong kết quả ở trên
Neighbor ID : router-id của các láng giềng.
Pri : Priority=1 (mặc định)
State : trạng thái kết nối FULL.
Dead Time : 40 giây.
Address : địa chỉ IP của nexthop (IP của láng giềng).
Interface : Interface của router mình nối với láng giềng.

Router1#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 0.0.0.0 to network 0.0.0.0
     1.0.0.0/32 is subnetted, 2 subnets
C       1.0.0.1 is directly connected, Loopback1
C       1.1.1.1 is directly connected, Loopback0
     10.0.0.0/24 is subnetted, 1 subnets
O       10.10.10.0 [110/65] via 192.168.10.2, 00:53:29, Serial0/0/0
     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C       172.16.1.16/28 is directly connected, FastEthernet0/0
O       172.16.1.32/29 [110/65] via 192.168.10.6, 00:00:10, Serial0/0/1
    192.168.10.0/30 is subnetted, 3 subnets
C       192.168.10.0 is directly connected, Serial0/0/0
C       192.168.10.4 is directly connected, Serial0/0/1
O       192.168.10.8 [110/128] via 192.168.10.2, 00:01:01, Serial0/0/0
                                [110/128] via 192.168.10.6, 00:00:10, Serial0/0/1
Lưu ýTrong bảng routing trên ta thấy để đi đến mạng 192.168.10.8 ta có 2 đường đi với cost bằng nhau và bằng 128

Công việc 5 :   Cấu hình COST trong ospf
ð Để hiển thị Cost ta có thể dùng một trong các lệnh ở bên trên là :
#show ip ospf interface
#show ip route
#show ip route ospf

Router1#show ip ospf interface
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1
………
Serial0/0/1 is up, line protocol is up
  Internet address is 192.168.10.5/30, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type POINT-TO-POINT, Cost: 64

Router1#show ip route
O       10.10.10.0 [110/65] via 192.168.10.2, 00:53:29, Serial0/0/0
….
O       172.16.1.32/29 [110/65] via 192.168.10.6, 00:00:10, Serial0/0/1
….
O       192.168.10.8 [110/128] via 192.168.10.2, 00:01:01, Serial0/0/0
                                [110/128] via 192.168.10.6, 00:00:10, Serial0/0/1

Router1#show ip route ospf
     10.0.0.0/24 is subnetted, 1 subnets
O       10.10.10.0/24 [110/65] via 192.168.10.2, 01:06:56, Serial0/0/0
     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
O       172.16.1.32/29 [110/65] via 192.168.10.6, 00:13:38, Serial0/0/1
     192.168.10.0/30 is subnetted, 3 subnets
O       192.168.10.8/30 [110/128] via 192.168.10.2, 00:14:29, Serial0/0/0
                                     [110/128] via 192.168.10.6, 00:13:38, Serial0/0/1

Để thay đổi cost ta có thể thực hiện 1 trong 2 cách sau
Cách 1  Thay đổi bandwidth (băng thông)
ð Sử dụng lệnh show interfaces serial [số thứ tự cổng] để xem băng thông
Router1#show interfaces serial 0/0/0
Serial0/0/0 is up, line protocol is up (connected)
  Hardware is HD64570
  Internet address is 192.168.10.1/30
  MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, rely 255/255, load 1/255
  Encapsulation HDLC, loopback not set, keepalive set (10 sec)
  Last input never, output never, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0 (size/max/drops); Total output drops: 0
  Queueing strategy: weighted fair
  Output queue: 0/1000/64/0 (size/max total/threshold/drops)
     Conversations  0/0/256 (active/max active/max total)
     Reserved Conversations 0/0 (allocated/max allocated)
  5 minute input rate 64 bits/sec, 0 packets/sec
  5 minute output rate 64 bits/sec, 0 packets/sec
  DCD=up  DSR=up  DTR=up  RTS=up  CTS=up
Lưu ý :  Trên các cổng serial bandwidth mặc định là 1544 kb/s
ð Sử dụng lệnh bandwidth trong mode interface để thay đổi bandwidth
Router1(config)#interface s0/0/0
Router1(config-if)#bandwidth 64
- Sau khi thực hiện lệnh trên cost của đường serial bây giờ là 108/64000(b/s)=1562
- Dùng lệnh show ip ospf interface để xem lại giá trị cost
Cách 2   Sử dụng lệnh ip ospf cost trong mode interface để cấu hình cost trên router
Ta cấu hình thay đổi cost cho router 3
Router3(config)#interface s0/1/0
Router3(config-if)#ip ospf cost 1562
Lưu ý
Sau khi thay đổi cost ta thấy để đi đến mạng 192.168.10.8 từ router1 ta có 2 đường đi với cost khác nhau và như vậy chỉ có đường với giá trị cost thấp mới được đưa vào bảng định tuyến. (dùng lệnh show ip route để kiểm tra lại)

Công việc 6   Cấu hình thay đổi thời gian Hello-interval và Dead-interval
Lưu ý :  Hello timer và Dead timer phải giống nhau trên 2 đầu của 2 router thì quan hệ láng giềng mới được thiết lập cho 2 router này.
- Ta muốn thay đổi hello=5 giây, dead=20 giây thì thực hiện như sau :
Router1(config)#interface s0/0/1
Router1(config-if)#ip ospf hello-interval 5
Router1(config-if)#ip ospf dead-interval 20
- Ta phải thực hiện lệnh trên ở cả 2 router nối với nhau thì mới có thể thiết lập quan hệ láng giềng.
- Dùng lệnh show ip ospf interface serial 0/0/1 để xem giá trị hellodead.   

Cấu hình xác thực cho phép Router xem xét nguồn gốc của các thông tin định tuyến nhận được.
Quy trình bầu chọn DR và BDR bắt đầu ngay khi router đầu tiên có cổng được bật lên trên mạng multiaccess

Lab OSPF > Cấu hình OSPF trên mạng Mulitaccsess

Yêu cầu :
- Thực hiện cấu hình cơ bản cho các router.
- Gán IP cho các interface như hình vẽ.
- Cấu hình định tuyến OSPF trên tất cả các router.
- Kiểm tra hoạt động của OSPF.
- Cấu hình thay đổi priority để bầu chọn lại DR và BDR.
- Sau khi đã bầu chọn lại DR và BDR,  ta cho shutdown router DR và quan sát xem router BDR có được nâng lên làm DR hay không ?

Hướng dẫn :
Cộng việc 1 :  Thực hiện cấu hình cơ bản cho các router.
Công việc 2 :  Gán IP cho các interface như hình vẽ.
Công việc 3 :  Cấu hình định tuyến OSPF trên tất cả các router.

Quy trình bầu chọn DR và BDR bắt đầu ngay khi router đầu tiên có cổng được bật lên trên mạng multiaccess. Điều này xảy ra khi router bật nguồn và câu lệnh network cho cổng đó được cấu hình. Nếu một router gia nhập mạng sau khi đã bầu chọn DR và BDR thì nó sẽ không thể trở thành DR hoặc BDR cho dù nó có số priority trên cổng hoặc router ID cao hơn router DR hoặc BDR hiện hành. Chúng ta phải cấu hình trên router có số router ID cao nhất trước để đảm bảo router này sẽ trở thành DR.
ð Cấu hình cho Router 3 trước
Vì router 3 có cổng loopback có IP cao hơn các router còn lại nên router-id của nó là cao nhất.
Router3(config)#router ospf 1
Router3(config-router)#network 192.168.1.0 0.0.0.255 area 0
Router3(config-router)#network 172.16.3.0 0.0.0.255 area 0
Router3(config-router)#end

ð Sử dụng lệnh show ip ospf  interface
để xác nhận OSPF đã được cấu hình đúng và Router3 chính là DR.
Router3#show ip ospf  interface
FastEthernet0/0 is up, line protocol is up
  Internet address is 192.168.1.3/24, Area 0
  Process ID 1, Router ID 192.168.31.33, Network Type BROADCAST, Cost: 1
  Transmit Delay is 1 sec, State DR, Priority 1
  Designated Router (ID) 192.168.31.33, Interface address 192.168.1.3
  Backup Designated Router (ID) 192.168.31.22, Interface address 192.168.1.2
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
FastEthernet0/1 is up, line protocol is up
  Internet address is 172.16.3.1/24, Area 0
  Process ID 1, Router ID 192.168.31.33, Network Type BROADCAST, Cost: 1
  Transmit Delay is 1 sec, State DR, Priority 1
  Designated Router (ID) 192.168.31.33, Interface address 172.16.3.1
  No backup designated router on this network
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
  Suppress hello for 0 neighbor(s)

ð Thực hiện tương tự như vậy lần lượt cho các router2 và router1

Công việc 4 :  Kiểm tra hoạt động của OSPF.
ð Thực hiện lệnh show ip ospf neighbor
Router1#show ip ospf neighbor
Neighbor ID     Pri   State                 Dead Time     Address          Interface
192.168.31.33     1     FULL/DR         00:00:32         192.168.1.3     FastEthernet0/0
192.168.31.22     1     FULL/BDR      00:00:32         192.168.1.2     FastEthernet0/0
Quan sát kết quả ở trên ta thấy láng giềng của router 1 là router 3 (router-id cao nhất 192.168.31.33) ở trạng thái DR và router 2 (router-id cao thứ nhì 192.168.31.22) ở trạng thái BDR

ð Thực hiện lệnh show ip route
Router1#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, 3 subnets
C       172.16.1.0 is directly connected, FastEthernet0/1
O       172.16.2.0 [110/2] via 192.168.1.2, 00:48:14, FastEthernet0/0
O       172.16.3.0 [110/2] via 192.168.1.3, 00:48:14, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
     192.168.31.0/32 is subnetted, 1 subnets
C       192.168.31.11 is directly connected, Loopback0

ð Thực hiện lệnh show ip route ospf
Router1#show ip route ospf
     172.16.0.0/24 is subnetted, 3 subnets
O       172.16.2.0/24 [110/2] via 192.168.1.2, 00:02:47, FastEthernet0/0
O       172.16.3.0/24 [110/2] via 192.168.1.3, 00:02:58, FastEthernet0/0

Công việc 5 :  Cấu hình thay đổi priority để bầu chọn lại DR và BDR.
Priority có tác dụng trên từng interface, một router có thể có nhiều giá trị priority khác nhau ở interface khác nhau

ð Thực hiện thay đổi priority trên router 1 là 255 (giá trị priority cao nhất)
Router1(config)#interface fa0/0
Router1(config-if)#ip ospf priority ?
  <0-255>  Priority
Router1(config-if)#ip ospf priority 255
Router1(config-if)#end

ð Tương tự thực hiện thay đổi priority trên router 3 là 100 và router 2 là 0
Lưu ý :
Router 2 có priority là 0  nghĩa là router 2 không tham gia vào quá trình bầu chọn

ð Thực hiện lệnh show ip ospf neighbor kiểm tra lại quá trình bầu chọn

Router1#show ip ospf neighbor
Neighbor ID     Pri     State                        Dead Time  Address          Interface
192.168.31.33   100   FULL/BDR             00:00:38     192.168.1.3     FastEthernet0/0
192.168.31.22     0     FULL/DROTHER  00:00:38     192.168.1.2     FastEthernet0/0

Router2#show ip ospf neighbor
Neighbor ID     Pri     State                     Dead Time   Address           Interface
192.168.31.11   255   FULL/DR            00:00:38       192.168.1.1      FastEthernet0/0
192.168.31.33   100   FULL/BDR         00:00:38       192.168.1.3      FastEthernet0/0
Router3#show ip ospf neighbor
Neighbor ID     Pri     State                         Dead Time  Address           Interface
192.168.31.11   255   FULL/DR                00:00:34      192.168.1.1     FastEthernet0/0
192.168.31.22     0     FULL/DROTHER   00:00:34      192.168.1.2     FastEthernet0/0
Công việc 6 : Quan sát quá trình bầu chọn lại khi router DR bị shutdown
ð Shutdown cổng Fa0/0 của router 1
Router1(config)#int fa0/0
Router1(config-if)#shut

ð Router 3 tại thời điểm bây giờ có priority cao nhất là 100 nên nó được bầu chọn làm DR

Router2#show ip ospf neighbor
Neighbor ID      Pri       State                Dead Time   Address          Interface
192.168.31.33   100      FULL/DR       00:00:31      192.168.1.3     FastEthernet0/0

ð Router 2 có priority bằng 0 đứng thứ nhì sau router 3 (priority 100) nhưng nó vẫn không được làm BDR vì priority bằng 0 có nghĩa là không tham gia vào quá trình bầu chọn

Router3#show ip ospf neighbor
Neighbor ID      Pri  State                          Dead Time   Address          Interface
192.168.31.22    0    FULL/DROTHER   00:00:35      192.168.1.2     FastEthernet0/0
ð Ta điều chỉnh priority cho router 2 là bằng 1 và như vậy giá trị priority của nó đứng thứ nhì sau router 3 (priority 100) nên router 2 được bầu chọn làm BDR.
Router2(config)#interface fa0/0
Router2(config-if)#ip ospf priority 1
Router2(config-if)#end

Router3#show ip ospf neighbor
Neighbor ID        Pri    State                  Dead Time   Address           Interface
192.168.31.22     1       FULL/BDR       00:00:36      192.168.1.2     FastEthernet0/0

Cấu hình xác thực cho phép Router xem xét nguồn gốc của các thông tin định tuyến nhận được.

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