IP and MAC addresses – layer 2 and 3 addressing

IP addresses

An IP address is a 32 bit unique address on the network that identifies a networking device or interface at layer 3. For us is more easy to remember and use an address in the decimal dotted format, while at physical layer on the network, these IP addresses are used in a binary form using the same 32 bit representation.

For example we can have an IP address of in the decimal dotted form which in binary would be 11000000.10101000.00000000.00000001.

For each IP address, we have a portion that actually defines the network address. In other words, some of the 32 bits, with the help of a subnet mask which will be explained soon, define the number of bits that must match for a group of IP addresses to be in the same network.

Before going further with this idea you should learn the basic conversions you will need to know to be able to understand the main concept behind networking devices and their communication methods, and also some algorithms you will be using in later study articles.

MAC addresses

As I wrote before in a previous post, they are represented on a 48 bit scale and they are unique identifiers assigned to network interfaces for communication and addressing purposes on the same network segment. They are mostly used on the Ethernet network technology and also on a variety of other network standards like IEEE 802.

MAC addresses are most of the times assigned by manufacturer and stored in the firmware or in some other hardware storage mechanism.

MAC addresses are formed of two parts, each having 24 bits. The first section (commonly the first 3 groups) is the Organizationally Unique Identifier or OUI (globally unique) which is a code assigned to manufacturers (by Internet Associations keeping track of such things) so they are identified based on them, telling us who is the manufacturer. The other section, also on 24 bits, is assigned by the manufacturer in any way they please, locally unique.

The MAC is represented in HEX notation and has different forms of use from Cisco to day to day activity.


We already established what an IP address is in a previous post so now we will try to get a bit more into the details and how they are used on the network.

If we are talking about the type of the IP addresses and what role can an IP address play, we will have 3 of them.

1. Network Address – It is the standard way to refer to a network and it sounds a lot more better than if you would say “the first network”, as for example we are talking about the “root” address for all the subnet range. would be such a network address and, depending on how many bits are used to define the network we can find out how many hosts it can have and its subnet.

2. Broadcast Address – It’s a special address for all the network that allows messages sent to this address to actually reach all network hosts. To send messages to all the hosts in the network, a host can send a message to the broadcast address and it will reach all of them.

3. Host Address – Each network device requires an IP address in order to communicate on the network. This is the host address, which is actually any IP address in the range between the network address and the broadcast address with both of them excluded.

You can see the types of the IP addresses in below example too.

IP address: Convert this to binary and you will get: 10101100.00010000.00000000.00000000

So we have:

Network Address: 10101100.00010000.00000000.00000000

The subnet of /24 tells us the first 24 bits are used for network addressing, so this means the rest 32-24=8 bits are used for host addressing. I will write with default automatic black text the network part of an IP address and with red the host part.

How do you find out the network address for an IP ? You must count the bits of the host part out of it, and mark them all with 0s. A network address will always have all the host part (bits) of the IP address 0.

Network Address: 10101100.00010000.00000000.00000000

The broadcast address is the opposite of the network address and will always have all the host part bits 1.

Broadcast Address for this network address would be: 10101100.00010000.00000000.11111111 with a decimal value of

The host range will always start with the first usable IP address after the network and will stop one IP before the broadcast IP, as you can see below:

10101100.00010000.00000000.00000000 – network IP –
10101100.00010000.00000000.00000001 –
10101100.00010000.00000000.00000010 –
10101100.00010000.00000000.00000011 –
10101100.00010000.00000000.11111101 –
10101100.00010000.00000000.11111110 –
10101100.00010000.00000000.11111111 – broadcast IP –

The thing is that you will have to learn to understand each word in a different context. For example, I am using network address when I talk about the root address of an IP, as, but I can also talk about network address when I count only the 24 bits as being the network portion of the address. The same principle applies to host too.

I guess by now you are asking yourself how do we know how many bits represent the network portion and how many bits represent the host portion ?

When we define an IP address we also add a prefix length, you will see this also in exercises, real-life practice and most of the environments. When we talk about IPs we add a prefix length or subnet mask so we know how many bits represent the network portion. The actual number of bits that count as network portion inside of an IP address is the prefix length.

For example inside the /24 is the prefix length – it tells us that the first 24 bits represent the network address. The remaining 8 bits, are used as the host portion. The prefix length and the subnet mask represent the same thing but on a different approach. I will explain subnet mask in more details soon, what you should however know about is that it uses 1s and 0s to mark the network and the host portion of an IP address and it is represented same as the IP addresses, on 32 bits.

As you already might have figured it out, the IP address range would be from to, in decimal form. However, some of these IP addresses cannot be used as host addresses as they are reserved for other purposes.

I should also mention, before anything else that the communication between hosts can be of three different ways:
– Unicast: sending a packet from one host to another individual host.
– Broadcast: sending a packet from one host to all the hosts in the network.
– Multicast: sending a packet from one host to a selected group of hosts.

We have –, which is reserved for special purposes like tests and experiments. They could however be converted, in the future, to usable IP addresses.

Another range we cannot apply in day to day use is represented by the multicast IP addresses, which are to

The IP addresses we can use for host unicast addressing have a range between and Even in this range there are a few IP addresses that can’t be used due to reservations and special purposes, which you will learn in time.

These IP addresses are divided into 2 types: Private and Public IP addresses.

The private IP addresses are those IPs that are used inside a network that is limited in accessing the Internet or completely blocked.

The public IP addresses consist in the majority of addresses available for Internet use and have no restriction at this level for accessing the Internet in the networks they are used.

The private address ranges are: to ( to ( to (

Rest of them are mostly Public ones but you can imagine I won’t get into details since you will learn them in time.


VN:F [1.9.22_1171]
Rating: 5.0/5 (2 votes cast)
IP and MAC addresses - layer 2 and 3 addressing, 5.0 out of 5 based on 2 ratings

Leave a Reply

Your email address will not be published. Required fields are marked *