Saturday, June 2, 2012

[LAB OSPF] Virtual links and Summarization


Mô hình bài LAB:

Yêu cầu:
  • Cấu hình OSPF multi-area trên các routers 
  • Tạo một virtual link cho area 100 (cấu hình tại R2 và R3)
  • Summarize các routes từ area 100 (cấu hình tại R3)
  • Generate một default route từ R1 (cấu hình tại R1)

1.Cấu hình của các routers
---------
R1
---------

R1#show run
Building configuration...

Current configuration : 1074 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
!
interface Loopback1
 ip address 10.1.1.1 255.255.255.0
!
interface Loopback30
 ip address 172.30.30.1 255.255.255.0
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Serial0/0
 ip address 10.1.12.1 255.255.255.0
 clock rate 64000
!
interface FastEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Serial0/1
 no ip address
 shutdown
 clock rate 2000000
!
interface Serial0/2
 no ip address
 shutdown
 clock rate 2000000
!
!
router ospf 10
 log-adjacency-changes
 network 10.1.1.0 0.0.0.255 area 0
 network 10.1.12.0 0.0.0.255 area 0
 default-information originate always  <-- tạo ra 1 default route quảng bá đến các OSPF routers
!
ip forward-protocol nd
!
!
ip http server
no ip http secure-server
!
control-plane
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end

----------
R2
----------

R2#show run
Building configuration...

Current configuration : 1072 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
interface Loopback2
 ip address 10.1.2.1 255.255.255.0
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Serial0/0
 ip address 10.1.12.2 255.255.255.0
 clock rate 64000
!
interface FastEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Serial0/1
 ip address 10.1.23.1 255.255.255.0
 clock rate 64000
!
interface Serial0/2
 no ip address
 shutdown
 clock rate 2000000
!
!
router ospf 10
 router-id 10.1.2.1 <== router ID được sử dụng để cấu hình virtual link
 log-adjacency-changes
 area 10 virtual-link 10.1.3.1 <== cấu hình virtual link cho area 10
 network 10.1.2.0 0.0.0.255 area 0
 network 10.1.12.0 0.0.0.255 area 0
 network 10.1.23.0 0.0.0.255 area 10
!
ip forward-protocol nd
!
!
ip http server
no ip http secure-server
!
control-plane
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end

-----------
R3
-----------

R3#show run
Building configuration...

Current configuration : 1496 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
interface Loopback3
 ip address 10.1.3.1 255.255.255.0
!
interface Loopback100
 ip address 192.168.100.1 255.255.255.0
!
interface Loopback101
 ip address 192.168.101.1 255.255.255.0
!
interface Loopback102
 ip address 192.168.102.1 255.255.255.0
!
interface Loopback103
 ip address 192.168.103.1 255.255.255.0
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Serial0/0
 no ip address
 shutdown
 clock rate 2000000
!
interface FastEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Serial0/1
 ip address 10.1.23.2 255.255.255.0
 clock rate 64000
!
interface Serial0/2
 no ip address
 shutdown
 clock rate 2000000
!
!
router ospf 10
 router-id 10.1.3.1 <== router ID được sử dụng để cấu hình virtual link
 log-adjacency-changes
 area 10 virtual-link 10.1.2.1  <== cấu hình virtual link cho area 10
 area 100 range 192.168.100.0 255.255.252.0 <== summarize các routes bên trong area 100
 network 10.1.3.0 0.0.0.255 area 10
 network 10.1.23.0 0.0.0.255 area 10
 network 192.168.100.0 0.0.0.255 area 100
 network 192.168.101.0 0.0.0.255 area 100
 network 192.168.102.0 0.0.0.255 area 100
 network 192.168.103.0 0.0.0.255 area 100
!
ip forward-protocol nd
!
!
ip http server
no ip http secure-server
!
control-plane
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end


2.Xem lại các cấu hình


Show virtual links trên R2 (R3)

---------
R2
---------
R2#show ip ospf virtual-links
Virtual Link OSPF_VL0 to router 10.1.3.1 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 10, via interface Serial0/1, Cost of using 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
    Adjacency State FULL (Hello suppressed)
    Index 2/3, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec

----------
R3
----------
R3#show ip ospf virtual-links
Virtual Link OSPF_VL0 to router 10.1.2.1 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 10, via interface Serial0/1, Cost of using 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:05
    Adjacency State FULL (Hello suppressed)
    Index 1/2, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec

Xem bảng routing table
----------
R1
----------
R1#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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.30.0.0/24 is subnetted, 1 subnets
C       172.30.30.0 is directly connected, Loopback30
     10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C       10.1.12.0/24 is directly connected, Serial0/0
O       10.1.2.1/32 [110/65] via 10.1.12.2, 00:19:00, Serial0/0
O IA    10.1.3.1/32 [110/129] via 10.1.12.2, 00:19:00, Serial0/0
C       10.1.1.0/24 is directly connected, Loopback1
O IA    10.1.23.0/24 [110/128] via 10.1.12.2, 00:19:00, Serial0/0
O IA 192.168.100.0/22 [110/129] via 10.1.12.2, 00:19:00, Serial0/0 <== summarized route

----------
R2
----------
R2#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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 10.1.12.1 to network 0.0.0.0

     10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C       10.1.12.0/24 is directly connected, Serial0/0
O       10.1.3.1/32 [110/65] via 10.1.23.2, 00:20:08, Serial0/1
C       10.1.2.0/24 is directly connected, Loopback2
O       10.1.1.1/32 [110/65] via 10.1.12.1, 00:20:08, Serial0/0
C       10.1.23.0/24 is directly connected, Serial0/1
O*E2 0.0.0.0/0 [110/1] via 10.1.12.1, 00:20:08, Serial0/0 <== default route từ R1 gửi tới
O IA 192.168.100.0/22 [110/65] via 10.1.23.2, 00:20:08, Serial0/1 <== summarized route

----------
R3
----------
R3#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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 10.1.23.1 to network 0.0.0.0

     10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O       10.1.12.0/24 [110/128] via 10.1.23.1, 00:21:00, Serial0/1
C       10.1.3.0/24 is directly connected, Loopback3
O       10.1.2.1/32 [110/65] via 10.1.23.1, 00:21:00, Serial0/1
O       10.1.1.1/32 [110/129] via 10.1.23.1, 00:21:00, Serial0/1
C       10.1.23.0/24 is directly connected, Serial0/1
C    192.168.102.0/24 is directly connected, Loopback102
C    192.168.103.0/24 is directly connected, Loopback103
C    192.168.100.0/24 is directly connected, Loopback100
C    192.168.101.0/24 is directly connected, Loopback101
O*E2 0.0.0.0/0 [110/1] via 10.1.23.1, 00:21:00, Serial0/1 <== default route
O    192.168.100.0/22 is a summary, 00:21:10, Null0 <== nếu có 1 gói tin được gửi đến địa chỉ 192.160.100.0/22 của R3 thì sẽ drop

Friday, May 25, 2012

[LAB OSPF] Multi-area


Cấu hình OSPF multi-are. Mô hình bài LAB:

Mục tiêu của bài LAB:
  • -Cấu hình OSPF multi-area cho 3 routers
  • -Xem lại các thông số, bảo đảm cấu hình đúng
  • -Cấu hình area10 lần lượt làm: stub area, totally stubby area.
  • -Cấu hình chứng thực OSPF

1.Cấu hình OSPF multi-area

Cấu hình tương tự với single area. Cấu hình các routers như sau:
---------------
R1
---------------
router ospf 1
 log-adjacency-changes
 network 10.1.2.0 0.0.0.255 area 0
 network 10.1.12.0 0.0.0.255 area 0
 network 10.1.23.0 0.0.0.255 area 10

--------------
R2
--------------
router ospf 1
 log-adjacency-changes
 network 10.1.1.0 0.0.0.255 area 0
 network 10.1.12.0 0.0.0.255 area 0

--------------
R3
--------------
router ospf 1
 log-adjacency-changes
 network 10.1.3.0 0.0.0.255 area 10
 network 10.1.23.0 0.0.0.255 area 10

Kiểm tra lại việc học routes và neighbor giữa các routers:
--------------
R1
--------------
R1#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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/8 is variably subnetted, 4 subnets, 2 masks
C       10.1.12.0/24 is directly connected, Serial0/0
C       10.1.2.0/24 is directly connected, Loopback2
O       10.1.1.1/32 [110/65] via 10.1.12.1, 00:04:02, Serial0/0
C       10.1.23.0/24 is directly connected, Serial0/1

R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.1.1.1          0   FULL/  -        00:00:34    10.1.12.1       Serial0/0
10.1.23.3         0   FULL/  -        00:00:38    10.1.23.3       Serial0/1

---------------
R2
---------------
R2#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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/8 is variably subnetted, 4 subnets, 2 masks
C       10.1.12.0/24 is directly connected, Serial0/0
O       10.1.2.1/32 [110/65] via 10.1.12.2, 00:07:23, Serial0/0
C       10.1.1.0/24 is directly connected, Loopback1
O IA    10.1.23.0/24 [110/128] via 10.1.12.2, 00:07:23, Serial0/0
---------------
R3
---------------
R3#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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/8 is variably subnetted, 4 subnets, 2 masks
O IA    10.1.12.0/24 [110/128] via 10.1.23.2, 00:04:40, Serial0/1
O IA    10.1.2.1/32 [110/65] via 10.1.23.2, 00:04:40, Serial0/1
O IA    10.1.1.1/32 [110/129] via 10.1.23.2, 00:04:40, Serial0/1
C       10.1.23.0/24 is directly connected, Serial0/1

-------------

Như vậy, các routers đã thiết lập neighbor và học đc các routes trong mạng.

2.Cấu hình các kiểu area cho area 10


2.1.Cấu hình area 10 làm stub area

Stub area là area chỉ chứa các routes bên trong area của nó và 1 default route để đi ra ngoài. Điều này giảm bớt việc xử lý cho router.

Để cấu hình area 10 làm stub area, tiến hành cấu hình trên 2 router R1 và R3

R1(config-router)#area 10 stub

*Mar  1 00:13:19.435: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.23.3 on Serial0/1 from FULL to DOWN, Neighbor Down: Adjacency forced to reset
---------------

R3(config-router)#area 10 stub
R3(config-router)#
*Mar  1 00:13:41.119: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.2.1 on Serial0/1 from FULL to DOWN, Neighbor Down: Adjacency forced to reset

Ban đầu, cả 2 router sẽ tạm thời drop neighbor, sau đó sẽ thiết lập neighbor trở lại.

*Mar  1 00:13:46.919: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.23.3 on Serial0/1 from LOADING to FULL, Loading Done

*Mar  1 00:13:42.443: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.2.1 on Serial0/1 from LOADING to FULL, Loading Done

Đến thời điểm này, khi show ip route trên R3, ta sẽ chỉ thấy các internal routes, inter-area routes và 1 default trỏ ra ngoài. R3 sẽ không nhận các routes bên ngoài AS.

R3#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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 10.1.23.2 to network 0.0.0.0

     10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
O IA    10.1.12.0/24 [110/128] via 10.1.23.2, 00:01:50, Serial0/1
O IA    10.1.2.1/32 [110/65] via 10.1.23.2, 00:01:50, Serial0/1
O IA    10.1.1.1/32 [110/129] via 10.1.23.2, 00:01:50, Serial0/1
C       10.1.23.0/24 is directly connected, Serial0/1
O*IA 0.0.0.0/0 [110/65] via 10.1.23.2, 00:01:50, Serial0/1

----------------
Kiểm tra trạng thái OSPF
----------------

R3#show ip ospf

 External flood list length 0
    Area 10
        Number of interfaces in this area is 1
        It is a stub area
        Area has no authentication
        SPF algorithm last executed 00:03:28.156 ago
        SPF algorithm executed 8 times
        Area ranges are
        Number of LSA 6. Checksum Sum 0x02F42E
        Number of opaque link LSA 0. Checksum Sum 0x000000
        Number of DCbitless LSA 0
        Number of indication LSA 0
        Number of DoNotAge LSA 0
        Flood list length 0

2.2.Cấu hình area 10 là totally  stubby area


Totally stubby area là một khái niệm của Cisco đưa ra. Nó là 1 cải tiến của stub area. Nó chỉ chứa các intra-area routes, không chứa các routes bên ngoài area. Cộng với 1 default route để ra ngoài.

Cấu hình totally stubby area trên R1,R3:
--------------
R1
--------------
R1(config-router)#area 10 stub ?         
  no-summary  Do not send summary LSA into stub area
 
R1(config-router)#area 10 stub no-summary
-------------
R3
-------------
R3(config-router)#area 10 stub no-summary

Sau khi đã cấu hình totally stubby area, R3 sẽ chỉ có các intra-area route và 1 default route:

R3#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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 10.1.23.2 to network 0.0.0.0

     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.3.0 is directly connected, Loopback3
C       10.1.23.0 is directly connected, Serial0/1
O*IA 0.0.0.0/0 [110/65] via 10.1.23.2, 00:01:43, Serial0/1

Kiểm tra kết nối đến bên ngoài area:

R3#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 = 1/5/16 ms

3.Cấu hình authentication cho OSPF routers

Có 2 cách để cấu hình authentication cho các OSPF routers:
-Cấu hình authen theo kiểu plaintext
-Cấu hình authen theo kiểu băm MD5

3.1.Cấu hình authentication theo  plaintext

Việc cấu hình diễn ra trên các interfaces để tiến hành kiểm tra

R1(config)#int s0/0
R1(config-if)#ip ospf authentication << enable authentication
R1(config-if)#ip ospf authentication-key cisco  << define authen-key: cisco

Tương tự với interface s0/0 trên R2.
Kiểm tra lại các thông số chứng thực trên interfaces:
-------------
R2#show ip ospf interface s0/0 | begin authentication
  Simple password authentication enabled


R2#show run | begin Serial0/0
interface Serial0/0
 ip address 10.1.12.1 255.255.255.0
 ip ospf authentication
 ip ospf authentication-key cisco
 clock rate 64000

3.2.Cấu hình authentication băm MD5

Tương tự như cấu hình plaintext:

R2(config-if)#ip ospf authentication message-digest
R2(config-if)#ip ospf authentication-key cisco

Kiểm tra lại:
R1#show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
R2               Ser 0/0            143        R S I      2691      Ser 0/0
R3               Ser 0/1            137        R S I      2691      Ser 0/1

R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.1.1.1          0   FULL/  -        00:00:38    10.1.12.1       Serial0/0
10.1.23.3         0   FULL/  -        00:00:32    10.1.23.3       Serial0/1

Tuesday, May 22, 2012

[LAB OSPF] Single area

Cấu hình OSPF single area

Mô hình bài LAB:


Yêu cầu:
  • Cấu hình OSPF single area
  • Qủang bá các loopback interfaces
  • Xác nhận lại việc thiết lập neighbor
  • Chỉnh sửa OSPF link cost trên các interfaces
  • Chỉnh sửa OSPF priorities
  • Sử dụng công cụ debug để xem việc trao đổi thông tin
Cấu hình của các routers:

R1:
------------------------
R1#show run
Building configuration...
<...output omitted...>
hostname R1
!
!
interface Loopback1
 ip address 10.1.1.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 10.1.200.1 255.255.255.0
 ip ospf cost 5 <<< thay đổi OSPF cost trên interface
 ip ospf priority 5 <<< thay đổi OSPF priority trên interface
 duplex auto
 speed auto
!
interface Serial0/0
 ip address 10.1.100.1 255.255.255.0
 ip ospf cost 50
 clock rate 2000000
!
<---- cấu hình OSPF----->
router ospf 10
 log-adjacency-changes
 network 10.1.1.0 0.0.0.255 area 0
 network 10.1.100.0 0.0.0.255 area 0
 network 10.1.200.0 0.0.0.255 area 0
!
<...output omitted...>
end
------------------------
R2:
------------------------
R2#show run                                                                                                         
<...output omitted...>
!
hostname R2
!
interface Loopback2
 ip address 10.1.2.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 10.1.200.2 255.255.255.0
 ip ospf cost 5
 ip ospf priority 6
 duplex auto
 speed auto
!
interface Serial0/0
 ip address 10.1.100.2 255.255.255.0
 ip ospf cost 60
 clock rate 64000
!
router ospf 10
 log-adjacency-changes
 network 10.1.2.0 0.0.0.255 area 0
 network 10.1.100.0 0.0.0.255 area 0
 network 10.1.200.0 0.0.0.255 area 0
!
end
<...output omitted...>

----------------------
R3:
---------------------
R3#show run                                                                                                         
Building configuration...   
 

<...output omitted...>
!
hostname R3
!
interface Loopback3
 ip address 10.1.3.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 10.1.200.3 255.255.255.0
 ip ospf cost 5
 ip ospf priority 7
 duplex auto
 speed auto
!
router ospf 10
 log-adjacency-changes
 network 10.1.3.0 0.0.0.255 area 0
 network 10.1.200.0 0.0.0.255 area 0
!
<...output omitted...>
end


---------------------



Xác thực lại kết nối neighbors

R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.1.2.1          0   FULL/  -        00:00:39    10.1.100.2      Serial0/0
10.1.2.1          6   FULL/DR         00:00:38    10.1.200.2      FastEthernet0/0
10.1.3.1          7   FULL/BDR        00:00:32    10.1.200.3      FastEthernet0/0


Xem lại thông tin OSPF trên từng interfaces

-----------------------
R1#show ip ospf interface fa0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 10.1.200.1/24, Area 0
  Process ID 10, Router ID 10.1.1.1, Network Type BROADCAST, Cost: 5
  Transmit Delay is 1 sec, State DROTHER, Priority 5
  Designated Router (ID) 10.1.2.1, Interface address 10.1.200.2
  Backup Designated router (ID) 10.1.3.1, Interface address 10.1.200.3
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:04
  Supports Link-local Signaling (LLS)
  Index 2/2, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 0, maximum is 1
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 2, Adjacent neighbor count is 2
    Adjacent with neighbor 10.1.2.1  (Designated Router)
    Adjacent with neighbor 10.1.3.1  (Backup Designated Router)
  Suppress hello for 0 neighbor(s)
----------------------
Sử dụng công cụ debug

R1#debug ip ospf packet
OSPF packet debugging is on
R1#
*Mar  1 01:13:45.087: OSPF: rcv. v:2 t:1 l:48 rid:10.1.2.1
      aid:0.0.0.0 chk:D591 aut:0 auk: from Serial0/0
*Mar  1 01:13:47.599: OSPF: rcv. v:2 t:1 l:52 rid:10.1.3.1
      aid:0.0.0.0 chk:2482 aut:0 auk: from FastEthernet0/0
*Mar  1 01:13:54.027: OSPF: rcv. v:2 t:1 l:52 rid:10.1.2.1
      aid:0.0.0.0 chk:2483 aut:0 auk: from FastEthernet0/0
*Mar  1 01:13:55.043: OSPF: rcv. v:2 t:1 l:48 rid:10.1.2.1
      aid:0.0.0.0 chk:D591 aut:0 auk: from Serial0/0
*Mar  1 01:13:57.627: OSPF: rcv. v:2 t:1 l:52 rid:10.1.3.1
      aid:0.0.0.0 chk:2482 aut:0 auk: from FastEthernet0/0


Ý nghĩa các thông tin trong lệnh debug
  • v: version của  OSPF đang chạy
  • t:type (1:Hello...)
  • l: length của packet (theo bytes)
  • rid: router id gửi packet
    aid: area id
  • chk: checksum
  • aut: authentication (0: no authentication, ...)
Lưu ý sau khi thay đổi Priority:

Sau khi đã đổi priority, việc bầu chọn sẽ không được chạy lại từ đầu. Muốn việc bầu chọn chạy lại, sử dụng câu lệnh clear ip ospf process.
Hoặc có thể shutdown một cổng sau đó no shutdown cổng đó để xem lại việc bầu chọn.

Friday, May 18, 2012

Choosing the best OSPF routes

Những công tác như thiết lập neighbor, gửi các LSDB,... mục đích cuối cùng là để OSPF router có thể tính toán best route đến từng subnet đích. Các bước để tính toán ra một best route đó là:
  •     -Phân tích LSDB để tìm tất cả các đường đi có thể tới subnet
  •     -VỚi từng subnet, gán cost đến subnet đó bằng cost của các outgoing interface đến subnet đó.
  •     -Chọn lấy route nào có total cost thấp nhất.

1.Tính toán cost cho các intra-area routes

Để tính toán ra 1 best route đến từng subnet, OSPF router sẽ làm các bước:
  •     -Tìm kiếm toàn bộ các subnet trong area. Việc này được thực hiện nhờ các LSA type 1 và type 2.
  •     -Chạy thuật toán SPF để tìm đường đi ngắn nhất đến các subnet này.
  •     -TÍnh toán cost cho các outgoing interface đến từng subnet, lấy route nào có cost nhỏ nhất.


Hình trên là 1 ví dụ mô tả về việc chọn routes. Mục đích là để R1 có thể chọn đc 1 route tốt nhất để đến SUbnet A. Có rất nhiều đường để đến Subnet A như:
R1-R4
R1-R3-R4
R1-R2-R4
R1-R2-R3-R4
...

Dựa vào cost trên các out-going interfaces, R1 sẽ tính toán xem route nào là tốt nhất và đưa route đó vào routing table. Ở đây có thể thấy ngay đc đó là route R1-R4 với tổng cost là 20

2.Tính toán cost cho inter-area routes

Việc tính toán cost cho inter-area routes cũng tương tự như đối với intra-area, nhưng thay vì tính toán cost cho các routes trong toàn bộ hệ thống mạng. Các OSPF routers internal sẽ chỉ nhận được LSA type 3 từ ABR gửi về. ABR gửi các summary về area bên ngoài các internal router. Vì vậy, các internal router sẽ không cần phải biết cost đến subnet đích bên kia area mà chỉ cần tính toán cost tốt nhất để đến được ABR. Cost đến ABR sẽ cộng thêm cost từ ABR đến các subnet đích của area còn lại.

LSA type 3 được ABR gửi ra có mang các nội dung sau:
  •     -subnet/mask được đại diện bởi ABR
  •     -cost thấp nhất của ABR để đến subnet
  •     -RID của ABR






Tương tự cho việc R1 học routes để đến Subnet A


3.Quy tắc lựa chọn route của OSPF

Hai lưu ý khi lựa chọn route trong một OSPF network:
  •     -luôn chọn một intra-area route, không chọn inter-area route, không phụ thuộc vào metric
  •     -Nếu một ABR học một Type 3 LSA bên trong một nonbackbone area, ABR sẽ không đưa LSA đó vào khi tính toán routes của nó.