Search code examples
network-programmingipprefix

IP addressing - Network prefix - Help understanding


I am currently studying for an IT exam, and looking into IP addressing. I have thus come across the following question:

For a given class C network 194.1.2.3, what is the network prefix?

I know this is a fairly simple, theoretical question, but I need to understand why. So far, I have the following working:

IPv4 applies dotted-decimal notation to divide the 32-bit address into four 8-bit fields (for readability).

Furthermore, the IP address space (not sure if right term) is divided into three classes (A, B, and C) to support networks of different sizes (classful addressing).

XXXX . XXXX . XXXX. XXXX

I also know the following:

Address Class A    A(/8 prefixes)
Address Class B    B(/16 prefixes)
Address Class C    C(/24 prefixes)

I have thus concluded that 194.1.2 constitutes the network prefix of the given class C network, seeing that these make up the first 24 bytes.

Is this correct; and if so: Would the prefix for class A and class B networks be 194 and 194.2 respectively?

Thanks in advance!


Solution

  • Classful networking was deprecated over 20 years ago, and I don't understand why it is still taught since nothing uses it anymore.

    The network class has noting to do with the network mask, but the classes have default masks.

    • Class A network addresses start with the first bit as 0, giving you 0.0.0.0 to 127.255.255.255 as the Class A address range. The default mask for Class A networks is 255.0.0.0.
    • Class B network addresses start with the first two bits as 10, giving you 128.0.0.0 to 191.255.255.255 as the Class B range. The default mask for Class B networks is 255.255.0.0.
    • Class C network addresses start with the first three bits as 110, giving you 192.0.0.0 to 223.255.255.255 as the Class C range. The default mask for Class C addresses is 255.255.255.0.
    • Class D addresses start with the first four bits as 1110, giving you the 224.0.0.0 to 239.255.255.255 as the Class D range. Class D addresses are used for multicast, and multicast doesn't normally use masks since multicast groups are subscribed to individually.
    • Class E addresses start with the first four bits as 1111, giving you the 240.0.0.0 to 255.255.255.255 as the Class E range. Class E addresses are reserved/experimental so they don't have a default mask, except for the Limited Broadcast address of 255.255.255.255 which is a host address with the mask of 255.255.255.255.