I have my 172.16.0.0/16, 172.17.0.0/16, 172.18.0.0/16, and other prefixes in the Router B routing table with /16 subnet and I want to send prefixes shared in the image with /24 subnet.
So after all it is not that simple as you've outlined in your first post, thus my suspicion that I was missing something was correct
But it is nevertheless strange - although the router adds the routes learned via dynamic routing protocols with high
distance values by design, the prefix length is taken into account first. So for a destination address 172.21.x.y, a route to 172.21.0.0/24 with
distance=110 wil be chosen although a route to 172.21.0.0/16 with
distance=1 exists. I.e. my suggestion to add just a route to 172.16.0.0/12 cannot work as you have added those /16 routes that shadow the /12 one, but OSPF should shadow those /16 ones by /24 ones.
So we have two mysteries now - why do you need those /16 routes at all, given that no other destinations within 172.16.0.0/12 than the /24 ones are shown on your diagram, and why OSPF does not shadow them.
I don't have any IP routing in Router A and all prefixes are routed in Router B and just want to send a few prefixes with /24 to Router A and also apply NAT and QoS policy on them in Router A.
Here I am confused. If you add an address from some subnet to a router, a route to that subnet is added dynamically as well. If you add addresses from multiple subnets, the hosts in these subnets can use the router's addresses in their own subnets as gateways to the other subnets.
So if we forget all the above, which stems from my initial understanding of your post - maybe I got it totally wrong and what you actually have in mind is that you want all the hosts in all the subnets (including 172.20.0.0/24 and 172.21.0.0/24) to stay connected to CCR2 and use it as their gateway, but you want the hosts in 172.20.0.0/24 and 172.21.0.0/24 to access the internet via CCR-1, using its internet uplink?