in Programming in C
87 views
0 votes
0 votes
Find the error of the following IP addresses. If the IP is valid, check its Class and determine whether the address is Unicast or Multicast.

i) 237.15.2.1

ii) 256.1.8.9

iii) 114.34.2.8

iv) 255.254.0.1

v) 8.8.8.8
in Programming in C
87 views

1 Answer

0 votes
0 votes

ClassRange
Class A 1 - 126
Class B128 - 191
Class C192 - 223
Class D224 - 239
Class E240 - 255

Unicast: LSB of 1st byte is 0.

eg. 11101100.10000111.00000010.00000001

Multicast: LSB of 1st byte is 1.

eg. 11101101.10000111.00000010.00000001

Broadcast: All bits are 1.

eg. 11111111.11111111.11111111.11111111

(i) 237.15.2.1  

Valid IP 

Class D (Range: 224 - 239)

11101101.15.2.1    LSB of 1st byte is 1, so Multicast

(ii) 256.1.8.9 

Invalid IP, because the Maximum value of 8-bit is 255, not 256.

(iii) 114.34.2.8

Valid IP

Class A ( Range: 1 - 126)

1110010.34.2.8  LSB of 1st byte is 0, so Unicast.

(iv) 255.254.0.1

Valid IP

 Class E (Range: 240 - 255)

11111111.254.0.1   LSB of 1st byte is 1. So Multicast

(v) 8.8.8.8 

Valid IP

 Class A

00001000.8.8.8   LSB of 1st byte is 0.So it is unicast.