Routing configuration - OSPF, VLAN


Full name: Open Shortest Path Firs

1, Basic concepts

​ 1) Basic information

​ Multicast sending:
​ Standard link state routing protocol -- transfer topology between routers
​ Version: ospfv2 -- IPv4 -- OSPFv3 -- IPv6
​ Update method: trigger update; There is an update cycle of 30min
​ OSPF network needs structured deployment: 1. Region division 2. IP address planning
​ Distance vector characteristics of link state routing protocols -- intra region transmission topology and inter region transmission routing table
​ Priority 10 cost value = reference bandwidth ÷ interface bandwidth

2) OSPF packet

hello package: used to discover, establish and keep alive (10s) neighbor relationships. There is a unique router ID in the whole network, which is used for the identity of the router and expressed in the form of IP address.
DD package: Database Description.
LSR: link status request.
LSU: link status update.
LSAck: link status confirmation.

3) OSPF state machine:
down: protocol not started. Once the protocol is started and the hello package is issued, the next state is entered immediately
init: the state of waiting for a reply from a neighbor. If the received hello package carries its own RID, it will enter the next state together with the other party
2-way: indicates the establishment of neighbor relationship
Condition matching: if successful, enter the next status; If it fails, only the hello package is kept alive
exstart: pre start, compare RID with fake DD message, and the larger one has priority to enter the next state.
exchange: DD message exchanged by both parties
loading: use LSR/LSU/LSAck to obtain unknown path topology or route
full: the adjacency relationship is established and the convergence is completed

4) OSPF working process
After starting the protocol, the local device sends out hello packets based on multicast, finds and establishes neighbor relationships, and generates neighbor tables;
After that, condition matching is carried out. If it is successful, it will enter the next state; If it fails, only the hello package will be kept alive for 10s.
The one with the higher RID has the priority to enter the next state. First exchange the DD, and then use LSR/LSU/LSACK to collect the unknown LSA and generate LSDB -- database table
Based on this LSDB, the device uses the SPF algorithm to calculate the best path to the target, generate a routing table, and complete the convergence.
Keep alive for 10s and compare DD periodically for 30min

​ Network structure changes:
​ 1. Add & disconnect: the equipment with direct connection changes can be improved through DBD/LSR/LSU/LSACK.
​ 2. The device cannot communicate: hello 10s keep alive dead time 40s -- after the timing is over, delete the neighbor relationship and all paths learned from the neighbors.

​ Explanation of terms:
​ LSA: link status announcement - topology information or route information sent in OSPF
​ LSDB: link state database, a collection of LSA S

5) Area division rules:
1. You must have area 0 (backbone area), and all non backbone areas must be directly connected to the backbone area.
2. Must have ABR -- area boundary router.

6) OSPF routing rules:
If there are multiple paths to a certain target, it is preferred to select the path with the smallest sum of Cost through the control interface
Control level: the direction of the origin of the road; Data level: the direction of data going
When the bandwidth is greater than the reference bandwidth, it will lead to poor channel selection.
In the routing table:
All paths calculated by OSPF are represented by OSPF; OSPF priority is 10; Cost = reference bandwidth ÷ input interface bandwidth. By default, the reference bandwidth is 100Mbits / s < --- > note the unit.

​ It can be solved by modifying the reference bandwidth. Note: the modification of the reference bandwidth needs to be consistent across the network.

7) A. conditions for becoming adjacency relations -- focus on network types
Point to point: there can only be two nodes in a network --- string line -- > if it is a point-to-point network type, the adjacency relationship will be established directly from the neighbor relationship.
MA (multiple access): there is no limit on the number of nodes in a network -- Ethernet -- > if the network type is Ma, the DR/BDR role needs to be elected. In order to eliminate repeated updates, the election time is 40s. All other routers without defined roles become DROther

B. Relationship among DR, BDR and other

​ DR and DROther are adjacency; BDR and DROther are adjacency; DROther and DROther are neighbors; DR and BDR are adjacency
C. election rules:
​ 1. Interface priority: by default, the interface priority of all routers is 1, which is superior
​ 2. Compare the advantages of router ID
​ D. DR/BDR election is non preemptive; You can control the election by modifying the priority of the interface of the equipment participating in the election. You can change the priority of the interface to 0 and it will take effect directly. However, all interface priorities cannot be changed to 0.

8) Extended configuration

1. Default route: configured on the border router connecting the operator - non mandatory distribution default: if you want to distribute successfully, there must be a default route in your own routing table.

2. Silent interface: only receive but not send OSPF packets. It is generally used to connect the user's interface, and it is prohibited to use it for the interface between routers

2, OSPF configuration

Basic configuration

[r1]ospf 1 router-id  	//Start the protocol and configure the process number. At the same time, you can choose to configure the RID of the router.
								If it is not configured, the router can choose by itself, and the loopback interface is the largest>Maximum physical interface	
	Announcement: 1. Activate interface 2. Publish topology or route 3. Region division
	[r1-ospf-1]area 0	  		//Access area
  Unmask: 32-bit binary, expressed in dotted decimal system, composed of continuous 0 and continuous 1. If the unmask is 0, it means IP The corresponding bit is fixed; If it is 1, it means variable.

Modify bandwidth:

[r1]ospf 1	
[r1-ospf-1]bandwidth-reference ?
  INTEGER<1-2147483648>  The reference bandwidth (Mbits/s)---Pay attention to the unit when modifying
[r1-ospf-1]bandwidth-reference 10000   			//Modify reference bandwidth

Modify priority control election:

[r1]interface GigabitEthernet 0/0/0	
[r1-GigabitEthernet0/0/0]ospf dr-priority *		//Modification priority is*	
<r1>reset ospf 1 process    					//Restart OSPF process

Default route:

Non mandatory
[r1]ospf 1
[r1-ospf-1]default-route-advertise	 		 //Non mandatory distribution default
[r1]ospf 1	
[r1-ospf-1]default-route-advertise always 	 //Forced distribution default

Silent interface:

[r1]ospf 1
[r1-ospf-1]silent-interface GigabitEthernet 0/0/1    //Silent interface

Neighbor table:

After the device starts OSPF, use to send a hello package, discover and establish a neighbor relationship, and generate a neighbor table;

<r1>display ospf peer brief   					//View neighborhood summary

	 OSPF Process 1 with Router ID   	//Own information
		  Peer Statistic Information
 Area Id          Interface                        Neighbor id      State          GigabitEthernet0/0/1             Full          GigabitEthernet0/0/2             Full        
 Neighbor's area ID     Local connection neighbor interface               Neighbor's RID       Status of and neighbors

In Huawei equipment OSPF region ID Representation of:
Neighbor's area ID: area 0--->
			area 12345--->

LSCB table:

When the device uses DD/LSR/LSU/LSAck data packet to collect all unknown LSAS, LSDB -- link state database table (set of LSAS) is generated locally

<r1>display ospf lsdb    			//View local LSDB table

	 OSPF Process 1 with Router ID
		 Link State Database 

 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router            502  48    80000007       1
 Router            863  48    80000006       1
 Network            863  32    80000002       0
 Sum-Net            796  28    80000001       2
 Sum-Net            856  28    80000001       1

Routing table:

Based on the local LSDB, the SPF algorithm is used to calculate the best path to the target network segment and generate the routing table.

<r1>display ip routing-table protocol ospf   //View only the routing entries learned by OSPF
Route Flags: R - relay, D - download to fib
Public routing table : OSPF
         Destinations : 3        Routes : 3        

OSPF routing table status : <Active>
         Destinations : 3        Routes : 3

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface  OSPF    10   2           D      GigabitEthernet0/0/1  OSPF    10   3           D      GigabitEthernet0/0/1  OSPF    10   2           D      GigabitEthernet0/0/1

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0

1. Concept: virtual LAN, isolation of broadcast domain (logically dividing the original broadcast domain into multiple broadcast domains) -- by creating different VLANs on the switch and dividing the impassable interfaces into corresponding VLANs, the switch can send data according to different VLANs during flooding to realize the isolation of broadcast domain. VLAN 1 exists on the default switch, and all interfaces belong to VLAN 1 by default

2. Configuration Basics

​ 1. Create VLAN

​ (range of VLAN creation: 1-4094)

[sw1]vlan 10  										//Create separately
[sw1]vlan batch ** to **   							//Batch create * * - * * VLAN
[sw1]display vlan   								//Check the vlan and the ownership of the interface
[sw1]display vlan summary 							//View the created summary

​ 2. Interface into VLAN

​ access: if an interface is set to this type, it can only belong to one VLAN, which is generally used to connect the user's interface.

		*****The first configuration mode*****
[sw1]interface GigabitEthernet 0/0/1  				//Access interface
[sw1-GigabitEthernet0/0/1]port link-type access
						Link type access type
[sw1]interface GigabitEthernet 0/0/2
[sw1-GigabitEthernet0/0/2]port link-type access 
[sw1-GigabitEthernet0/0/2]port default vlan 10

*****The second configuration method (the interface type must be modified to access)*****
[sw1]vlan 10
[sw1-vlan10]port GigabitEthernet 0/0/1	
[sw1]interface range g 0/0/3 to g 0/0/10  //Batch entry interface
[sw1-GigabitEthernet0/0/2]port link-type access 
[sw1-GigabitEthernet0/0/2]port default vlan 10

​ 3. TRUNK road

​ Trunk: if an interface type is changed to trunk, the interface does not belong to any VLAN, but allows all VLAN data to pass through (by default, all VLANs cannot pass through, and the VLAN number allowed to pass through needs to be manually specified).

Posted by wpsa on Mon, 02 May 2022 19:34:01 +0300