During the Database exchange neighbors determine which router is to be the Master and which is to be the Slave. These roles determine the responsibility of a router during the exchange process.
Masters are only allowed to send DBD packets on its own accord as well as increasing the sequence numbers.
Slaves are allowed to send DBD packets only in response to a DBD packet from the master router.
DBD packets contain the following header flags in addition to others:
- Master (MS) flag – this flag is turned on in all packets sent by the master, and cleared in all packets sent by a slave
- More (M) flag – Set when a router sends subsequent DBD packets after the last one.
- Init (I) flag – This indicates the initial DBD packet sent to start the DBD exchange, subsequent packets have this flag cleared.
So how do the rules of a slave get satisfied if a slave has additional LSAs that the Master does not? What if the slave has no additional routes the master needs, what will the LSA look like in response to that kind of request?
The first rule requiring the slave to respond to the master is easy, if there are no additional LSAs to be learned when the master polls the slave, the slave will simply send an empty DBD packet.
The second involves the M flag, where a Master needs additional LSAs to update its DBD, The slave sets the M flag in DBD responses to let the Master know that it needs to continue sending subsequent DBD packets. When there are no more the slave needs to send, the slave clears the M flag and begins sending empty DBD packets.
When both have completed their DBDs, the M flag is set in the DBD message on both the Master and Slaves packets, this is the indicator that syncing has been completed.
The actual selection is performed when routers go into the Exstart state, both routers consider themselves the master and sends an empty DBD packet to the neighbor. Once both DBD packets have been received the router with the lower RID will become the Slave and send an empty DBD packet back to the neighbor with the MS and I flags cleared and adjusts the sequence number to the same number of the Masters packet.