Have ideal, have ambition, know self-discipline, believe in the near future you will succeed!

Open wechat search [children go to school], pay attention to this is not the same programmer.

A brief overview of OSPF

OSPF is a link-state routing protocol. Using the link-state routing protocol, the data transmission of routes is not affected even if there is a loop on the network, and stable routing control is implemented.

In addition, OSPF supports subnet masks. Therefore, the routing control of the network that cannot implement the variable-length subnet structure in RIP becomes a reality.

To reduce network traffic, OSPF also introduces the concept of “area”. An area divides an autonomous network into several smaller areas. Therefore, unnecessary switching between routing protocols can be reduced.

1.1 OSPF is a link-state routing protocol

OSPF is a link-state router. The link status of routers generates network topology information, and then generates routing tables based on the topology information.

Which network or which router is connected to the information needs to be passed through the relay form, so that each router knows the information between routers.

OSPF controls the topology of the entire network and can find the shortest path to determine the final route selection.

For RIP route selection, the minimum number of routers should be as many as possible. In contrast, OSPF can assign a weight (also called a cost) to each link and always select the path with the least weight as the final route.

1.2 Basic KNOWLEDGE of OSPF

In OSPF, routers connected to the same link are called adjacent routers. In a relatively simple network structure, for example, if each router is connected to only one route, neighboring routes can exchange routing information. So the disadvantage is obvious, if this is a complex network topology, each exchange of routing information will be very large. And when the network is relatively stable, it also needs to exchange regularly, which wastes the network bandwidth to some extent.

OSPF can be divided into five types of packets based on functions.

By sending hello packets to confirm the connection, each router sends routing summary and version information to each other using database description packets to synchronize routing control information. If the version is too old, a link-state request for ROUTING control information is first sent, then the link-state update packet receives the routing state information, and then the link-state confirmation packet notifying everyone that the routing control information has been received locally.

1.3 Working principle of OSPF

The protocol for confirming the connection in OSPF is called the Hello protocol.

The LAN sends a Hello packet every 10 seconds. If no hello packet arrives, the LAN determines whether the connection is disconnected. To be specific, it is allowed to wait for three times, and the connection is considered to have been broken if there is no doting until the fourth time.

2. Features of OSPF

  • OSPF can be used on large networks
  • No route loop
  • Use bandwidth as the measurement value
  • Fast convergence
  • Efficient network management through partitioning

Experiment of OSPF single area configuration

3.1 Network Topology

3.2 IP Address Configuration

R2 configuration

<Huawei>system-view Enter system view, return user view with Ctrl+Z. [Huawei]undo info [Huawei]undo info-center ena [Huawei]undo info-center enable Info: Information center is disabled. [Huawei]inter [Huawei]interface g0/0/1 [Huawei-GigabitEthernet0/0/1]ip add [Huawei-gigabitethernet0/0/1] IP address 192.168.1.254 24 [Huawei-gigabitethernet0/0/1] Inter G0/0/0 [Huawei-gigabitethernet0/0/0] IP add [Huawei-gigabitethernet0/0/0] IP address 192.168.2.1 24Copy the code

R1 configuration

<Huawei>sys <Huawei>system-view Enter system view, return user view with Ctrl+Z. [Huawei]undo if [Huawei]undo info [Huawei]undo info-center en [Huawei]undo info-center enable Info: Information center is disabled. [Huawei]inter [Huawei]interface g0/0/0 [Huawei-GigabitEthernet0/0/0]ip add [Huawei-gigabitethernet0/0/0] IP address 192.168.2.2 24 [Huawei-gigabitethernet0/0/0] Inter G0/0/1 [Huawei-gigabitethernet0/0/1] IP add [Huawei-gigabitethernet0/0/1] IP address 192.168.3.1 24Copy the code

R3 configuration

<Huawei>sys <Huawei>system-view Enter system view, return user view with Ctrl+Z. [Huawei]undo info [Huawei]undo info-center ena [Huawei]undo info-center enable Info: Information center is disabled. [Huawei]inter [Huawei]interface g0/0/0 [Huawei-GigabitEthernet0/0/0]ip ad [Huawei-gigabitethernet0/0/0] IP address 192.168.3.2 24 [Huawei-gigabitethernet0/0/0] Inter G0/0/1 [Huawei-gigabitethernet0/0/1] IP add [Huawei-gigabitethernet0/0/1] IP address 192.168.4.254 24Copy the code

3.3 OSPF configuration

R1 configuration

[Huawei] Ospf 1 # Set the OSPF process number to 1. [Huawei-ospf-1]area 0 # Set the OSPF area 0 [Huawei - ospf - 1 - area - 0.0.0.0] netwo [Huawei - ospf - 1 - area - 0.0.0.0] network 192.168.2.0 0.0.0.255 [Huawei - ospf - 1 - area - 0.0.0.0] netwo [Huawei - ospf - 1 - area - 0.0.0.0] network 192.168.3.0 0.0.0.255Copy the code

The network 192.168.2.0 0.0.0.255

] network 192.168.3.0 0.0.0.255

The preceding two commands advertise networks 192.168.2.0 and 192.168.3.0 to OSPF, and 0.0.0.255 is the inverse mask of the network.

R2 configuration

[Huawei] Router ID 2.2.2.2 [Huawei]ospf 1 [huawei-ospf-1]area 0 [huawei-ospf-1-area-0.0.0.0]net [huawei-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255 [Huawei-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255Copy the code

R3 configuration

[Huawei] Router ID 3.3.3.3 [Huawei]ospf 1 [huawei-ospf-1]area 0 [huawei-ospf-1-area-0.0.0.0]net [huawei-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255 [Huawei-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255Copy the code

Iv. Test of experimental results

Five, the last

Based on the above experiments, we can see that OSPF and RIP are similar in that they advertise the protocol to the network segment adjacent to the route. However, the two algorithms are different. OSPF uses the minimum weight (cost), while RIP uses the minimum path. OSPF is more powerful and can support variable-length subnet masks and so on.

I am a reader, a person who focuses on learning. The more you know, the more you don’t know!

In the next installment, we will describe the multiple area configuration of OSPF.