Unit 4 · Addressing Network Devices

4.2Number systems (needed for IP addressing)

Binary uses digits 0 and 1. Each position in an octet (8 bits) has the value:

1286432168421

Decimal to binary: 192 = 128 + 64 = 11000000. 172 = 128 + 32 + 8 + 4 = 10101100.

Place valueBit128164032116081412010128 + 32 + 8 + 4 = 172
Each bit in an octet has a place value; add the values of the 1 bits to get the decimal number

Binary to decimal: 00001010 = 8 + 2 = 10.

Hexadecimal (base 16) uses 0-9 and A-F; each hex digit is 4 bits (A = 1010, F = 1111).

Why binary matters for IP addressing

Every IPv4 address and every subnet mask is really a pattern of 32 bits. Decimal (192.168.1.10) is only a human-friendly view. Subnetting, VLSM and CIDR all mean "count bits and draw a line between the network part and the host part". If you can convert one octet between decimal and binary, you can check any mask by hand.

Place values in one octet

Bit position76543210
Place value1286432168421

To convert decimal to binary, subtract the largest place value that still fits, write 1, and continue; write 0 where it does not fit.

To convert binary to decimal, add the place values of every 1 bit: 10101100 = 128+32+8+4 = 172.

Hexadecimal shortcuts

Each hex digit is exactly 4 bits, so two hex digits make one byte. That is why MAC addresses are written in hex (00:1A:2B) and why IPv6 uses hex groups. Useful nibble values:

HexBinaryDecimal
000000
910019
A101010
C110012
F111115

Try it: convert 255 and 128 to binary, then convert 11000000 and 00001111 to decimal. You should get 11111111, 10000000, 192 and 15.

Remember

  • One octet = 8 bits; place values are 128, 64, 32, 16, 8, 4, 2, 1.
  • Subnetting is bit arithmetic dressed up as decimal numbers.
  • Hex is a short way to write binary; one hex digit = 4 bits.