Understanding IP Addresses
Before we start scanning networks, it's crucial to understand IP addresses. Think of an IP address like a home address for your computer on the network. Just as a postal service needs your home address to deliver mail, other devices on the network need your IP address to communicate with your computer.
- An IP address is a unique identifier for a device on a network. It typically looks like a series of numbers separated by dots, such as 192.168.1.1. These numbers range from 0 to 255, and each segment represents part of the network hierarchy. The first part identifies the network itself, while the latter parts identify specific devices.
graph LR
A[Internet] --- B[Router 192.168.1.1]
B --- C[PC 192.168.1.10]
B --- D[Laptop 192.168.1.11]
B --- E[Smartphone 192.168.1.12]
B --- F[Smart TV 192.168.1.13]
style A fill:#f9f,stroke:#333,stroke-width:4px
style B fill:#bbf,stroke:#333,stroke-width:2px
style C fill:#dfd,stroke:#333,stroke-width:2px
style D fill:#dfd,stroke:#333,stroke-width:2px
style E fill:#dfd,stroke:#333,stroke-width:2px
style F fill:#dfd,stroke:#333,stroke-width:2px
- To find your own IP address, we'll use a command that shows network interface information. This is important because we need to know our own address before we can scan other devices on the network. Enter this command:
ip addr show | grep inet
Let's break this down step by step:
ip addr show displays detailed information about all network interfaces on your system
- The
| symbol (called a pipe) takes the output from the first command and sends it to the next command
grep inet filters the output to show only lines containing "inet", which include IP addresses in a format we can easily read
You'll see output similar to this:
inet 127.0.0.1/8 scope host lo
inet 172.19.0.3/16 brd 172.19.255.255 scope global eth1
The numbers after the forward slash (like /8 and /16) use CIDR notation (Classless Inter-Domain Routing). This notation indicates how many bits of the IP address are used for the network portion versus the device portion. For example, /16 means the first 16 bits (the first two numbers) identify the network, while the remaining bits can be assigned to individual devices.
-
In this output, you'll see several IP addresses. Here's what they mean in practical terms:
127.0.0.1 is called the "loopback" or "localhost" address. This special address always refers back to your own computer, used when a program needs to communicate with itself.
172.19.0.3 is your machine's actual network address. This is the address other devices would use to send data to your computer, similar to how your street address identifies your home.
-
Make a note of the IP address that isn't 127.0.0.1 (in this case, 172.19.0.3). We'll use this real network address in our scanning exercises.
This CIDR notation is important for understanding which devices are on your local network versus remote networks.
You might notice some addresses starting with "fe80::" - these are IPv6 addresses, the newer version of IP addressing designed to replace IPv4. While IPv6 is increasingly important, most local networks still primarily use IPv4 addresses like the ones we're examining here. For our network scanning purposes, we'll focus on IPv4 addresses as they're more commonly used in local network environments.