Classless Interdomain Routing (CIDR) takes, in addition to a 32-bit IPv4 IP address, a prefix to tell the cut-off of the network ID.
IP header has room only 32-bit address fields.
And, an IP address can match two classless addresses: Eg. the IP address 222.10.5.11 would match both 222.10.0.0/21 and 222.10.5.0/23.
My Q is:
When a router R1 receives a packet addressed to host 222.10.5.11 of network 222.10.0.0/21, how does R1 know that this is a classless address and the network prefix is 21? Where is this network prefix written in the IP header?
TIA
//-----------------------------------------
EDIT:
I understand the routing protocols, like OSPF can pass the subnet mask and thus this prefix. But, for forwarding, when an IPv4 packet addressed to 222.10.5.11 comes in, how does IP know that this packet is for the host in 222.10.5.0/23?