Hello ,
Router id in ospf is a 32 bits value in Dotted Decimal format ( Like an IP address) Ex: 0.0.0.1 ; 0.0.0.2 ; 1.1.1.1
So theory say that the router ID is selected according to the following rules:
1 - Prefer the router id configured manually in ospf
[AR1] ospf 1 router-id 0.0.0.1
2- Prefer the router id configured manually globally
[AR1] router id 0.0.0.1
3- Prefer the highest numerical value of your loopback interfaces
4- Prefer the highest numerical value of your physical interfaces
NOTE: Interfaces that are in administratively down state (you shutdown it) are excluded in election.
this is the theory , in real world it doesnt work like this
most Huawei Routers, when you configure the first ip address in the router ( physical or loopback) , your router will pick up this address as router id
example
[AR1] int gi0/0/0
[AR1-GigabitEthernet0/0/0] ip address 10.0.0.1 24
[AR1-GigabitEthernet0/0/0] quit
[AR1] interface LoopBack 0
[AR1-LoopBack0] ip address 1.1.1.1 32
now if you refer to the theory 1.1.1.1 will be the router id but in real world your router will use 10.0.0.1
because the first ip address configured in your router will be the global router id
you can verify it by using this command
display router id
this is why it's recommended to assign it manually with
[AR1] ospf 1 router-id 0.0.0.1