Ip address and netmask

If the Netmask's last octet's first three bits are set then is it compulsory the ip adresses of those netmask has also last octet's first three bits set?

4Comments
Sumit Verma @sumitkgp
12 Jan 2017 04:37 pm

Please elaborate a little bit. I didn't get the question.

Suman @suman08513
12 Jan 2017 05:40 pm

No. It is not compulsory. In routing table, that is how routing happens. According to my understanding of your question, the prefix will be in the form IP-Address/27(since last octet 3 bits set. Means we r using 27 bits for mask).

 

Now coming to your question, if the incoming packet has IP of the for x.y.z.a now the router matches it with every prefix it has( i.e MASKING. Incoming IP AND Subnet Mask).

This way after masking the incoming IP matches with and entry in the routing table. Then the routing table decides that the IP packet belong to that Network.

A MASK is usually used to decide what id the netid. It doesn't enforce anything on the IP address of host.

karmjit joshi @karmjitjoshi
12 Jan 2017 05:43 pm

Suppose computers A and B have IP addresses 10.105.1.224 and 10.105.1.226 respectively and they both use the same netmask N.The last octets of IP addresses of A and B are 224 (11100000) and 226 (11100010) then its compulsory that netmask N has also last octet' first three bit 111?

Suman @suman08513
12 Jan 2017 06:04 pm

See my explanation was related to routing process where a router can have multiple IP address(i.e the network ids) and associated network masks. An incoming IP can match with multiple networks i.e after applying MASK. Then the router send the packet to the network mask of longest length(Longetst Prefix Matching Algorithm).

Now coming to ur explanation above. according to ur answer the network mask is 255.255.255.224(since last 3 bits are set). So we are talking about a LAN here. Availabe IP addresses will be 10.105.1.224(11100000) to 10.105.1.255(11111111). What we do here??

We select a mask according to our organisation requirements and assign each host a different IP.

This case every host id should have the IP address with first 3 bits in lasr octet set.

If your earlier question was this. then yes. Didn't understnd ur question properly..