1 thg 2, 2010

OSPF củng cố kiến thức lại nào.

Distance vector và link state
Khi ta học về giao thức distance vector thì router học đường đi nhờ neighbors [định tuyến theo tin đồn, neighbors bảo gì nghe nấy như RIP]. Giao thức distance chỉ tin cậy thông tin route của neighbor.
Học qua EIGRP thì có tiến bộ hơn tí là nó nghe tin đồn nhưng nó còn xác nhận lại để xem có đúng hay không [ở đây là xem đường nào tốt hơn]. EIGRP thì nhanh hơn nhưng chỉ hỗ trợ sản phẩm cisco.

Có một giao thức khác khá hơn 2 cái kia nhưng hơi tốn performance một chút, hỗ trợ đa chủng loại sản phẩm là OSPF. OSPF thì không nghe tin đồn như những giao thức kia mà nó lấy toàn bộ thông tin về state [trạng thái: links của router đó, interfaces, những neighbor của router đó, và trạng thái up/down,ip, subnet,…] của thằng gốc copy vào link state database của nó rồi tự tìm ra đường đi tốt nhất cho mình bằng thuật toán shortest-path-frist [hay còn gọi là Dijkstra].

Những con biên [ABR: area border router] nằm giữa nhiều biên có bản topology cho nhiều vùng khác nhau. Nó chỉ gửi tuyến route summary từ area khác ra cho area0 [backbone].

Nhưng trước khi trao đổi thông tin thì nó cần phải thiết lập một mối qua hệ gọi là neighbor. Quan hệ neighbor sẽ được thiết lập nhờ vào gói những gói hellos.

Khi router nhận gói hello từ neighbor thì nó kiểm tra:
  • Area ID
  • Authentication
  • Networkmask [subnet mask phải giống nhau]
  • HelloInterval, DeadInterval timer [trong môi trường broadcast là hello 10’, và Nonbroadcast là 40’. DeadInterval gấp 4 lần hello]. Sau thời gian dead mà không nhận được hello thì bỏ neighbors.
  • Cờ stub
  • Và một số option cấu hình trên interface nhận vào gói hello.

Khi trở thành neighbor thì các router có thể trao đổi các gói update cho nhau. Nhưng nếu như vậy thì sẽ tốn một lượng băng thông rất lớn vì một con sẽ cần trao đổi với tất cả các con còn lại.
=> Có n(n-1)/2 các quan hệ gần [adjacencies] với nhau.
Vì vậy cần tồn tại một quá trình để bầu chọn con chính [DR], chỉ có con chính là quan hệ được với các con khác, và một con phụ là BDR để backup con chính khi nó chết.







Quá trình bầu chọn DR, BDR có thể xảy ra trên môi trường Broadcast và NBMA networks.

Quá trình hình thành full adjacency có thể diễn ra qua 7 quá trình cơ bản sau.
Có 2 router A và B với Router ID tương ứng là a và b.

1.Down state
Hai router mới gắn vào và cấu hình thì ở trạng thài Down state
[router không nhận được thông tin từ router cận kề]

2. Init State
Chỉ có 1 router gửi gói tin hello và router kia nhận được nhưng chưa biết router ID của chính nó nên chỉ là 1 chiều. [one way]

3. Two-way state
1 router gửi có router ID của nó, router kia nhận được và hồi đáp lại với router ID của nó. Ở trong trạng thái này nếu ở môi trường Ethernet [hay còn gọi là multiaccess, hoặc broadcast] cũng bầu chọn luôn DR và BDR.

**Router có ưu tiên lớn nhất là DR, lớn nhì là BDR.
Ưu tiên theo thứ tự sau:
  • cấu hình priority [ip ospf priority]
  • cấu hình router ID bằng lệnh [router ID]
  • Loopback có IP cao nhất
  • interface vật lí có IP cao nhất

Router có priotity là 0 thì không tham gia vào quá trình bầu chọn DR/BDR.

1 nhận xét:

  1. 1.Tất cả các router tự xem nó là DR và BDR của mạng đó [thỏa dk priority > 0 và twoway]

    2.Vì DR sẽ không thể là BDR được nên lựa ra những con nào không yêu cầu nó là DR [trong cùng subnet]

    3.Nếu có một hoặc nhiều neighbor trong subnet mà có interface chúng nằm trong trường BDR, con có priority cao nhất sẽ được bầu.
    Nếu bị trùng priority thì xét tiếp đến router ID cao nhất sẽ là BDR.

    4
    Nếu không có một hoặc nhiều neighbor trong subnet đó đòi làm BDR, con có priority cao nhất sẽ được bầu.
    Nếu bị trùng priority thì xét tiếp đến router ID cao nhất.

    5.Nếu có một hoặc nhiều neighbor trong sub mà có int chúng nằm trong trường DR, con có priority cao nhất sẽ được bầu.
    Nếu bị trùng priority thì xét tiếp đến router ID cao nhất sẽ là DR.

    6.
    Nếu không có router nào là DR thì còn BDR được chọn gần đây nhất sẽ là DR [nguyên đám hồi nãy đã nằm hết trong subnet bầu chọn BDR nên bước 4 bầu chọn DR sẽ không thể có được]

    Kế tiếp nó lại lặp lại bước 1 đến bước 2 đến bước 4 để chọn lại tiếp BDR.




    The election procedure of the DR and BDR is as follows:
    1.
    After two-way communication has been established with one or more neighbors, examine the Priority, DR, and BDR fields of each neighbor's Hello. List all routers eligible for election (that is, routers with priority greater than 0 and whose neighbor state is at least two-way); all routers declaring themselves to be the DR (their own interface address is in the DR field of the Hello packet); and all routers declaring themselves to be the BDR (their own interface address is in the BDR field of the Hello packet). The calculating router will include itself on this list unless it is ineligible.


    2.
    From the list of eligible routers, create a subset of all routers not claiming to be the DR (routers declaring themselves to be the DR cannot be elected BDR).


    3.
    If one or more neighbors in this subset include its own interface address in the BDR field, the neighbor with the highest priority will be declared the BDR. In a tie, the neighbor with the highest Router ID will be chosen.


    4.
    If no router in the subset claims to be the BDR, the neighbor with the highest priority will become the BDR. In a tie, the neighbor with the highest Router ID will be chosen.


    5.
    If one or more of the eligible routers include their own address in the DR field, the neighbor with the highest priority will be declared the DR. In a tie, the neighbor with the highest Router ID will be chosen.


    6.
    If no router has declared itself the DR, the newly elected BDR will become the DR.


    7.
    If the router performing the calculation is the newly elected DR or BDR, or if it is no longer the DR or BDR, repeat steps 2 through 6.


    In simpler language, when an OSPF router becomes active and discovers its neighbors, it checks for an active DR and BDR. If a DR and BDR exist, the router accepts them. If there is no BDR, an election is held in which the router with the highest priority becomes the BDR. If more than one router has the same priority, the one with the numerically highest Router ID wins. If there is no active DR, the BDR is promoted to DR and a new election is held for the BDR.


    Còn để kiểm nghiệm thì để mai tui lại post lệnh debug cho.

    Trả lờiXóa