Network Engineering

Internet Protocol | IP Address

brian | Published: Feb. 15, 2024, 6:58 p.m. | Updated: May 25, 2025, 9:56 p.m.

Profile Picture

IP Address

The ip adress is a layer 3 property in the OSI model. An ip address is the identity of each host, and every single host that connects to the internet contains an ip address

 

Things to Note

   1. IP addresses are 32 bits, specifically an IPv4

   2. A bit is a 1 or a 0

 

   3. 10001000100010001000100010001000

   4.   1000  1000  .  1000 1000  .  1000 1000  .  1000 1000

   5. Above, you break the numbers in #3 into 4 octets, an octect is each group of numbers  seperated by periods as shown in number 4 above

   6. Then each octet is converted into a decimal number: ie 136.22.17.98

   7. The first 24 bits (3 Bytes) are network and the rest 8 bits are for the host,in this example  136.22.17 is the network and then 98 is the host IF the subnet mask is   255.255.255.0  of course.

 

Subnet Mask

A subnet mask is a number that resembles an IP address(ie. 255.255.255.0). A subnet mask reveals how many bits in the ip address are used for the network by masking the network portion of the IP address. In the example subnet mask 255.255.255.0, the first three octets (24 bits) are used for the network, while the last octet (8 bits) is used for host addressing.

 

1. Here we have the ip address, and the subnet mask in binary form

2. the way to tell what part of the ip address is the network portion, is when the subnet mask binary digit is a 1, it will indicate the position of the ip address that's the networks.

 

Uses of Subnet Mask

Subnetting: One of the primary uses of the subnet mask is to divide an IP network into smaller, more manageable subnetworks, known as subnets. By applying the subnet mask to an IP address, administrators can determine which portion of the address represents the network and which portion represents the host. This allows for efficient allocation of IP addresses and better organization of network resources.

Routing: Routers use the subnet mask to make decisions about how to forward packets between networks. By analyzing the destination IP address and applying the subnet mask, routers can determine whether a packet should be forwarded to a device on the local network or sent to another network via a gateway or next-hop router.

 

Mac Address

The MAC address(Media Access Control) is an identifier that every network device uses to uniquely identify itself  on a network. The purpose of the MAC address is so network devices can communicate with eachother, that being locally or over the internet

 

1.  Here computer A wants to communicate with computer B on this local network

2. Computer A inspects computer B's ip address to determine weather or not its on the same network

3. Computer A finds out that Computer B is on the same network beacuse the ip address is on the same group, so now in order for them to communicate, Computer A needs Computer B mac address, and in order to get it,  it has to send an ARP(Address Resolution Protocol) broadcast. This essentially broadcasts to every device thats in the same network as Computer A, and asks Computer B to identify itself by asking for its mac address

3. Computer B tells Computer A its mac address, and now communication can take place

 

NOTE

If the ip address is not the same as the local, then Computer A will actually send the data to the default gateway(Router), and the router will handle the rest

 

 

 

 

 

Ip addresses and subnet masks come in 5 different classes A - E but the rest are for comerial uses

1. Class A: 16million hosts MAX ---> internet service provide company

2. Class B: 65,000  hosts MAX  ----> medium to large organizations

3. Class C:  254 hosts MAX      -----> homes and small organizations with not a lot of hosts

 

 

What is Default Gateway?

 

A default gateway is a device that forwards data from one network to another, and this is usually the router. 

1. The image displays a local area network which include (router, switch, and computers) the end shows the internet(another network)

2. In order for the computers to access another network for example youtube.com the data has to exit its local network by going through the default gateway, which is the router in this case, then the router will forward the data to the internet.

3. This works the opposite way aswell, if a device on the internet wanted to reach out to a computer on the network to the left in the image, it has to go through the default gateway first.