Hello @Mohd Nasir,
You could implement HA and redundancy mechanisms in your topology.
Initially, Router B should be the active router for the virtual IP address, and traffic flows through it.
If Router B's outgoing interface goes down (monitored by tracking), Router B's HSRP/VRRP priority decreases, and Router A becomes the active router.
Switches X, Y, and Z still have two paths available to reach both routers. However, the HSRP/VRRP change ensures that traffic flows through Router A.
Configure HA:
Set up HSRP or VRRP on Router A and Router B for the LAN segment connected to switches X, Y, and Z.
Assign a virtual IP address as the default gateway for the devices in switches X, Y, and Z. This virtual IP address should be shared between Router A and Router B.
Configure Router B Interface Tracking:
On Router B, configure interface tracking. This means that Router B will monitor the status of its outgoing interface. When the interface goes down, Router B will decrement the HSRP/VRRP priority.
When Router B's priority becomes lower than Router A's priority, Router A will become the active router for the virtual IP address.
Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.