Showing posts with label OSPF protocol. Show all posts
Showing posts with label OSPF protocol. Show all posts

Tuesday, June 16, 2015

iSPF

1.     Giới thiệu iSPF.
Mức độ phức tạp của mô hình mạng thể hiện rõ nhất trên những mô hình mạng có số node lớn. Độ phức tạp của thật toán có thể chiếm dụng đáng kể tài nguyên xử lý CPU. Các dòng router mới cũng phải mất gần tram mili-giây cho mỗi chu kỳ tính SPF trên toàn sơ đồ mạng. Khoảng thời gian có thể hạn chế đáng kể bằng cách tối ưu hóa thuật toán SPF  “incremental SPF”
Ý tưởng: duy trì cấu trúc SPT ổn định sau quá trình xử lý đầu tiên của SPF và sử dụng cây SPF này cho những lần xử lý  SPF về sau.
iSPF giảm lượng tính toán SPF khi type -1 hoặc type 2 LSA thay đổi trong mạng.
3 đặc tính tối ưu hóa quy trình xử lý iSPF:

·         Đặc tính 1: Node được thêm vào hoặc gỡ bỏ ra khỏi sơ đồ hiện tại có vai trò là node nhánh của cây SPT đã được lưu trước đó thì không cần phải tiêu tốn quá nhiều tài nguyên xử lý để bổ sung thêm những mạng  (route) mới vào.
 



·         Đặc tính 2: nếu có một liên kết bị sự cố và liên kết đó không nằm trong cây SPT đã được tính toán trước đó thì không cần phải thực hiện tính toán SPF gây hao phí tài nguyên.
 




Chú ý: Đặc tính 2 không phải tốn tài nguyên xử lý SPF, nhưng khó dự đoán được có bao nhiêu liên kết sự cố có thể ảnh hưởng đến hệ thông. Bên cạnh đó, mỗi router có cây SPT khác biệt, do vậy liên kết sự cố có thể không ảnh hưởng từ cây SPT này nhưng có thể ảnh hưởng đến cây SPT của router khác.
Trường hợp giá trị cost của link thay đổi hoặc sự thay đổi trạng thái diễn ra trên link thì đặc tính 2 không phát huy tác dụng và cây SPT cần phải được tính toán lại.

·         Đặc tính 3:  Có tính chất chung hơn.  Nếu liên kết trung chuyển xảy ra sự cố và ảnh hưởng đến cây SPT trước đó, điều đó đồng nghĩ với đặc tính 1 và 2 đều không phát huy được tác dụng.  Nếu liên kết giữa 2 node gặp sự cố thì chỉ cần tính toán STP của những node nằm sau sự cố dựa trên cây SPT có sẵn.
o   Sự cố xảy ra càng xa node gốc thì càng ít ảnh hưởng đến tài nguyên xử lý router. Tuy nhiên mỗi router có 1 cây SPT khác nhau, cùng 1 sự cố trên link đầu xa không ảnh hưởng đến router nay nhưng lại có thể ảnh hưởng lớn đến router khác.
o   Hiệu quả trên kết nối phân tán, nếu fully-mesh thì các node phải xử lý lại SPF => không tối ưu, giống với SPT thông thường.







Khi chạy iSPF mặc dù giảm CPU xử lý nhưng ngược lại bộ nhớ sẽ tăng. Và bộ nhớ tăng tỉ lệ 2*N ( với N là số router trong mạng).

2.       Cấu hình và test.
-            Command cấu hình:
R1(config-router)#router ospf 1
R1(config-router)#ispf
-          Kiểm tra:            R1#show ip ospf | in Incre
                                           Incremental-SPF enable

Saturday, April 11, 2015

OSPF problem when config summary network with virtual-link

Topology:



- R1 create 3 loopback network then advertise into ospf area 0.
 lo0: 1.1.0.1/24
 lo1: 1.1.1.1/24
 lo2: 1.1.2.1/24

- Advertise loopback0 network R4 into ospf area 2.
- verify R1:

- Because area 2 are discontigous Non-AREA .router in area 0 havent route loopback R4.
- Config virtual-link btw R2 and R4 are slove problem.
                                 R2#
                                       router ospf 1
                                       area 1 virtual-link 4.4.4.4
                                 R4#
                                        router ospf 1
                                        area 1 virtual-link 2.2.2.2
=> Neighbor btw R2 and R4 over virtual-link up.
- in R2, summary 3 network learn via R1 into area 1.
                                                                         1.1.0.0/24
                                                                         1.1.1.0/24
                                                                         1.1.2.0/24
                                      => summary route: 1.1.0.0/22
                               R2#
                                     router ospf 1
                                     are 0 range 1.1.0.0 255.255.252.0
- verify R3:


=> we have problem, 3 network advertise by R1 are not summary.

WHY ???
Area 1 should be transit and carry a virtual link and area 0 prefixes should be summarized in the transit area. Per OSPF functionality, it is impossible to summarize prefixes entering a transit area, as this may result in routing loops. Therefore, summarization requirement and virtual link do not work together well.
This solution to this problem is using a tunnel in area 0 as opposed to a virtual-link. The tunnel will encapsulate transit packets and hide them from R3, therefore preventing any possible forwarding loops due to summarization
R2#
router ospf 1
 no area 1 virtual-link 4.4.4.4
 area 0 range 1.1.0.0 255.255.252.0
!
interface Tunnel0
 ip address 192.168.24.2 255.255.255.0
 ip ospf 1 area 0
 tunnel source 10.1.23.2
 tunnel destination 10.1.34.4

R4#
router ospf 1
 no area 1 virtual-link 2.2.2.2
 area 0 range 1.1.0.0 255.255.252.0 not-advertise
!
interface Tunnel0
 ip address 192.168.24.4 255.255.255.0
 ip ospf 1 area 0
 tunnel source 10.1.34.4
 tunnel destination 10.1.23.2

- Verify R3:

Friday, March 27, 2015

OSPF LSA type


    1 .  type 1 LSA ( router link states ).
    • Tạo ra bởi chính router  trong area mô tả chính nó tạo ra , in interface và neighebor
    • Để kiểm tra :   “ show ip ospf database router ”
    • Note :
      • type 1 LSA không thể filter.
      • Giá trị maxage càng lớn thì càng được tin tưởng trong quá trình chọn routes khi load


    2. type 2 LSA ( network link states ).
    - tạo ra trong mạng môi trường mutilaccess khi DR được chọn
    • chỉ flood trong area bởi DR.
    - kiểm tra “show ip os da network”
    - note :
                + Type 2 LSAcó thể thể filter.   
              (ip ospf database-filter all out / neighbor  database-filter all : filter type              2 ,3,4,5, 7)
    + Để route đưa lên bảng định tuyến thì khi show phải thấy type 1 và 2 của route đó .
      
    3.  type 3 LSA ( summary in ABR )
    - tạo ra bởi ABR
    - summary thông tin type 1 và 2 qua area khác
    -  thông tin bao gồm :  subnet, the mask, và giá trị cost để tới  ABR.
    - kiểm tra  “ show ip os da summary ”
    - có thể filter bởi “ area range ….+ not advertise
    Note : If a network represented by a Type 3 LSA goes down, the ABR refloods the LSA with the OSPF infinite cost so that the route is quickly removed from all other routers which contain that LSA in their LSDB.  The alternative would be to simply stop sending that LSA, however the route would not be removed from the other routers until the LSA aged out (MaxAge – default 60 mintues)
    4 . type 4  LSA
    • Tạo ra bởi ABR khi có ASBR trong area  nhằm mô tả và tính cost tới ASBR
    • Router nằm khác area với ASBR sẽ thấy type 4 và 5 để tính cost tới external route
    Bởi vì nếu mỗi type 5 thì không đủ thông tin để tính tới external routes đó .
    • Kiểm tra “ show ip ospf da asbr-summary ”
    • Type không thuộc area nào

    5. type 5 LSA
    - giữ nguyên thông tin khi đi qua các area
    <khi show database lên thì không nằm trong một area nào >
    • “advertise router “ không thay đổi  ( advertise router được  chọn là RID)
    • Forwarding address = 0.0.0.0  
      • co truong hop khac 0.0.0.0  khi mang external chay them EIGRP ,RIP…(link multiaccess)
      • De chuyen FA = 0.0.0.0 thi :
        • cau hinh link point-to-point or point-to-multipoint.
        • summary routes tren ASBR.
        • prefix-suppression
    • Trong stub area , không có type 5 . ASBR sẽ advertise default route để thay thế
    •  Kiểm tra “ show ip os da ex “”

    • Filter type 5 : summary-address … not-adv (ASBR)
    • Type 5 không thuộc một area nào .
    Note :
    + khi giá trị forwarding address khác 0 thì router tìm routes đó ở địa chỉ của forwarding address , còn không thì advertise router .

    The forwarding address is set to 0.0.0.0 if the ASBR redistributes routes and OSPF is not enabled on the next hop interface for those routes.

    These conditions set the forwarding address field to a non-zero address:
    • OSPF is enabled on the ASBR's next hop interface AND
    • ASBR's next hop interface is non-passive under OSPF AND
    • ASBR's next hop interface is not point-to-point AND
    • ASBR's next hop interface is not point-to-multipoint AND
    • ASBR's next hop interface address falls under the network range specified in the router ospf command.

    Any other conditions besides these set the forwarding address to 0.0.0.0



    7.type 7 LSA
    - tạo ra khi area là NSSA
    - khi đi vào backboon thì type được  chuyển sang type 5 bởi router ABR (có RID cao nhất)
    - chuyen type 7 – 5 thi forwarding address khong thay doi ( là giá trị RID của ASBR )  .khi chuyen  chuyen doi su dung  suppress-fa  thi FD = 0.0.0.0 .
    -nếu E2 routes have the same external metric will OSPF check the internal cost to the advertising ASBR
    -When all else is equal between a Type-5 LSA and Type-7 LSA (metric type, external metric, internal cost) the OSPF router will prefer the Type-5 LSA.
    - Filter type 7 : summary-address … not-adv (ASBR)
    - kiểm tra " show ip os da nssa-external "



Tuesday, March 10, 2015

OSPF virtual-link

    • Virtual-link are seem as point-to-point link
      • Belonging  to area 0
      • Base on the router-ids and intra-area shortest-path tree
    • Virtual-link are only used to flood specific LASs: router, network, summary LSA => Stub Area.
      • LSA type 5 flood to all area expect stub area. So no need to duplicate information across the virtual-link

    • Chu y:  Rat quan trong, thuong xuyen gap trong CCIE Lab


    R2#show run | se router ospf
    router ospf 1
     log-adjacency-changes
     area 1 virtual-link 3.3.3.3
    R3#show run | se router ospf
    router ospf 1
     log-adjacency-changes
     area 1 virtual-link 2.2.2.2


    R2 va R3 thiet lap neighbor qua virtual-link. Nhung neighbor se down khi truong hop tang cost duoi interface f0/1 (R2) va f0/0 (R3) qua max trong cmd " ip ospf cost 65535" thi neighbor se down.'

    The cost of the virtual-link is calculated dynamically, based on the cost to transit the underlying intra-area topology. If this topology changes, so does the virtual-link cost. Sine virtual link is a normal OSPF link advertised in type-1 LSA, it could not have the cost above 65535. However, it is possible to the intra-area path to exceed this cost, e.g. as a result of cost manipulation or changing the reference bandwidth. In this situation, both virtual-link endpoints will declare it down and stop using. That is, if you have a virtual-link across the area, the maximum path cost in this area should not exceed 65535.


OSPF discontigous

TH1: discontigous Non-AREA. Tat ca cac area phai ket noi toi backboon area.
QUIZ: R3 k phai la ABR nen no se k tao ra LSA type 3 giua AREA 1 va AREA 2. vi vay R2 se k biet den mang 4.4.4.0/24 va k co trong database

R3#show ip os da

            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Summary Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum
1.1.1.0         2.2.2.2         535         0x80000001 0x00978F
10.1.12.0       2.2.2.2         586         0x80000001 0x009E75

                Router Link States (Area 2)

Link ID         ADV Router      Age         Seq#       Checksum Link count
3.3.3.3         3.3.3.3         519         0x80000004 0x00741F 2
4.4.4.4         4.4.4.4         521         0x80000004 0x005A2D 2

                Net Link States (Area 2)

Link ID         ADV Router      Age         Seq#       Checksum
10.1.34.4       4.4.4.4         521         0x80000001 0x0018C4


  • Solution:  tao virtual-link hoac GRE tunnel giua R2 va R3

TH2: discontigous area 0 in ospf


QUIZ: R2 là ABR nó s không đưa inter-area routes ( area 0 giua R3-R4) mà nhn đưc t non-backbone interface (interface f0/1) lên bng đnh tuyến, mc dù có trong database

R2#show ip route 4.4.4.0
% Network not in table
R2#show ip os da su 4.4.4.0

            OSPF Router with ID (2.2.2.2) (Process ID 1)

                Summary Net Link States (Area 1)

  LS age: 86
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 4.4.4.0 (summary Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0xD0D
  Length: 28
  Network Mask: /24
        TOS: 0  Metric: 11


  • Solution: tao virtual-link hoac GRE tunnel giua R2-R3

OSPF database command show




NOTE: trong ospf gia tri cost = outing interface


  1. Show ip ospf database router
R1#show ip os da router 3.3.3.3

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Router Link States (Area 0)

  LS age: 267
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 3.3.3.3
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000004
  Checksum: 0xE4E5
  Length: 48
  Number of Links: 2

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 3.3.3.3
     (Link Data) Network Mask: 255.255.255.255
      Number of TOS metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.1.123.3
     (Link Data) Router Interface address: 10.1.123.3
      Number of TOS metrics: 0
       TOS 0 Metrics: 30

Command " show ip ospf database router {X} "  type 1 LSA. cho thay duoc gia tri cost tu router X den router dang show

Cost R3 -> R1 = 30

  1. show ip os da router self-originate
R1#show ip os da router self-originate

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Router Link States (Area 0)

  LS age: 466
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 1.1.1.1
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000003
  Checksum: 0xAC4D
  Length: 48
  Number of Links: 2

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 1.1.1.1
     (Link Data) Network Mask: 255.255.255.255
      Number of TOS metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.1.123.3
     (Link Data) Router Interface address: 10.1.123.1
      Number of TOS metrics: 0
       TOS 0 Metrics: 10

Show LSA sinh ra boi no, va gia tri cost cua no den cac router ben canh.

Cost R1 -> R3 = 10


  1. show ip os da network

R1#show ip os da network

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Net Link States (Area 0)

  Routing Bit Set on this LSA
  LS age: 650
  Options: (No TOS-capability, DC)
  LS Type: Network Links
  Link State ID: 10.1.123.3 (address of Designated Router)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0x6F19
  Length: 36
  Network Mask: /24
        Attached Router: 3.3.3.3
        Attached Router: 1.1.1.1
        Attached Router: 2.2.2.2

Command show type 2 LSA, cho biet cac router attack trong multiaccess. Router DR

DR: 10.1.123.3


  1. show ip os da summary

R1#show ip os da summary 4.4.4.4

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Summary Net Link States (Area 0)

  Routing Bit Set on this LSA
  LS age: 773
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 4.4.4.4 (summary Network Number)
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000001
  Checksum: 0x67A8
  Length: 28
  Network Mask: /32
        TOS: 0  Metric: 21

Command show type 3 LSA. Cho biet advertise router hay  va gia tri cost tu advertise router ABR - > no

Cost  R2 - > 4.4.4.4 = R2->R4 + R4-> 4.4.4.4 = 20 + 1 = 21


  1. Show ip ospf da ex {X}
R1#show ip os da ex 5.5.5.5

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Type-5 AS External Link States

  Routing Bit Set on this LSA
  LS age: 48
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 5.5.5.5 (External Network Number )
  Advertising Router: 4.4.4.4
  LS Seq Number: 80000003
  Checksum: 0x7656
  Length: 36
  Network Mask: /32
        Metric Type: 1 (Comparable directly to link state metric)
        TOS: 0
        Metric: 5
        Forward Address: 10.1.45.5
        External Route Tag: 0

Command show type 5 LSA. Cho biet router ASBR advertise, gia tri metric tu 5.5.5.5 -> ASBR
Hay gia tri advertise = 5

Cost 5.5.5.5 -> ASBR = 5


  1. show ip os da asbr-summary
show ip os da asbr-summary 4.4.4.4

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Summary ASB Link States (Area 0)

  Routing Bit Set on this LSA
  LS age: 1370
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(AS Boundary Router)
  Link State ID: 4.4.4.4 (AS Boundary Router address)
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000001
  Checksum: 0x4FC0
  Length: 28
  Network Mask: /0
        TOS: 0  Metric: 20

Command  cho biet gia tri cost tu ABR-> ASBR
Cost R2 -> R4 = 20

  1. Show ip route 5.5.5.5
R1#show ip route 5.5.5.5
Routing entry for 5.5.5.5/32
  Known via "ospf 1", distance 110, metric 40, type extern 1
  Last update from 10.1.123.2 on FastEthernet0/0, 00:00:46 ago
  Routing Descriptor Blocks:
  * 10.1.123.2, from 4.4.4.4, 00:00:46 ago, via FastEthernet0/0
      Route metric is 40, traffic share count is 1


R1-> 5.5.5.5 = R1-R2 + R2-R4 + R4- + adverstise metric
 = 10 + 20 + 5 + 5 = 40  (vi tren cong f0/1 R4 run ospf vs cost = 5)

Disable ospf in f0/0 R4.

R1#show ip route 5.5.5.5
Routing entry for 5.5.5.5/32
  Known via "ospf 1", distance 110, metric 35, type extern 1
  Last update from 10.1.123.2 on FastEthernet0/0, 00:01:06 ago
  Routing Descriptor Blocks:
  * 10.1.123.2, from 4.4.4.4, 00:01:06 ago, via FastEthernet0/0
      Route metric is 35, traffic share count is 1

R1-> 5.5.5.5 = R1-R2 + R2-R4 + advertise
 = 10 + 20 + 5 = 35

  1. Config area 1 nssa
Show ip os data nssa

R2#show ip os database nssa-external 5.5.5.5

            OSPF Router with ID (2.2.2.2) (Process ID 1)

                Type-7 AS External Link States (Area 1)

  Routing Bit Set on this LSA
  LS age: 113
  Options: (No TOS-capability, Type 7/5 translation, DC)
  LS Type: AS External Link
  Link State ID: 5.5.5.5 (External Network Number )
  Advertising Router: 4.4.4.4
  LS Seq Number: 80000001
  Checksum: 0xA24F
  Length: 36
  Network Mask: /32
        Metric Type: 1 (Comparable directly to link state metric)
        TOS: 0
        Metric: 5
        Forward Address: 4.4.4.4
        External Route Tag: 0


Command show type 7 LSA. Cho biet gia tri cost adver vao tu ASBR


Cost 5.5.5.5 -> R4 = 5

OSPF summary

Cho topology:  

+ R1 có 4 mạng loop back: 
  • 1.1.1.1/24
  • 1.1.2.1/24
  • 1.1.3.1/24
  • 1.1.4.1/24
Redistribute connected vào network ospf.

R4#show ip route
     1.0.0.0/24 is subnetted, 4 subnets
O E2    1.1.1.0 [110/20] via 10.1.23.2, 00:04:24, Serial0/0
O E2    1.1.2.0 [110/20] via 10.1.23.2, 00:04:24, Serial0/0
O E2    1.1.3.0 [110/20] via 10.1.23.2, 00:04:24, Serial0/0
O E2    1.1.4.0 [110/20] via 10.1.23.2, 00:04:24, Serial0/0

Thực hiện summary  4 mạng trên, thực hiện trên R3.

Chú ý: khi thực hiện summary ta thực hiện command
 + area {} range {}  trên ABR   //are cua route quang ba vao.
 + summary {} trên ASBR

Config R3:
Những route nằm trong dải summary sẽ bị suppress.
IOS sets the AD to 110 for internal discard routes and 254 for external discard routes.
IOS XR sets the AD to 254 for all discard routes, allowing another protocol to preempt the network range ifpresent.