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.
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. Enter this command:
ip addr show | grep inet
Let's break this down:
ip addr show
displays information about all network interfaces
|
(pipe) sends that output to the next command
grep inet
filters the output to show only lines containing "inet", which include IP addresses
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
-
In this output, you'll see several IP addresses. Here's what they mean:
127.0.0.1
is the "localhost" address. Every computer refers to itself as 127.0.0.1. This is used for local connections within your own machine.
172.19.0.3
is your machine's IP address on the network. This is the address other devices would use to communicate with your machine.
-
Make a note of the IP address that isn't 127.0.0.1 (in this case, 172.19.0.3). We'll use it in the next step.
The /16
after the IP address is called the subnet mask. It defines the size of the network. In this case, /16
means that the first two numbers of the IP address (172.19) define the network, and the last two can be used for individual devices.
If you're wondering about the different types of IP addresses, it's worth noting that there are two main versions of the IP protocol: IPv4 (like 172.19.0.3) and IPv6 (which would start with characters like fe80::). IPv6 was created to solve the problem of running out of IPv4 addresses as more devices connected to the internet. For this lab, we'll focus on IPv4 addresses.