A Crash Course in IPv4 Addressing

A Crash Course in IPv4 Addressing

Welcome to our latest issue on IPv4 addressing. In this issue, we'll learn about the basic parts of IPv4 addressing, including its structure, the role of subnet masks, and the meaning of network, broadcast, and host addresses. IP is used to send packets from the source to their final destination, either within the same network or across multiple networks.
͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­
Forwarded this email? Subscribe here for more

Latest articles

If you’re not a subscriber, here’s what you missed this month.

  1. 7 Microservices Interview Questions

  2. Why the Internet Is Both Robust and Fragile

  3. Unlock Highly Relevant Search with AI

  4. Does Serverless Have Servers

  5. A Crash Course in Docker

To receive all the full articles and support ByteByteGo, consider subscribing:


Welcome to our latest issue on IPv4 addressing. In this issue, we'll learn about the basic parts of IPv4 addressing, including its structure, the role of subnet masks, and the meaning of network, broadcast, and host addresses. IP is used to send packets from the source to their final destination, either within the same network or across multiple networks. 

So, without further ado, let’s jump right into IPv4 addressing. 


IPv4 Address Structure

An IPv4 address is written using dotted decimal notation, but it is actually a 32-bit address. This gives us a total of about 4.29 billion possible addresses. We divide the 32-bit address into four 8-bit sections called octets. Then we convert each octet into a decimal value. This is called dotted decimal notation, and that's how we write IPv4 addresses. 

The range of an IPv4 address can be from four 0s (0.0.0.0) in dotted decimal notation to four 255s (255.255.255.255).

IPv4 Address and Subnet Mask

An IPv4 address has two main parts:

  • A network portion

  • A host portion

The subnet mask (also called the prefix length) separates the network portion from the host portion of the IPv4 address. 

A subnet mask is 32 bits long. It has a group of 1s followed by a group of 0s. The 1s indicate the network portion of the IP address, and the 0s indicate the host portion. 

How to Write a Subnet Mask

There are two ways to write a subnet mask: 

Dotted Decimal Notation

We can use dotted decimal notation, just like for IPv4 addresses. 

Example: 255.255.0.0

Slash Notation or Prefix Length

We can also use a slash notation, which shows the number of 1 bits in the mask. 

Example:

  • /16 (indicating 16 one bits)

  • 172.18.0.0/16

Using the slash notation if more common nowadays. 

Finding the IPv4 Network Address Using the Subnet Mask

Let’s say we have a host IPv4 address (192.168.1.100) and a subnet mask (255.255.255.0). How do we find the network address from the host address using the subnet mask? 

In binary notation, we perform a bitwise AND operation between the host address and the subnet mask. For each bit position, if both the address and mask bits are 1, the result is 1. Otherwise, the result is 0. The result gives us the network address.

Continue reading this post for free, courtesy of Alex Xu.

Claim my free post

A subscription gets you:

An extra deep dive on Thursdays
Full archive
Many expense it with team's learning budget
 
Like
Comment
Restack
 

© 2024 ByteByteGo
548 Market Street PMB 72296, San Francisco, CA 94104
Unsubscribe

Get the appStart writing


by "ByteByteGo" <bytebytego@substack.com> - 11:35 - 28 Mar 2024