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
| Command | Mode | Purpose |
|---|---|---|
| interface gigabitethernet0/0 | config | Enter interface configuration mode. |
| ip address 192.168.1.1 255.255.255.0 | config-if | Assign an IPv4 address and mask to the interface. |
| no shutdown | config-if | Enable the interface. |
| ip address dhcp | config-if | Obtain an IPv4 address via DHCP. |
| description Link to R2 | config-if | Add a text label for documentation. |
| ip address 192.168.1.5 255.255.255.0 secondary | config-if | Assign a secondary IP address to the interface. |
| hostname R1 | config | Set 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.