Define Your Device’s IPv4 Address
Let’s go back to our mail analogy. When you send a package, you have to write certain information on it to make sure it arrives at the right place:
The recipient’s full name.
The recipient’s postal address.
This information identifies the recipient and is mandatory. The person’s full name is useful on a local level, so that the mailman knows which mailbox to put the package in. The postal address is useful on a larger scale, so that the mail sorting platform knows which country, town, and street they need to send the package to.
When you send a packet on the internet, it’s almost the same. The packet header must always contain:
A local address—the MAC address.
A global address—the IP address.
There are different IP versions. Currently, version 4 (IPv4) is the most widely used.
Like MAC addresses, IPv4 addresses have very specific characteristics:
They can be public or private:
Private IP addresses are used on LANs (e.g., home and business networks).
Public IP addresses are often reserved for telecommunications operators on MAN/WAN networks (national and international networks).
They can be changed. It’s up to you to define them, unlike MAC addresses.
They are made up of four bytes in decimal notation (not hexadecimal this time).
This is what an IPv4 address looks like:
As you can see, it’s made up of four parts (four bytes) separated by dots. Each part is a byte, i.e., eight bits, and can have a value between 0 and 255.
Don’t forget that once you’ve configured an IP address on the device, it will be converted into binary, as devices only communicate in binary. In binary, with 8 bits, you can only count from 0 to 255.
Define Your Network’s Addressing Plan
To create your own network, you need to choose the IP addresses you’re going to assign to your devices. This is what’s known as creating an addressing plan. To ensure this makes sense, you can’t just choose your addresses at random.
If you’re working on just one network, make sure you:
Don’t assign any IP addresses that already exist within the network.
Assign IP addresses that are all in the same IP address range.
Wait, what’s an IP address range?
An address range is a set of consecutive IP addresses you can assign to devices in the same network.
Think of it like an area’s ZIP code. For example, all New York ZIP codes have to be between 10001 and 14975—this is the range of possible ZIP codes.
So in a computer network, how can you tell if two devices have IP addresses in the same range?
The answer is simple: the mask.
An IP address always contains:
A part that identifies the network.
A part that identifies the device (otherwise known as the host).
The mask is what separates the network and the host parts. This is what allows you to check if two devices are in the same network range.
Here’s an example to illustrate this:
Here, the mask tells you that the first eight bits of this IP address (172) are the part identifying the network, and the remaining 24 bits (16.254.1) identify the host.
The mask also allows you to work out the network address, which can be obtained by taking the IP address and replacing the bits identifying the host with “0”. This gives you:
OK, great, but what is it used for?
Now, to find out if two devices are on the same IP network, (i.e., in the same network range) you just need to compare their network addresses:
If they are identical, the devices are on the same IP network.
If they are different, the devices are on a different IP network.
Get the idea?
Now let’s look at a practical example to illustrate this.
Imagine two devices in a point-to-point network (i.e., linked directly via a cable) with no switch, and the following IP configuration:
The devices have the following addresses:
Device A has the address 192.168.10.1/24.
Device B has the address 192.168.20.3/24.
The mask tells you that:
The first 24 bits are the network identifier.
The last eight bits are the host identifier.
Therefore, you can deduce that:
Device A is on the network 192.168.10.0.
Device B is on the network 192.168.20.0.
The two devices are on two different networks, so they can’t communicate with each other.
If you want to use the /24 mask, the IP addresses of the devices are not configured correctly. Device B should have been given an address beginning with 192.168.10.x, 192.168.10.3/24, for example.
How do I do that?
Let’s look at how this works on a diagram:
As you can see, an 8-bit mask leaves 24 bits to identify hosts. With 24 bits, there are more than 16 million (2^24) possible addresses. A 24-bit mask, however, only leaves eight bits for host addresses, so there are only 255 (2^8) possible addresses.
It’s important to understand the difference between the total number of IP addresses in a network and the number of available IP addresses. For example, if you have 8 bits for host addresses, you can create a total of 255 IP addresses, but only 253 of them can actually be assigned.
Really? Why’s that?
In a network range, the first and last address can never be assigned to a host, as they have a specific function.
The first address is the network address (we covered this earlier when discussing the mask).
The last address is the broadcast address. This is used to send a message to all devices on a network simultaneously. This means that it can’t be assigned to any particular host.
To find out how many devices you can have in a network, calculate the total number of addresses and subtract two.
One final important point about masks is that they can be written in two ways:
/24, the notation we’ve been using, which is also known as CIDR notation (Classless Inter-Domain Routing).
255.255.255.0, an older notation system that’s still in use.
To understand the link between the two, you have to use binary. If you convert your mask 255.255.255.0 into binary, you get 11111111.11111111.11111111.00000000. The first 24 bits of this binary mask all have a value of 1, which explains why you can simply write it as /24.
CIDR notation has replaced standard notation for greater simplicity and flexibility. Initially, to create a network, there were only three possible sizes: 254, 65,534, or 16,777,204 devices, corresponding to the masks 255.255.255.0, 255.255.0.0, and 255.0.0.0, respectively. So if you wanted a network with 3,000 devices, you’d have to create a much larger network than required - with a 255.255.0.0 mask, which could accept up to 65,534 devices.
The CIDR system gives more flexibility, as it allows more specific masks to be created, allowing you to create more customizable networks of the right size, depending on your requirements.
Assign IP Addresses to the Devices in Your Network
Let’s go back to the work you were doing for Tino’s driving school. The colleague you’re working with tells you that you need to change the current IP addresses of three devices, and that the server should have the IP address 192.168.0.1/24. Your task is to choose the correct IP addresses for the two other devices.
For the moment, you haven’t started working on Cyclade’s devices.
As a reminder, here’s the architecture:
To test communication between two devices, you already know how to create a packet in Packet Tracer. But we can also use another method: the ping command. This command is universal across all devices and sends a test message to another device to check that it’s responding.
To use this command you need to know the device’s IP address that you want to attempt communication with.
For example, if you want to check that communication is working between your device and Google’s primary DNS server, you should enter the following in the command prompt:
ping 8.8.8.8
If you get a response, it means communication is working.
You can also use the ping command on devices in your virtual network in Packet Tracer.
To do this:
Click on one of the end nodes.
Go to the Desktop tab.
Click on Command Prompt.
A command prompt will appear, like the Windows one, which will allow you to use commands such as ping.
Over to You!
Configure the IP addresses of Tino’s driving school’s three devices so that they are on the same IP network. Don’t forget; the server needs to have the IP address 192.168.0.1/24.
Test communication between the devices.
Answers
The IP address provided is 192.168.0.1/24, which means that the network part is 24 bits, so there are 8 bits left for assigning IP addresses to the devices.
Therefore, you can choose IP addresses between 192.168.0.2/24 and 192.168.0.254/24.
Why not 192.168.0.255?
Because 192.168.0.255 is the broadcast address, it can’t be assigned, nor can the address 192.168.0.0, which is the network address. Don’t forget, you can never assign the first and last address in a network range.
So far, we’ve only talked about IPv4 addresses. Unfortunately, because of the huge scale of the internet, it’s no longer possible to assign unique IPv4 addresses to every connected device. These addresses will eventually be replaced by IPv6 addresses, which are structured so that they can provide a unique IP address to all connected devices in the world (they have 128 bits, rather than 32 bits).
In this course, we’ll stick to IPv4 addresses. This is because they will continue to be used in LAN networks, even after the introduction of IPv6, which will be more heavily used in WANs.
Simulate Architecture Using Cisco Packet Tracer
You’re back at your company again, and you need to finish the network architecture simulation for your client, Mr. Falman. You’ve already configured the IP addresses of the three devices on the client’s network.
Your colleague is carrying out a site visit to see how things are looking. He calls you to tell you the addresses of Cyclade’s two computers:
192.168.100.1/24
192.168.100.2/24
Over to You!
Configure these addresses on the two remaining workstations.
Test connectivity by sending a packet between the two PCs on Cyclade’s network.
Carry out a further test by sending a packet between PC1 and Server0.
Answers
You can find the answer sheet here to check your work.
You can send a message from 192.168.100.1 to 192.168.100.2.
However, when you try to send a message between 192.168.100.1 and 192.168.0.1, it doesn’t work. But, don’t worry, this is expected! These are two different networks, and there is still one device we haven’t configured yet—the router.
Let’s Recap
You need IP addresses to send messages between different networks.
An IPv4 address is made up of 32 bits. Part of this identifies the network, and the other part identifies the host.
IP addresses always come with a mask, which tells you where the line is between the network identifier and the host identifier.
IPv6 will gradually take over from IPv4, as it can create many more addresses, enough for all connected devices in the world.
When you create a network, you should draw up an addressing plan. It allows you to define the IP addresses which will be assigned to the devices, and determine how many there will be.
Now you know how to give devices in a network an IP address! You'll find out how to route network messages in the next chapter.