
By: layman
March 22, 2016
CCNA - ICND1-003

By: layman
March 22, 2016
Alright, alright. Let's dive into IP addressing.
An IP address is a number assigned to a device that participates in a network communication. It's used for two purposes:
- Host (device identification)
- Location (network identification)
An example of an IP address:
172.30.201.93
What you should see in the above example is that it’s divided into four parts. Each of those four parts can be assigned a value from 0 to 255. "Why is that?" you may ask. Well, an IP address is 4 bytes long, that's why it’s divided into four parts, for the sake of convenience. Each byte can have a maximum value of 255, simply because that’s how much a byte can have at most.
As I wrote earlier, an IP address serves two functions: device identification and network identification. Looking at 172.30.201.93, we have to see which part of the address represents the network, and which part represents the host. How do we see though? This is where something called a subnet mask comes in.
A Subnet mask is 4 bytes long as well. 255 indicates that the part of the IP address represents the network, and 0 indicates that it’s a host. In other words, if we combine 172.30.201.93 with a subnet mask of 255.255.255.0, we get the host 93, which belongs to 172.30.201 network. Actually, networks are not written this way. If you want to refer to a whole network, you should write 172.30.201.0.
Scenario
In a local area network (LAN) environment, your computer has to know the MAC address of a computer it wants to communicate with. Imagine you already know the IP address of the computer and want to connect to it. In our example, we’ll try to ping our friend’s computer (test the reachability).

Note: One thing about switches: they learn MAC addresses (which MAC is on which port).
So, you open up your command prompt or terminal if you are using Linux and type
ping 192.168.0.102
Once you hit enter, your computer will look in its cache to see if the IP address you are trying to ping has a mapped hardware address (i.e. MAC address). If the MAC address is not found, it will send a broadcast message using Address Resolution Protocol (ARP).
A broadcast is a type of message that gets to all computers within one network. ARP is a protocol that is used to map MAC addresses to IP addresses and store them in ARP-cache inside your computer.

When you send ARP broadcast to resolve the MAC address of 192.168.0.102, this message gets to all the PCs, but disregarded by the ones who don’t have the 192.168.0.102 IP address. When .102 gets your message, it replies to you via unicast message (a message that gets to only one intended addressee).

When your computer gets the reply, it stores the new mapping in its ARP-cache. Now, two computers can start communicating using unicast messages.
To see ARP-cache using your Windows machine, open the Command Prompt via Start > Run > cmd and type in the following command and hit enter:
arp -a
Output should be something similar as the following:

Don’t pay attention to the rest of the results; we’ll cover them in our next lesson.
This lesson we covered how two computers communicate within one network. What if you want to access a computer on other network? Other country? These questions are to be answered in our next lesson.