IPv4 Addressing and Subnetting

Key Takeaways

  • An IPv4 address is 32 bits divided by the subnet mask into network and host portions; usable hosts per subnet equal 2^h − 2.
  • Classful defaults still matter for exams: Class A /8, Class B /16, and Class C /24, but modern designs use CIDR and VLSM.
  • RFC 1918 private ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16; they require NAT for Internet reachability.
  • Block size equals 256 minus the interesting mask octet; network address is the block start and broadcast is one less than the next block.
  • On Huawei VRP devices, assign addresses with ip address under interface view and verify with display ip interface brief.
Last updated: July 2026

Why IPv4 still dominates HCIA-Datacom

Every campus design, static route, OSPF network statement, ACL match, NAT translation, and DHCP pool on a Huawei network starts from a correct IPv4 plan. H12-811 questions rarely ask you to recite theory only—they ask you to find the network address, count usable hosts, pick a mask that fits a site, or spot a host that is outside its subnet. Build speed with the block-size method and treat classful defaults as exam vocabulary, not modern design gospel.

IPv4 address structure

An IPv4 address is a 32-bit value written as four octets in dotted decimal form (for example, 192.168.10.45). Each octet is 8 bits and ranges from 0 to 255. The subnet mask marks which bits identify the network (binary 1s) and which identify the host (binary 0s). In CIDR notation, /24 means 24 network bits and 8 host bits, which is the same as mask 255.255.255.0.

Two reserved host patterns appear in every calculation:

  • All host bits 0 — network (subnet) address; not assigned to an end host.
  • All host bits 1 — directed broadcast address for that subnet; not a usable host IP on production LANs.

Therefore usable hosts = 2^h − 2, where h is the number of host bits. A /30 leaves only 2 host bits and yields exactly 2 usable addresses—perfect for a point-to-point WAN or router interconnect.

Classful addressing (A/B/C)

Classful addressing is legacy, but the exam still expects recognition of default classes from the first octet:

ClassFirst octet rangeDefault maskDefault prefixLeading bits
A1–126255.0.0.0/80
B128–191255.255.0.0/1610
C192–223255.255.255.0/24110
D (multicast)224–239n/a/41110
E (experimental)240–255n/an/a1111

127.0.0.0/8 is reserved for loopback (not Class A host space). Class D addresses such as 224.0.0.5 (OSPFv2 all-SPF routers) appear later in the routing chapters; they are never used as unicast interface addresses.

Classful thinking fails in modern networks because a Class B site rarely needs 65,534 hosts on one flat segment. CIDR and VLSM let you carve arbitrary prefix lengths regardless of the historic class of the first octet.

RFC 1918 private ranges and special addresses

Private addresses are not globally unique and must not be advertised on the public Internet without translation.

Private rangeCIDRHistoric class feelTypical use
10.0.0.0 – 10.255.255.25510.0.0.0/8Class ALarge enterprises, multi-site cores
172.16.0.0 – 172.31.255.255172.16.0.0/12Class B sliceCampus aggregates
192.168.0.0 – 192.168.255.255192.168.0.0/16Class CSmall LANs, labs, SOHO

Other addresses you must not confuse with RFC 1918:

  • 127.0.0.0/8 — loopback; traffic stays on the host.
  • 169.254.0.0/16 — link-local / APIPA; often means DHCP failed.
  • 0.0.0.0/0 — default route (matches everything).
  • 255.255.255.255 — limited broadcast on the local link.

On Huawei networks, private addressing is normal inside the campus. Border routers use NAT / Easy IP (covered later) when those hosts need Internet access.

Subnet masks, CIDR, and the host table

Memorize the common fourth-octet masks and their usable host counts:

PrefixMaskHost bitsTotal addressesUsable hosts
/24255.255.255.08256254
/25255.255.255.1287128126
/26255.255.255.19266462
/27255.255.255.22453230
/28255.255.255.24041614
/29255.255.255.248386
/30255.255.255.252242
/32255.255.255.255011 (host route)

Number of subnets created when you borrow b bits from the host portion of a larger network is 2^b. Example: starting from a /24 and borrowing 3 bits yields eight /27 subnets.

Block-size method (exam speed skill)

  1. Identify the interesting octet (the first octet that is not 255 or 0 in the mask).
  2. Compute block size = 256 − mask value in that octet.
  3. List network boundaries: 0, block, 2×block, … until 256.
  4. Place the host into the correct block; the network address is the start of that block.
  5. Broadcast = next network − 1 (in address space); usable hosts are everything between network and broadcast.

Worked example 1: host 192.168.5.77 with mask 255.255.255.192

  • Mask /26, interesting octet is the fourth, value 192.
  • Block size = 256 − 192 = 64.
  • Fourth-octet networks: 0, 64, 128, 192.
  • 77 falls in 64–127, so network = 192.168.5.64/26.
  • Broadcast = 192.168.5.127; usable = 192.168.5.65–192.168.5.126 (62 hosts).

Worked example 2: 172.20.5.100/22

  • /22 mask = 255.255.252.0; interesting octet is the third (252).
  • Block size = 256 − 252 = 4.
  • Third-octet steps: 0, 4, 8, 12, …
  • 5 sits in the 4 block → network 172.20.4.0/22.
  • Broadcast 172.20.7.255; host bits = 10 → usable 1022.

Worked example 3: requirement-driven design

A floor needs at least 50 hosts and a router-to-router link needs 2 hosts.

  • Hosts: 2^h − 2 ≥ 50 → h = 6 → /26 (62 usable).
  • Point-to-point: /30 (2 usable).

If the site is given 10.10.0.0/24, allocate the largest need first: 10.10.0.0/26 for the floor, then a free /30 such as 10.10.0.252/30 for the WAN—VLSM in practice.

VLSM basics

Variable Length Subnet Masking means different subnets of one major network use different prefix lengths so address space matches demand. Always:

  1. Sort requirements from most hosts to fewest.
  2. Assign the smallest prefix that still fits each requirement.
  3. Leave unused blocks contiguous for growth.
  4. Document network, mask, gateway, and DHCP range for each segment.

Exam traps:

  • Forgetting to subtract network and broadcast (2^h − 2, not 2^h).
  • Using the broadcast or network address as a host IP.
  • Assuming every Class C is still /24 after subnetting.
  • Miscalculating the interesting octet on non-/24 masks such as /22 or /21.

Huawei VRP address configuration notes

On VRP, interface addressing is configured in interface view:

[Huawei] interface GigabitEthernet0/0/0
[Huawei-GigabitEthernet0/0/0] ip address 192.168.10.1 255.255.255.0
[Huawei-GigabitEthernet0/0/0] undo shutdown

Or with prefix length style where supported: ip address 192.168.10.1 24. Verify with:

  • display ip interface brief — up/down state and primary IPv4 addresses.
  • display ip interface GigabitEthernet0/0/0 — mask, packets, and detailed counters.
  • display ip routing-table — confirms the connected route for the interface subnet appears.

A connected route is installed only when the interface is up and has a valid address. If two interfaces accidentally share overlapping subnets, expect routing or ARP problems—clean subnet design prevents those faults before you ever open a protocol debug.

Exam checklist

  • Convert between dotted mask and CIDR in seconds.
  • Given a host and mask, name network, broadcast, first/last usable.
  • Given host-count requirements, choose the correct prefix.
  • Recognize RFC 1918 vs loopback vs link-local vs multicast.
  • On Huawei gear, know that ip address + display ip interface brief are the daily verification pair for Layer 3 interfaces.

Master these skills now; every later chapter—static routes, OSPF network statements, ACLs, NAT, DHCP pools—assumes you can place an address in the right subnet without hesitation.

Test Your Knowledge

How many usable host addresses are available in an IPv4 /26 subnet such as 192.168.10.0/26?

A
B
C
D
Test Your Knowledge

Host 192.168.5.77 uses mask 255.255.255.192. What is its network address?

A
B
C
D
Test Your Knowledge

Which range is a private IPv4 block defined by RFC 1918?

A
B
C
D
Test Your Knowledge

On a Huawei VRP router, which command best summarizes IPv4 addresses and interface status for quick verification?

A
B
C
D