test

OSPF MD5 Authentication

Trong phần trước chúng ta đã xem cách cấu hình xác thực bằng text đơn giản. Bài này chúng ta hãy xem cấu hình xác thực bằng MD5 xem như thê nào nhé. Về ý tưởng dùng để xác thực thì như nhau nhưng câu lệnh cấu hình sẽ khác đó. Hãy xem ví dụ nhé.
Chỉ đơn giản là 2 routers. Giờ chúng ta hãy xác thực bằng MD5 nào.

R1(config)#interface fastEthernet 0/0
R1(config-if)#ip ospf message-digest-key 1 md5 MYPASS
R1(config-if)#ip ospf authentication message-digest

R2(config)#interface fastEthernet 0/0
R2(config-if)#ip ospf message-digest-key 1 md5 MYPASS
R2(config-if)#ip ospf authentication message-digest

Để cấu hình xác thực MD5 thì chúng ta cần có câu lệnh khác hẳn với dạng text đơn thuần.
Đầu tiên là sử dung ip ospf message-digest-key 1 md5 MYPASS để đặt mật khẩu và số key. Số key này không quan trọng là bao nhiêu nhưng phải khớp nhau giữa 2 routers. Để bật xác thực thì bạn cần 1 câu lệnh nữa là ip ospf authentication message-digest

Bạn cũng có thể bật xác thực bên trong 1 area, lúc này bạn sẽ không cần sử dụng tới lệnh ip ospf authentication message-digest nữa. Nên nhớ chỉ ko cần câu lệnh trên nhé. Vẫn cần lệnh đặt số key và pass nhé. Và đây là câu lệnh của nó.

R1(config)#router ospf 1
R1(config-router)#area 0 authentication message-digest

Giờ hãy kiểm tra interface nào.

R1#show ip ospf interface fastEthernet 0/0
FastEthernet0/0 is up, line protocol is up
 Internet Address 192.168.12.1/24, Area 0
 Process ID 1, Router ID 192.168.12.1, Network Type BROADCAST, Cost: 1
 Transmit Delay is 1 sec, State BDR, Priority 1
 Designated Router (ID) 192.168.12.2, Interface address 192.168.12.2
 Backup Designated router (ID) 192.168.12.1, Interface address 192.168.12.1
 Flush timer for old DR LSA due in 00:01:53
 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
 oob-resync timeout 40
 Hello due in 00:00:05
 Supports Link-local Signaling (LLS)
 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 1, Adjacent neighbor count is 1
 Adjacent with neighbor 192.168.12.2 (Designated Router)
 Suppress hello for 0 neighbor(s)
 Message digest authentication enabled
 Youngest key id is 1

Với lệnh show ip ospf interface bạn đã có thể nhìn thấy kiểu xác thực là MD5 đã được bật là key id là 1.
Giờ hãy xem với debug nhé.

R1#debug ip ospf packet
OSPF packet debugging is on
OSPF: rcv. v:2 t:1 l:48 rid:192.168.12.2
 aid:0.0.0.0 chk:0 aut:2 keyid:1 seq:0x3C7EC653 from FastEthernet0/0

Khi bạn gặp lỗi về OSPF thì debug là 1 câu lệnh khá quan trọng để kiểm tra việt thiết lập neighbor giữa các router đó.

Giờ chúng ta hãy thử đặt sai pass xác thực giữa 2 router nhé. Tôi sẽ chỉnh trên router 1

R1(config)#interface fastEthernet 0/0 
R1(config-if)#no ip ospf message-digest-key 1 md5 MYPASS 
R1(config-if)#ip ospf message-digest-key 1 md5 MYWRONGPASS

Ok giờ hãy kiểm tra nào.
R1#debug ip ospf adj 
OSPF adjacency events debugging is on

R1#clear ip ospf process
Reset ALL OSPF processes? [no]: yes

Và đây là chúng ta nhận được output

R1# 
OSPF: Rcv pkt from 192.168.12.2, FastEthernet0/0 : Mismatch Authentication Key - Message Digest Key 1

Đó các bạn thấy không? Mismatch authen key. Cần phải kiểm tra lại key giữa 2 router nhé,
Dưới đây là cấu hình của 2 routers cho việc authen bằng MD5. Các bạn có thể dùng để tham khảo.

hostname R1
!
interface FastEthernet0/0
 ip address 192.168.12.1 255.255.255.0
 ip ospf message-digest-key 1 md5 MYPASS
 ip ospf authentication message-digest
!
router ospf 1
 network 192.168.12.0 0.0.0.255 area 0
  area 0 authentication message-digest
!
end

hostname R2
!
interface FastEthernet0/0
 ip address 192.168.12.2 255.255.255.0
 ip ospf message-digest-key 1 md5 MYPASS
 ip ospf authentication message-digest
!
router ospf 1
 network 192.168.12.0 0.0.0.255 area 0
 area 0 authentication message-digest
!
end

Trân trọng!
OSPF MD5 Authentication OSPF MD5 Authentication Reviewed by phucvm on tháng 8 27, 2019 Rating: 5

Không có nhận xét nào:

Được tạo bởi Blogger.