Hello everyone,

I am have some difficulty trying to understand how to find subnet mask, broadcast and network address.

How do I calculate that given an IP address? for example IP: ?

Dani AI

Generated

asked how to get the subnet mask, network and broadcast for the example 123.65.47.62/22. 's netmask table is useful; the following is a short worked example and a quick method to reproduce it for any CIDR.

For /22:

  • Subnet mask = 255.255.252.0
  • Network address = 123.65.44.0
  • Broadcast address = 123.65.47.255
  • Usable host range = 123.65.44.1 through 123.65.47.254 (1022 usable hosts)

Worked steps (decimal approach):

  • /22 means 22 bits of 1s -> mask 11111111.11111111.11111100.00000000 -> 255.255.252.0.
  • Apply bitwise AND between the IP and mask: 123&255=123, 65&255=65, 47&252=44, 62&0=0 -> network 123.65.44.0.
  • Wildcard (host) bits = inverse of mask = 0.0.3.255. Broadcast = network OR wildcard -> 123.65.47.255.
  • Hosts = 2^(32-22)-2 = 1022 (exceptions noted below).

Quick mental tricks and cautions:

  • For masks that split on an octet boundary, use the octet increment: /22 leaves 256-252 = 4 so networks step every 4 in the third octet (0,4,8,...,44,...).
  • Usable-host formula 2^(32-prefix)-2 applies except for /31 (RFC 3021 permits two-host point-to-point) and /32 (single-host route).
  • Modern OS tools (ipcalc, ip addr, ifconfig, ipconfig) show both CIDR and dotted-decimal masks; this explanation complements 's table by showing how the numbers are derived rather than only looked up.

Recommended Answers

All 2 Replies

Hello,

Attached is a table of netmask based on the network selected.

thank you very much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.