Reference

Core

IPv4 Addressing

IPv4 addresses are 32-bit values expressed in dotted decimal and combined with a subnet mask to separate network and host portions. Correct addressing is the foundation for all routing and switching labs.

What you need to know

  • An IPv4 address has 32 bits split into 4 octets of 8 bits each, range 0-255 per octet.
  • Class A: 1-126 (default mask /8), Class B: 128-191 (/16), Class C: 192-223 (/24); 127.x is loopback.
  • Private ranges (RFC 1918): 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
  • All-zeros host bits identify the network address; all-ones host bits identify the broadcast address.
  • APIPA range 169.254.0.0/16 is used when DHCP fails.
  • A subnet mask or prefix length (CIDR, e.g. /24) defines which bits are network vs host.
  • Every interface used for routing needs an IP address and mask, and must be no shutdown.

Configuration commands

CommandModePurpose
interface gigabitethernet0/0configEnter interface configuration mode.
ip address 192.168.1.1 255.255.255.0config-ifAssign an IPv4 address and mask to the interface.
no shutdownconfig-ifEnable the interface.
ip address dhcpconfig-ifObtain an IPv4 address via DHCP.
description Link to R2config-ifAdd a text label for documentation.
ip address 192.168.1.5 255.255.255.0 secondaryconfig-ifAssign a secondary IP address to the interface.
hostname R1configSet the device hostname for identification.

Verify it

  • show ip interface brief
  • show interfaces
  • show ip interface gigabitethernet0/0
  • show running-config interface gigabitethernet0/0
  • ping 192.168.1.2

Common mistakes

  • Forgetting no shutdown, leaving the interface administratively down.
  • Mismatched masks between two devices on the same link.
  • Assigning an address that duplicates another device on the segment.
  • Confusing the network or broadcast address with a usable host address.
  • Typing the mask in CIDR form where the CLI expects dotted decimal, or vice versa.

Practise IPv4 Addressing in a real CLI

Generated labs, graded against the simulated network state.

Start a free lab