Menu
Coddy logo textTech

Valid or Not

Lesson 8 of 46 in Coddy's IP Addressing and Subnetting course.

Because every octet is one byte, a valid IPv4 address obeys two rules: exactly four numbers joined by dots, and every number between 0 and 255.

That makes bad addresses easy to spot: 192.168.300.5 breaks the range rule, and 1.2.3.4.5 has one octet too many. Typos like these are a classic source of "why can't these machines see each other" tickets, so checking addresses by eye is a real job skill.

challenge icon

Challenge

Easy

The file addresses.txt holds six candidate addresses, one per line. Inspect it with cat, decide which entries are valid IPv4 addresses, and print only the valid ones, in the order they appear in the file.

Expected output:

10.0.0.1
8.8.8.8
255.255.255.255

Try it yourself

Terminal

All lessons in IP Addressing and Subnetting

Practice on your own: Terminal playground