<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Manoj Kumar Vemula</title>
    <description>The latest articles on Forem by Manoj Kumar Vemula (@manoj_kumarvemula_31e045).</description>
    <link>https://forem.com/manoj_kumarvemula_31e045</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3658225%2Fa1c73e95-35fa-444d-8bea-439095a872ad.png</url>
      <title>Forem: Manoj Kumar Vemula</title>
      <link>https://forem.com/manoj_kumarvemula_31e045</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/manoj_kumarvemula_31e045"/>
    <language>en</language>
    <item>
      <title>Understanding DHCP: How I Configured and Captured It in a GNS3 Lab</title>
      <dc:creator>Manoj Kumar Vemula</dc:creator>
      <pubDate>Tue, 17 Mar 2026 17:20:58 +0000</pubDate>
      <link>https://forem.com/manoj_kumarvemula_31e045/understanding-dhcp-how-i-configured-and-captured-it-in-a-gns3-lab-35ek</link>
      <guid>https://forem.com/manoj_kumarvemula_31e045/understanding-dhcp-how-i-configured-and-captured-it-in-a-gns3-lab-35ek</guid>
      <description>&lt;p&gt;One of the best ways to truly understand a protocol is to build it yourself, watch the packets, and ask "why does each field exist?" This post walks through a DHCP lab I set up in GNS3 — configuring a Cisco router as the DHCP server, a switch in the middle, and two PCs as clients — then captures and explains every packet in the DORA handshake using Wireshark.&lt;/p&gt;

&lt;p&gt;Lab topology&lt;br&gt;
The setup is intentionally simple: one router acting as DHCP server, one switch forwarding traffic, and two VPCS clients requesting addresses.&lt;/p&gt;

&lt;p&gt;R1&lt;br&gt;
Router / DHCP server → SW1 Switch → PC1 Client·PC2 Client&lt;br&gt;
&lt;strong&gt;Router configuration&lt;/strong&gt;&lt;br&gt;
On R1, I assigned a static IP to the interface facing the LAN, created a DHCP pool for the 192.168.1.0/24 subnet, and excluded a range so the router's own address and a few reserved IPs wouldn't be handed out.&lt;/p&gt;

&lt;p&gt;interface GigabitEthernet1/0&lt;br&gt;
 ip address 192.168.1.254 255.255.255.0&lt;/p&gt;

&lt;p&gt;ip dhcp pool LAN&lt;br&gt;
 network 192.168.1.0 255.255.255.0&lt;/p&gt;

&lt;p&gt;ip dhcp excluded-address 192.168.1.2 192.168.1.10&lt;/p&gt;

&lt;p&gt;The DORA handshake — explained packet by packet&lt;br&gt;
DHCP works through four messages, collectively called DORA. I captured all four in Wireshark, and here's exactly what each one contained and why.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8pwyfebhnm9lbbw74gw9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8pwyfebhnm9lbbw74gw9.png" alt=" " width="771" height="627"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1 — DISCOVER&lt;/strong&gt;&lt;br&gt;
Client broadcasts for a server&lt;/p&gt;

&lt;p&gt;Source: 0.0.0.0 → Dest: 255.255.255.255 · UDP 68→67&lt;/p&gt;

&lt;p&gt;Message type&lt;br&gt;
Boot Request (1)&lt;br&gt;
Client IP : 0.0.0.0&lt;br&gt;
Client MAC : 00:50:79:66:68:01&lt;br&gt;
Transaction ID : 0x7db99e22&lt;br&gt;
Hops :0&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2 — OFFER&lt;/strong&gt;&lt;br&gt;
Server proposes an IP address&lt;/p&gt;

&lt;p&gt;Source: 192.168.1.254 → Dest: 192.168.1.1 · UDP 67→68&lt;/p&gt;

&lt;p&gt;Message type :Boot Reply (2)&lt;br&gt;
Your (client) IP :192.168.1.1&lt;br&gt;
Server identifier :192.168.1.254&lt;br&gt;
Subnet mask : 255.255.255.0&lt;br&gt;
Options included :Router, DNS, Lease&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3 — REQUEST&lt;/strong&gt;&lt;br&gt;
Client accepts the offer&lt;/p&gt;

&lt;p&gt;Source: 0.0.0.0 → Dest: 255.255.255.255 · UDP 68→67&lt;/p&gt;

&lt;p&gt;Message type : Boot Request (1)&lt;br&gt;
Client IP : 192.168.1.1&lt;br&gt;
Requested IP :192.168.1.1&lt;br&gt;
Server ID : 192.168.1.254&lt;br&gt;
Still broadcast?&lt;br&gt;
Yes — 255.255.255.255&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4 — ACK&lt;/strong&gt;&lt;br&gt;
Server confirms the lease&lt;/p&gt;

&lt;p&gt;Source: 192.168.1.254 → Dest: 192.168.1.1 · UDP 67→68&lt;/p&gt;

&lt;p&gt;Message type :Boot Reply (2)&lt;br&gt;
Your (client) IP :192.168.1.1&lt;br&gt;
Lease time :Option 51&lt;br&gt;
Renewal time :Option 58&lt;br&gt;
Rebind time :Option 59&lt;/p&gt;

&lt;p&gt;Things I noticed in the capture&lt;br&gt;
&lt;strong&gt;Why does the Request still broadcast, even after getting an Offer?&lt;/strong&gt;&lt;br&gt;
The client broadcasts the Request (instead of unicasting directly to the server) so that any other DHCP servers on the network also see it and know their offer was not accepted. This lets them release the IP they had tentatively reserved — a small but important detail that keeps address pools clean.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is 0.0.0.0 the source in Discover and Request?&lt;/strong&gt;&lt;br&gt;
The client doesn't have an IP yet at this point — that's the whole reason it's sending DHCP messages. It uses 0.0.0.0 as a placeholder source, which the IP stack allows specifically for DHCP bootstrap situations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the Transaction ID for?&lt;/strong&gt;&lt;br&gt;
The Transaction ID (0x7db99e22 in this capture) is a random number the client generates to match Offers and ACKs back to its own Discover and Request. This is important because in a busy network, multiple clients may be running DORA simultaneously — the Transaction ID tells each client which replies belong to them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What about the Gratuitous ARP after the ACK?&lt;/strong&gt;&lt;br&gt;
Right after receiving the DHCP ACK, PC1 sent three Gratuitous ARP broadcasts for 192.168.1.1. This is the client announcing its new IP to the network and simultaneously checking whether any other device is already using that address. If something responds, there's a conflict. If nothing responds, the address is safely claimed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DHCP options visible in the Offer and ACK&lt;/strong&gt;&lt;br&gt;
Both the Offer and ACK carried the following options beyond just the IP address — this is what makes DHCP a full network configuration protocol, not just an IP assignment tool.&lt;/p&gt;

&lt;p&gt;Options in DHCP :&lt;br&gt;
From the Discover (Images 2 &amp;amp; 3):&lt;/p&gt;

&lt;p&gt;Option 53 — DHCP Message Type (Discover)&lt;br&gt;
Option 12 — Host Name&lt;br&gt;
Option 61 — Client Identifier&lt;br&gt;
Option 255 — End&lt;/p&gt;

&lt;p&gt;From the Offer (Image 4):&lt;/p&gt;

&lt;p&gt;Option 53 — DHCP Message Type (Offer)&lt;br&gt;
Option 54 — DHCP Server Identifier (192.168.1.254)&lt;br&gt;
Option 51 — IP Address Lease Time&lt;br&gt;
Option 58 — Renewal Time Value&lt;br&gt;
Option 59 — Rebinding Time Value&lt;br&gt;
Option 1 — Subnet Mask (255.255.255.0)&lt;br&gt;
Option 3 — Router&lt;br&gt;
Option 6 — Domain Name Server&lt;br&gt;
Option 255 — End&lt;/p&gt;

&lt;p&gt;From the Request (Image 5):&lt;/p&gt;

&lt;p&gt;Option 53 — DHCP Message Type (Request)&lt;br&gt;
Option 54 — DHCP Server Identifier (192.168.1.254)&lt;br&gt;
Option 50 — Requested IP Address (192.168.1.1)&lt;br&gt;
Option 61 — Client Identifier&lt;br&gt;
Option 12 — Host Name&lt;br&gt;
Option 55 — Parameter Request List&lt;br&gt;
Option 255 — End&lt;/p&gt;

&lt;p&gt;From the ACK (Image 6):&lt;/p&gt;

&lt;p&gt;Option 53 — DHCP Message Type (ACK)&lt;br&gt;
Option 54 — DHCP Server Identifier (192.168.1.254)&lt;br&gt;
Option 51 — IP Address Lease Time&lt;br&gt;
Option 58 — Renewal Time Value&lt;br&gt;
Option 59 — Rebinding Time Value&lt;br&gt;
Option 1 — Subnet Mask (255.255.255.0)&lt;br&gt;
Option 3 — Router&lt;br&gt;
Option 6 — Domain Name Server&lt;br&gt;
Option 255 — End&lt;br&gt;
Result on the client&lt;br&gt;
After the handshake completed, running ip dhcp on the VPCS client confirmed it received 192.168.1.11/24 with a gateway of 192.168.1.254 — as expected, since .1 through .10 were excluded from the pool.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I took away from this lab&lt;/strong&gt;&lt;br&gt;
Reading about DHCP in a textbook and actually watching the four packets flow through Wireshark are very different experiences. Seeing the Transaction ID stay consistent across all four messages, watching the source IP go from 0.0.0.0 to the assigned address, and noticing the post-ACK Gratuitous ARPs made the protocol feel concrete rather than abstract. The next step is to add a second subnet and configure a DHCP relay (ip helper-address) to see how DORA behaves when the server and client are on different networks.&lt;/p&gt;

</description>
      <category>dhcp</category>
      <category>networking</category>
      <category>ipaddress</category>
    </item>
    <item>
      <title>DHCP Explained</title>
      <dc:creator>Manoj Kumar Vemula</dc:creator>
      <pubDate>Thu, 26 Feb 2026 10:28:04 +0000</pubDate>
      <link>https://forem.com/manoj_kumarvemula_31e045/dhcp-explained-13ip</link>
      <guid>https://forem.com/manoj_kumarvemula_31e045/dhcp-explained-13ip</guid>
      <description>&lt;p&gt;The main purpose of this post is to find&lt;br&gt;
How devices automatically get their IP address — from discovery to release. &lt;br&gt;
Let's start from here:&lt;br&gt;
&lt;strong&gt;1. What Is DHCP?&lt;/strong&gt;&lt;br&gt;
Every device that connects to a network — whether it's your laptop, phone, printer, or smart TV — needs an IP address to communicate. Without one, it is invisible to the rest of the network. The question is: how does every device get that address without someone manually typing it in?&lt;/p&gt;

&lt;p&gt;The answer is DHCP — Dynamic Host Configuration Protocol. DHCP is a network management protocol that automatically assigns IP addresses and other network configuration settings to client devices the moment they connect to a network. It is what makes "plug in and it just works" possible.&lt;/p&gt;

&lt;p&gt;Before DHCP existed, network administrators had to manually configure every single device with an IP address, subnet mask, gateway, and DNS server. On a network with hundreds of devices, this was an enormous and error-prone task. DHCP eliminated that entirely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What DHCP Configures&lt;/strong&gt;&lt;br&gt;
DHCP does more than just hand out IP addresses. A full DHCP lease delivers a complete network configuration package to the client:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhwpdpdf231087tk6xug8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhwpdpdf231087tk6xug8.png" alt=" " width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;--&amp;gt;DHCP uses a client-server model. The DHCP server owns a pool of available IP addresses (called a scope) and leases them out to clients on a temporary basis. The IP is not permanently owned — it is borrowed for a defined lease time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where DHCP Is Used&lt;/strong&gt;&lt;br&gt;
•Home routers — your home router runs a DHCP server that hands out IPs to every device on your Wi-Fi&lt;br&gt;
•Enterprise networks — dedicated DHCP servers manage hundreds or thousands of devices per site&lt;br&gt;
•ISP networks — DHCP assigns IPs to customer routers when they connect to the ISP&lt;br&gt;
•Data centers and cloud — DHCP or its cloud equivalents provision virtual machine networking automatically&lt;br&gt;
•Wi-Fi hotspots — coffee shops, airports, and hotels use DHCP to assign temporary IPs to guests&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The DORA Process — How IP Addresses Are Allocated&lt;/strong&gt;&lt;br&gt;
When a client device boots up and needs an IP address, it goes through a four-message exchange with the DHCP server. Networking engineers call this the DORA process — an acronym for the four messages involved: Discover, Offer, Request, and Acknowledge.&lt;/p&gt;

&lt;p&gt;Understanding why each message is a broadcast or a unicast — and why — is essential to deeply understanding DHCP.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhifv4p0rczqjc9660ciu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhifv4p0rczqjc9660ciu.png" alt=" " width="800" height="285"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1 — DHCP Discover&lt;/strong&gt;&lt;br&gt;
When a client device first boots up or connects to a network, it has no IP address, no knowledge of the default gateway, and no idea where a DHCP server is. It is essentially blind to the network. The only thing it can do is shout — and that is exactly what it does.&lt;/p&gt;

&lt;p&gt;The client broadcasts a DHCP Discover message to every device on the local subnet, hoping a DHCP server will hear it and respond.&lt;/p&gt;

&lt;p&gt;Source MAC:       Client's own hardware MAC address&lt;br&gt;
Destination MAC:  FF:FF:FF:FF:FF:FF  (Ethernet broadcast — everyone receives it)&lt;br&gt;
Source IP:        0.0.0.0             (client has no IP yet)&lt;br&gt;
Destination IP:   255.255.255.255     (IP broadcast)&lt;/p&gt;

&lt;p&gt;The use of 0.0.0.0 as the source IP is significant — it is the standard notation for "I have no IP address." The message essentially says: "I just joined this network. My hardware address is [MAC]. Is there a DHCP server out there?"&lt;/p&gt;

&lt;p&gt;So Why Broadcast? The client does not know the IP address of the DHCP server — it may not even know if a DHCP server exists. A broadcast is the only way to reach every device on the subnet simultaneously. All devices receive the frame, but only DHCP servers process and respond to it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2 — DHCP Offer&lt;/strong&gt;&lt;br&gt;
Any DHCP server on the subnet that receives the Discover message responds with a DHCP Offer. This message is the server saying: "I heard you. I am available. Here is an IP address I am reserving for you, along with all the configuration you need."&lt;/p&gt;

&lt;p&gt;The Offer contains a full proposed network configuration:&lt;br&gt;
•The IP address being offered to the client&lt;br&gt;
•Subnet mask&lt;br&gt;
•Default gateway IP address&lt;br&gt;
•DNS server IP address&lt;br&gt;
•Lease duration (how long the client may keep this IP)&lt;br&gt;
•The DHCP server's own IP address (so the client knows who made the offer)&lt;/p&gt;

&lt;p&gt;Source MAC:       DHCP Server MAC&lt;br&gt;
Destination MAC:  FF:FF:FF:FF:FF:FF  (broadcast — client still has no IP)&lt;br&gt;
Source IP:        192.168.1.254       (DHCP server's IP)&lt;br&gt;
Destination IP:   255.255.255.255     (broadcast — client can't receive unicast yet)&lt;/p&gt;

&lt;p&gt;At this point the server internally reserves the offered IP address, temporarily removing it from its available pool. This prevents the same IP from being offered to another client while this negotiation is in progress.&lt;/p&gt;

&lt;p&gt;--&amp;gt; What If There Are Multiple DHCP Servers?&lt;br&gt;
 In some networks, more than one DHCP server may exist for redundancy. All of them receive the Discover broadcast and may each send a separate Offer. The client receives multiple Offers and simply picks one — usually the first to arrive. The selection is handled in the next step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3 — DHCP Request&lt;/strong&gt;&lt;br&gt;
After receiving one or more Offer messages, the client selects a DHCP server and formally requests the offered configuration. It broadcasts a DHCP Request message to the entire subnet.&lt;/p&gt;

&lt;p&gt;This message serves two purposes simultaneously:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; It tells the chosen DHCP server: "I accept your offer. Please confirm this configuration for me."&lt;/li&gt;
&lt;li&gt; It tells all other DHCP servers (the ones whose offers were not selected): "I chose a different server. You can release the IP address you had reserved for me."&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Source MAC:       Client's MAC address&lt;br&gt;
Destination MAC:  FF:FF:FF:FF:FF:FF  (broadcast — informing ALL servers)&lt;br&gt;
Source IP:        0.0.0.0             (still no IP until Ack is received)&lt;br&gt;
Destination IP:   255.255.255.255     (broadcast)&lt;/p&gt;

&lt;p&gt;Key field: DHCP Server Identifier (Option 54) = IP of chosen server&lt;/p&gt;

&lt;p&gt;The DHCP Server Identifier field (Option 54) is what tells every server which one was selected. The chosen server reads this field, sees its own IP, and knows it should proceed. Every other server reads the field, sees a different IP, and releases its reserved address back to its pool.&lt;/p&gt;

&lt;p&gt;Why Is the Request Still a Broadcast?&lt;br&gt;
 Even though the client now knows the chosen server's IP, it must still broadcast — because non-selected servers also need to receive this message so they can free up their reserved IPs. A unicast to only the chosen server would leave the other servers holding reserved addresses indefinitely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4 — DHCP Acknowledge (ACK)&lt;/strong&gt;&lt;br&gt;
The selected DHCP server receives the Request message, confirms that the DHCP Server Identifier matches its own IP, and responds with a DHCP Acknowledge (ACK) message. This is the server's final confirmation: "The IP is yours. Your lease starts now."&lt;/p&gt;

&lt;p&gt;The ACK contains the same configuration data as the Offer — IP address, subnet mask, gateway, DNS, and lease time — but now it is official. Upon receiving the ACK, the client configures its network interface using this data and becomes a fully functional member of the network.&lt;/p&gt;

&lt;p&gt;Source MAC:       DHCP Server MAC&lt;br&gt;
Destination MAC:  FF:FF:FF:FF:FF:FF  (broadcast — client still has no confirmed IP)&lt;br&gt;
Source IP:        192.168.1.254       (DHCP server)&lt;br&gt;
Destination IP:   255.255.255.255     (broadcast)&lt;/p&gt;

&lt;p&gt;After the client processes the ACK, it performs one final check — an ARP (Address Resolution Protocol) probe — to make sure no other device on the network is already using the assigned IP. If a conflict is detected, the client sends a DHCP Decline message and the process starts over.&lt;/p&gt;

&lt;p&gt;What Is a DHCP NAK? &lt;br&gt;
If the DHCP server receives a Request but something is wrong — the requested IP is no longer available, or the client's lease has already expired — it sends a DHCP NAK (Negative Acknowledge) instead of an ACK. The client must then restart the DORA process from the beginning.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. IP Address Renewal — Keeping Your Lease&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Why Leases Expire&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
DHCP does not permanently assign IP addresses — it leases them. This is by design. Temporary leases allow the DHCP server to reclaim IP addresses from devices that have left the network without formally releasing them, keeping the address pool healthy and preventing exhaustion.&lt;/p&gt;

&lt;p&gt;Imagine a hotel with 100 rooms. If guests could check in forever and never check out, the hotel would eventually have no rooms to offer new guests. DHCP lease times work the same way — they ensure addresses cycle back into the pool.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Renewal Timeline&lt;/strong&gt;&lt;br&gt;
The DHCP lease renewal process follows a predictable timer schedule that every network engineer should know:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkoqvw49e82zr8nhtayie.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkoqvw49e82zr8nhtayie.png" alt=" " width="800" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, with a 24-hour (86,400 second) lease: T1 fires at 12 hours, T2 at ~21 hours. If the client successfully renews at T1, the full lease duration resets and the cycle starts again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Renewal Exchange&lt;/strong&gt;&lt;br&gt;
When T1 fires, the client sends a DHCP Request directly to its DHCP server to renew the lease. This is one of the key differences from the initial allocation — renewal uses unicast, not broadcast.&lt;/p&gt;

&lt;p&gt;Client  ──── DHCP Request (Unicast) ──────────→  Server&lt;br&gt;
  Destination IP:  192.168.1.254  (server's IP — now known)&lt;br&gt;
  Client IP:       192.168.1.105  (the IP being renewed)&lt;/p&gt;

&lt;p&gt;Client  ←─── DHCP Ack (Unicast) ─────────────  Server&lt;br&gt;
  Destination IP:  192.168.1.105  (client's IP — now known)&lt;/p&gt;

&lt;p&gt;Because both the client and server already know each other's IP addresses from the original lease, there is no need for broadcasts. The renewal is a clean, direct two-message exchange: Request and Ack. The client includes its current IP in the "Client IP Address (ciaddr)" field, and notably does NOT include Option 50 (Requested IP) or Option 54 (Server Identifier) — these are only used in initial allocation.&lt;/p&gt;

&lt;p&gt;Broadcast vs. Unicast Comparison: Initial allocation uses broadcast because the client has no IP and does not know the server's address. Renewal uses unicast because both sides now know each other. This is an important distinction for exam questions and troubleshooting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Happens If Renewal Fails?&lt;/strong&gt;&lt;br&gt;
If T1 fires and the DHCP server does not respond (perhaps it is down for maintenance), the client does not immediately panic. It keeps using the current IP and waits until T2.&lt;/p&gt;

&lt;p&gt;At T2 (87.5% of lease), the client escalates — it broadcasts a DHCP Request to any DHCP server on the network, hoping a backup or secondary server can renew the lease. If that also fails and the lease fully expires, the client stops using the IP entirely and falls back to the full DORA process.&lt;/p&gt;

&lt;p&gt;During this fallback window, Windows devices will often assign themselves an APIPA address (169.254.x.x) — a self-assigned link-local address that allows basic local communication but provides no internet access. Seeing a 169.254.x.x address is a reliable indicator that DHCP has failed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. IP Address Release — Returning the Lease&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;What Is a DHCP Release?&lt;/em&gt;&lt;br&gt;
When a device gracefully disconnects from the network — whether you shut down your computer cleanly, disconnect from Wi-Fi, or run the ipconfig /release command on Windows — it should inform the DHCP server that it no longer needs its IP address. It does this by sending a DHCP Release message.&lt;/p&gt;

&lt;p&gt;The Release is a unicast message sent directly to the DHCP server:&lt;/p&gt;

&lt;p&gt;Client  ──── DHCP Release (Unicast) ─────────→  Server&lt;br&gt;
  Destination MAC:  DHCP Server MAC&lt;br&gt;
  Destination IP:   192.168.1.254   (DHCP server)&lt;br&gt;
  Client IP field:  192.168.1.105   (the IP being returned)&lt;/p&gt;

&lt;p&gt;Upon receiving the Release, the DHCP server marks that IP address as available again in its pool, ready to be offered to the next client that needs it. The releasing client immediately loses network access — it no longer has a valid IP, gateway, or DNS server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Graceful vs. Abrupt Disconnection&lt;/strong&gt;&lt;br&gt;
DHCP Release only happens during a graceful shutdown. If a device loses power suddenly, crashes, or is simply removed from the network without warning, it cannot send a Release message. In this case:&lt;/p&gt;

&lt;p&gt;•The DHCP server keeps the IP listed as leased until the lease timer expires&lt;br&gt;
•No other device can be assigned that IP during this time&lt;br&gt;
•Once the lease expires, the server reclaims the IP and returns it to the pool&lt;/p&gt;

&lt;p&gt;This is why DHCP lease times matter. A very long lease time (say, 7 days) means an IP can be "stuck" for a week after a device disappears. A shorter lease time means faster reclamation, but more frequent renewal traffic on the network.&lt;/p&gt;

&lt;p&gt;--&amp;gt;ipconfig /release and /renew On Windows, you can manually trigger these processes. 'ipconfig /release' sends a DHCP Release and removes the IP configuration. 'ipconfig /renew' then starts a new DORA process to get a fresh IP. This is a common first step when troubleshooting "no internet" issues on Windows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Broadcast vs. Unicast — The Full Picture&lt;/strong&gt;&lt;br&gt;
One of the most important concepts in DHCP is understanding why each message is either a broadcast or unicast. Here is the complete summary:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8ejcuk07is83wbw4lix.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8ejcuk07is83wbw4lix.png" alt=" " width="800" height="257"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. DHCP Relay — What About Multiple Subnets?&lt;/strong&gt;&lt;br&gt;
There is an important limitation to standard DHCP: the Discover and Offer messages are broadcasts, and routers do not forward broadcasts between subnets by default. This means a single DHCP server on one subnet cannot normally serve clients on other subnets.&lt;/p&gt;

&lt;p&gt;In a real enterprise network with dozens of subnets, you cannot deploy a DHCP server on every single subnet — that would be an administrative nightmare. The solution is a DHCP Relay Agent.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;How DHCP Relay Works&lt;/em&gt;&lt;br&gt;
A DHCP Relay Agent (also called an IP Helper) is software running on a router or Layer 3 switch that intercepts local DHCP broadcasts and forwards them as unicast messages to a centralized DHCP server on a different subnet. The server replies to the relay agent, which then forwards the response back to the client.&lt;/p&gt;

&lt;p&gt;Client (VLAN 10)&lt;br&gt;
    |&lt;br&gt;
    | broadcasts DHCP Discover&lt;br&gt;
    ↓&lt;br&gt;
Router (Relay Agent)                     DHCP Server (VLAN 1)&lt;br&gt;
    | ──── unicast DHCP Discover ──────→ |&lt;br&gt;
    | ←─── unicast DHCP Offer ──────────-|&lt;br&gt;
    |&lt;br&gt;
    | broadcasts DHCP Offer back to client&lt;br&gt;
    ↓&lt;br&gt;
Client receives Offer and continues DORA normally&lt;/p&gt;

&lt;p&gt;On Cisco routers, the DHCP relay is configured with the 'ip helper-address' command on the client-facing interface, pointing to the DHCP server's IP. This is one of the most commonly configured features in enterprise networking.&lt;/p&gt;

&lt;p&gt;--&amp;gt;Real-World Implication: When troubleshooting DHCP failures in enterprise environments, always check the relay agent configuration first. A misconfigured or missing 'ip helper-address' is one of the most common reasons clients on a subnet cannot get an IP address despite a healthy DHCP server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. DHCP Security Risks&lt;/strong&gt;&lt;br&gt;
Because DHCP operates on trust — clients accept configuration from whoever responds first — it is vulnerable to several attack types that every network engineer should understand.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fng2f9zlnc48h3ztyjhqy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fng2f9zlnc48h3ztyjhqy.png" alt=" " width="800" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DHCP Snooping is a Layer 2 security feature available on managed switches. It designates specific ports as "trusted" (connected to the real DHCP server) and "untrusted" (connected to clients). DHCP Offer and Ack messages from untrusted ports are dropped, preventing rogue servers from poisoning client configurations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Complete DHCP Flow — From Boot to Internet&lt;/strong&gt;&lt;br&gt;
Putting it all together, here is the full sequence from a device powering on to it having internet access:&lt;/p&gt;

&lt;p&gt;3.Device boots up — no IP address, no network configuration&lt;br&gt;
4.Client broadcasts DHCP Discover — looking for any DHCP server on the subnet&lt;br&gt;
5.DHCP server receives Discover — reserves an IP from its pool, sends a Broadcast Offer&lt;br&gt;
6.Client receives Offer — selects the server, broadcasts a DHCP Request&lt;br&gt;
7.All DHCP servers receive the Request — unchosen servers release their reserved IPs; chosen server sends ACK&lt;br&gt;
8.Client receives Ack — performs ARP conflict check, then configures the network interface&lt;br&gt;
9.Client is now online — uses the IP address, subnet mask, gateway, and DNS from the lease&lt;br&gt;
10.At 50% of lease time — client unicasts a Renewal Request to extend the lease&lt;br&gt;
11.Server responds with Renewal Ack — lease timer resets, process repeats at T1 again&lt;br&gt;
12.When done — client sends DHCP Release (unicast) and loses network access&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Takeaways&lt;/strong&gt;&lt;br&gt;
•DHCP automates network configuration — IP address, subnet mask, gateway, DNS, and lease time are all delivered automatically&lt;br&gt;
•The four-step DORA process (Discover → Offer → Request → Ack) is the foundation of every IP allocation&lt;br&gt;
•Initial allocation uses broadcast throughout because the client has no IP and doesn't yet know the server's address&lt;br&gt;
•Renewal uses unicast because both sides already know each other's addresses from the original lease&lt;br&gt;
•Lease times are intentional — they let the server reclaim IPs from devices that leave without releasing them&lt;br&gt;
•T1 (50%) triggers renewal; T2 (87.5%) is the fallback if T1 fails; expiry resets the whole process&lt;br&gt;
•DHCP Release is optional but courteous — abrupt disconnections leave addresses tied up until the lease expires&lt;br&gt;
•DHCP Relay Agents (ip helper-address) allow a single DHCP server to serve clients across multiple subnets&lt;br&gt;
•DHCP Snooping on managed switches prevents rogue DHCP servers from hijacking client configurations&lt;br&gt;
•A 169.254.x.x address on a client almost always means DHCP failed — the client fell back to APIPA self-assignment&lt;br&gt;
==&amp;gt;Remember the DORA acronym: Discover → Offer → Request → Acknowledge. Every DHCP allocation follows this exact sequence, every time, on every network in the world.&lt;/p&gt;

</description>
      <category>dhcp</category>
      <category>networking</category>
      <category>protocols</category>
      <category>ip</category>
    </item>
    <item>
      <title>How DNS, TCP, TLS &amp; HTTP Actually Work</title>
      <dc:creator>Manoj Kumar Vemula</dc:creator>
      <pubDate>Wed, 25 Feb 2026 07:47:33 +0000</pubDate>
      <link>https://forem.com/manoj_kumarvemula_31e045/how-dns-tcp-tls-http-actually-work-4ajd</link>
      <guid>https://forem.com/manoj_kumarvemula_31e045/how-dns-tcp-tls-http-actually-work-4ajd</guid>
      <description>&lt;p&gt;Hey guys, this post is a massive one for any beginner or for intermediate one's in security field as i am sure of it. I explained all the concepts in detail and recommended to complete this post and have a good understanding about How things work behind your device, as of this post we discuss only about DNS ,TCP,TLS,HTTP.&lt;/p&gt;

&lt;p&gt;Every time you type a URL into your browser and hit Enter, a surprisingly complex sequence of events unfolds in milliseconds. Most people think "the page just loads" — but underneath there are at least four distinct protocols working together in a precise order.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The full journey looks like this:&lt;/strong&gt;&lt;br&gt;
1.DNS Resolution — translate the human-readable domain name into an IP address&lt;br&gt;
2.TCP Handshake — open a reliable connection to that IP address&lt;br&gt;
3.TLS Handshake — secure the connection with encryption&lt;br&gt;
4.HTTP Request/Response — fetch and receive the actual web content&lt;br&gt;
5.TCP Termination — cleanly close the connection&lt;/p&gt;

&lt;p&gt;This guide walks through each stage in depth. By the end you will understand not just what happens, but why each step exists and what goes wrong when it fails.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. DNS — Domain Name System&lt;/strong&gt;&lt;br&gt;
What Is DNS and Why Does It Exist?&lt;br&gt;
Computers communicate using IP addresses (like 93.184.216.34), but humans are far better at remembering names (like example.com). DNS is the system that bridges this gap — it is essentially the internet's phone book, translating human-readable domain names into machine-readable IP addresses.&lt;/p&gt;

&lt;p&gt;Without DNS, you would need to memorize a numerical IP address for every website you visit. DNS automates that lookup invisibly, every single time you load a page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The DNS Resolver&lt;/strong&gt;&lt;br&gt;
The DNS Resolver (also called the Recursive Resolver) is the DNS client that works on your behalf. When you type a URL, your operating system contacts a resolver — usually provided by your ISP or a public service like Google (8.8.8.8) or Cloudflare (1.1.1.1).&lt;/p&gt;

&lt;p&gt;Think of the resolver as a detective. It receives your question ("what is the IP for example.com?"), goes out and finds the answer by talking to other DNS servers, and then delivers the final IP address back to your browser. The resolver does all the legwork so your PC doesn't have to.&lt;/p&gt;

&lt;p&gt;--&amp;gt; The resolver is the only server your PC directly talks to during DNS resolution. Everything else — Root servers, TLD servers, Authoritative servers — is handled by the resolver behind the scenes.&lt;/p&gt;

&lt;p&gt;The DNS Hierarchy&lt;br&gt;
DNS is organized as a strict hierarchy, like a tree. Every domain name is read from right to left, matching this hierarchy exactly.&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            Root  (invisible — the "." at the end of every domain)
             |
    ─────────────────────
    |         |         |
   .com      .org      .in        ← Top-Level Domains (TLD)
    |
example.com                        ← Second-Level Domain
    |
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://www.example.com" rel="noopener noreferrer"&gt;www.example.com&lt;/a&gt;                     ← Hostname / Subdomain&lt;/p&gt;

&lt;p&gt;The Four Types of DNS Servers&lt;br&gt;
Each level of the hierarchy has a corresponding type of server with a specific, limited job:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzda133u91edly3cpslv0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzda133u91edly3cpslv0.png" alt=" " width="655" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A crucial detail: Root servers and TLD servers never know IP addresses. They only know "who to ask next." This delegation model is what makes DNS scalable to billions of domains.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The DNS Resolution Process — Step by Step&lt;/strong&gt;&lt;br&gt;
Let's trace exactly what happens when your browser needs the IP for &lt;a href="http://www.example.com" rel="noopener noreferrer"&gt;www.example.com&lt;/a&gt;. Assume the resolver has no cached answer.&lt;/p&gt;

&lt;p&gt;6.Your PC sends the query ("what is &lt;a href="http://www.example.com?" rel="noopener noreferrer"&gt;www.example.com?"&lt;/a&gt;) to the Resolver&lt;br&gt;
7.Resolver asks a Root Server: "Where can I find .com?"&lt;br&gt;
8.Root Server replies: "I don't know the IP — ask the .com TLD server at this address"&lt;br&gt;
9.Resolver asks the .com TLD Server: "Where can I find example.com?"&lt;br&gt;
10.TLD Server replies: "I don't know the IP — ask example.com's authoritative server"&lt;br&gt;
11.Resolver asks the Authoritative Server: "What is the IP for &lt;a href="http://www.example.com?" rel="noopener noreferrer"&gt;www.example.com?&lt;/a&gt;"&lt;br&gt;
12.Authoritative Server replies: "93.184.216.34" — this is the actual answer&lt;br&gt;
13.Resolver returns 93.184.216.34 to your PC and caches it for future requests&lt;/p&gt;

&lt;p&gt;PC → Resolver → Root → TLD (.com) → Authoritative (example.com) → IP&lt;/p&gt;

&lt;p&gt;But why 13 Root Servers? There are 13 logical root server addresses in the world, labeled A through M. But "logical" is key — each is actually a cluster of hundreds of physical servers distributed globally via anycast routing, giving the system enormous redundancy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DNS Caching — The Speed Optimization&lt;/strong&gt;&lt;br&gt;
After a resolver retrieves an answer, it stores (caches) it for a period of time defined by the domain owner — this is called the TTL (Time to Live). On the next request for the same domain, the resolver returns the cached answer instantly without walking up the hierarchy again.&lt;/p&gt;

&lt;p&gt;Your browser and operating system also maintain their own DNS caches. This is why DNS changes (like pointing a domain to a new server) can take time to propagate — old cached records need to expire first.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnan786t8p94yyei18nh6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnan786t8p94yyei18nh6.png" alt=" " width="800" height="245"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. TCP — Transmission Control Protocol&lt;/strong&gt;&lt;br&gt;
What Is TCP and Why Is It Used?&lt;br&gt;
Once the resolver returns an IP address, the browser needs to establish a connection to that server before sending any data. TCP (Transmission Control Protocol) is the protocol that creates this connection.&lt;/p&gt;

&lt;p&gt;TCP is a connection-oriented protocol, meaning both sides must formally agree to open a session before any data flows. It guarantees reliable, ordered delivery — if a packet is lost, TCP automatically retransmits it. This reliability is why HTTP (and HTTPS) runs over TCP rather than UDP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The 3-Way Handshake — Opening the Connection&lt;/strong&gt;&lt;br&gt;
Before a single byte of HTTP data is sent, TCP performs a 3-way handshake to synchronize both sides and establish a reliable session. The process uses special control flags in the TCP header: SYN (Synchronize) and ACK (Acknowledge).&lt;/p&gt;

&lt;p&gt;Client  ──── SYN ────────────────────→  Server&lt;br&gt;
Client  ←─── SYN + ACK ──────────────  Server&lt;br&gt;
Client  ──── ACK ────────────────────→  Server&lt;br&gt;
                ↓&lt;br&gt;
     Connection established — ready for data&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1 — SYN (Client → Server)&lt;/strong&gt;&lt;br&gt;
The client sends a TCP segment with the SYN flag set and an Initial Sequence Number (ISN) — a random starting number for tracking data order. The ISN is critical for reassembling packets in the right order and for detecting retransmissions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2 — SYN-ACK (Server → Client)&lt;/strong&gt;&lt;br&gt;
The server acknowledges the client's ISN by sending back SYN + ACK. The ACK confirms the client's sequence number (client ISN + 1). The server also sends its own ISN so the client can track the server's data stream.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3 — ACK (Client → Server)&lt;/strong&gt;&lt;br&gt;
The client acknowledges the server's ISN (server ISN + 1). Both sides have now exchanged sequence numbers and confirmed each other is reachable. A full-duplex, reliable TCP session is open. Data can flow in both directions simultaneously.&lt;/p&gt;

&lt;p&gt;So, Why do we need Sequence Numbers? &lt;br&gt;
-&amp;gt;Sequence numbers let TCP detect lost packets, reorder out-of-sequence segments, and prevent old duplicate packets from being accepted. Without them, TCP would have no way to guarantee ordered, reliable delivery.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The 4-Way Termination — Closing the Connection&lt;/strong&gt;&lt;br&gt;
Because TCP is full-duplex (data flows independently in both directions), each direction must be closed separately. This requires 4 steps instead of 3.&lt;/p&gt;

&lt;p&gt;Client  ──── FIN ────────────────────→  Server   (client done sending)&lt;br&gt;
Client  ←─── ACK ────────────────────  Server   (server acknowledges)&lt;br&gt;
Client  ←─── FIN ────────────────────  Server   (server done sending)&lt;br&gt;
Client  ──── ACK ────────────────────→  Server   (client acknowledges)&lt;br&gt;
                ↓&lt;br&gt;
     Connection closed&lt;/p&gt;

&lt;p&gt;Modern HTTP uses a Connection: keep-alive header to avoid this teardown overhead. With keep-alive, the same TCP connection is reused for multiple HTTP requests to the same server — significantly speeding up page loads that require many resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. TLS — Transport Layer Security&lt;/strong&gt;&lt;br&gt;
What Is TLS and Where Does It Fit?&lt;br&gt;
After the TCP connection is open, the browser initiates a TLS (Transport Layer Security) handshake before sending any HTTP data. TLS is the cryptographic protocol that turns HTTP into HTTPS — securing communication so that no one eavesdropping on the network can read or tamper with the data.&lt;/p&gt;

&lt;p&gt;Protocol    Layer   Purpose&lt;br&gt;
HTTP    Application Web content — requests and responses&lt;br&gt;
TLS Presentation / Security Encryption, integrity, and authentication&lt;br&gt;
TCP Transport   Reliable, ordered delivery&lt;br&gt;
IP  Network Routing packets across networks&lt;/p&gt;

&lt;p&gt;The formula is: HTTPS = HTTP + TLS + TCP + IP. TLS sits between the application and transport layers, wrapping all HTTP data in an encrypted envelope before TCP transmits it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What the TLS Handshake Achieves&lt;/strong&gt;&lt;br&gt;
Before any encrypted data can flow, the client and server must agree on three things:&lt;br&gt;
•Confidentiality — which encryption algorithm to use so data cannot be read by outsiders&lt;br&gt;
•Integrity — which hashing algorithm to use so tampering can be detected&lt;br&gt;
•Authentication — verifying the server is genuinely who it claims to be (via certificates)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cipher Suites — Agreeing on the Algorithms&lt;/strong&gt;&lt;br&gt;
A cipher suite is a named combination of cryptographic algorithms that defines how the TLS session will be secured. For example:&lt;/p&gt;

&lt;p&gt;TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhynqtpt0olovqzssfz15.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhynqtpt0olovqzssfz15.png" alt=" " width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The client sends a list of all cipher suites it supports. The server picks the strongest one it also supports. If there is no overlap, the TLS handshake fails and the connection is rejected.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TLS 1.2 Handshake — Step by Step&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Client  ──── ClientHello ────────────────────────→  Server&lt;br&gt;
Client  ←─── ServerHello + Certificate ──────────  Server&lt;br&gt;
         [Client verifies certificate]&lt;br&gt;
Client  ──── Key Exchange ───────────────────────→  Server&lt;br&gt;
         [Both derive session keys]&lt;br&gt;
Client  ──── ChangeCipherSpec + Finished ────────→  Server&lt;br&gt;
Client  ←─── ChangeCipherSpec + Finished ────────  Server&lt;br&gt;
                        ↓&lt;br&gt;
          Encrypted HTTPS channel established&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1 — ClientHello&lt;/strong&gt;&lt;br&gt;
The client opens TLS negotiation by sending a ClientHello message. This contains the supported TLS versions, the list of cipher suites the client supports, a client random number (used later in key derivation), and extensions like SNI (Server Name Indication — tells the server which domain is being requested, allowing one server to host multiple TLS certificates).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2 — ServerHello + Certificate&lt;/strong&gt;&lt;br&gt;
The server responds by selecting the TLS version and cipher suite, then sends its own server random number. It also sends its digital certificate, which contains the server's public key, the domain name it is valid for, the Certificate Authority (CA) that issued it, the validity period, and a digital signature.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Step 3 — Certificate Verification *&lt;/em&gt;(The Critical Security Step)&lt;br&gt;
Before proceeding, the client must verify that the server's certificate is legitimate. This is the step that prevents man-in-the-middle attacks. The client checks:&lt;br&gt;
•CA signature — was the certificate signed by a trusted Certificate Authority?&lt;br&gt;
•Domain match — does the certificate's domain name match the URL being visited?&lt;br&gt;
•Expiry — is the certificate still within its valid date range?&lt;br&gt;
•Chain of trust — does the certificate trace back through intermediate CAs to a Root CA the browser already trusts?&lt;/p&gt;

&lt;p&gt;Root CA  (pre-installed in your OS/browser)&lt;br&gt;
   ↓     signs →&lt;br&gt;
Intermediate CA&lt;br&gt;
   ↓     signs →&lt;br&gt;
Server Certificate  (presented during TLS handshake)&lt;/p&gt;

&lt;p&gt;If any check fails — expired certificate, wrong domain, unknown CA — your browser shows a security warning and blocks the connection. This is not an inconvenience; it is the system working as intended.&lt;/p&gt;

&lt;p&gt;Why a Chain? Root CAs are extremely sensitive. If a Root CA private key is compromised, every certificate it ever signed becomes untrusted. Intermediate CAs add a buffer — only the intermediate's key is used day-to-day, limiting exposure if it's ever compromised.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4 — Key Exchange&lt;/strong&gt;&lt;br&gt;
With the server authenticated, the client and server now need to establish a shared secret that neither side transmitted in plaintext. This is where RSA or ECDHE key exchange comes in.&lt;/p&gt;

&lt;p&gt;In RSA key exchange, the client generates a pre-master secret, encrypts it with the server's public key (from the certificate), and sends it over. Only the server can decrypt this using its private key. Both sides then independently compute the same session keys using:&lt;/p&gt;

&lt;p&gt;Session Keys = PRF(pre-master secret, client random, server random)&lt;/p&gt;

&lt;p&gt;This produces several keys: one for encrypting client-to-server data, one for server-to-client data, and MAC keys for integrity checking. The random values from each side ensure that even if the same pre-master secret were reused, the session keys would be different every time.&lt;/p&gt;

&lt;p&gt;Why Not Encrypt Everything with the Public Key? Public key (asymmetric) cryptography is mathematically expensive — it can be hundreds of times slower than symmetric encryption. TLS uses asymmetric crypto only for the key exchange, then switches to fast symmetric ciphers (like AES) for all actual data. This hybrid approach gives you the security of asymmetric with the speed of symmetric.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5 — ChangeCipherSpec + Finished&lt;/strong&gt;&lt;br&gt;
Both client and server send a ChangeCipherSpec message signaling "I'm switching to encrypted mode now." They then each send a Finished message — the first message encrypted with the newly derived session keys — which contains a hash of the entire handshake transcript. If both sides can successfully decrypt and verify each other's Finished message, the handshake is complete and the session keys are confirmed correct.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TLS 1.3 — A Faster Modern Alternative&lt;/strong&gt;&lt;br&gt;
TLS 1.3 (the current standard) reduces the handshake to fewer round trips — it can often complete in 1-RTT (one round trip) instead of 2-RTT for TLS 1.2. It also removed weaker cipher suites entirely, making the negotiation simpler and more secure. If you see TLS 1.3 in browser dev tools, this is what is running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. HTTP — HyperText Transfer Protocol&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;What Happens After TLS?&lt;/strong&gt;&lt;br&gt;
With a TCP connection open and TLS encryption active, the browser can finally request the actual web content. HTTP (HyperText Transfer Protocol) is the application-layer protocol that defines how browsers and servers ask for and deliver web resources.&lt;/p&gt;

&lt;p&gt;Everything from this point forward — the request, the response, all the HTML/CSS/JS — travels inside TLS-encrypted envelopes. An attacker monitoring the network can see that you are talking to a server, but cannot read the content of any request or response.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTP Request — What the Browser Sends&lt;/strong&gt;&lt;br&gt;
Every HTTP request has three parts: a request line, headers, and an optional body.&lt;/p&gt;

&lt;p&gt;GET /index.html HTTP/1.1&lt;br&gt;
Host: &lt;a href="http://www.example.com" rel="noopener noreferrer"&gt;www.example.com&lt;/a&gt;&lt;br&gt;
User-Agent: Mozilla/5.0 Chrome/120&lt;br&gt;
Accept: text/html,application/xhtml+xml&lt;br&gt;
Cookie: sessionID=abc123&lt;br&gt;
Connection: keep-alive&lt;/p&gt;

&lt;p&gt;**The Request Line&lt;br&gt;
**The first line contains three pieces: the HTTP method (what the browser wants to do), the resource path (which file or endpoint is being requested), and the HTTP version.&lt;/p&gt;

&lt;p&gt;Method  Purpose Has Body?   Common Use&lt;br&gt;
GET Retrieve a resource No  Loading pages, images, files&lt;br&gt;
POST    Send data to the server Yes Form submission, logins, API calls&lt;br&gt;
PUT Replace a resource  Yes Updating a record via API&lt;br&gt;
DELETE  Remove a resource   No  Deleting via API&lt;br&gt;
HEAD    Get headers only (no body)  No  Check if resource exists/changed&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Request Headers&lt;/strong&gt;&lt;br&gt;
Headers carry metadata about the request. They tell the server who is asking, what formats are acceptable, what language is preferred, and what cookies are stored. Key headers to know:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fef2w7l5iazfc9pczgye7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fef2w7l5iazfc9pczgye7.png" alt=" " width="752" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTP Response&lt;/strong&gt; — What the Server Sends Back&lt;br&gt;
The server processes the request and sends back a response, also in three parts: a status line, response headers, and the body (the actual content).&lt;/p&gt;

&lt;p&gt;HTTP/1.1 200 OK&lt;br&gt;
Content-Type: text/html; charset=UTF-8&lt;br&gt;
Content-Length: 4521&lt;br&gt;
Cache-Control: max-age=3600&lt;br&gt;
Set-Cookie: sessionID=xyz; HttpOnly; Secure&lt;br&gt;
Server: nginx/1.24&lt;/p&gt;

Example&lt;br&gt;
  ...&lt;br&gt;


&lt;p&gt;&lt;strong&gt;Status Codes&lt;/strong&gt;&lt;br&gt;
The three-digit status code tells the browser exactly what happened with the request. They are grouped by the first digit:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frs3sctp0l90kvbukb525.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frs3sctp0l90kvbukb525.png" alt=" " width="672" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One Page = Many HTTP Requests&lt;/strong&gt;&lt;br&gt;
A common misconception is that loading a webpage is a single request. In reality, the initial HTML response contains references to dozens of other resources — each requiring its own HTTP request.&lt;/p&gt;

&lt;p&gt;A typical page load sequence looks like:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;GET /index.html — the main HTML document&lt;/li&gt;
&lt;li&gt;GET /styles/main.css — stylesheet referenced in the HTML&lt;/li&gt;
&lt;li&gt;GET /scripts/app.js — JavaScript file&lt;/li&gt;
&lt;li&gt;GET /images/logo.png — logo image&lt;/li&gt;
&lt;li&gt;GET /images/banner.jpg — hero image&lt;/li&gt;
&lt;li&gt;GET /fonts/roboto.woff2 — web font&lt;/li&gt;
&lt;li&gt;GET /api/user — API call for dynamic data (if logged in)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Modern browsers handle these in parallel using multiple TCP connections or HTTP/2 multiplexing (which allows many requests over a single TCP connection). This parallelism is why HTTP/2 provides a meaningful performance boost over HTTP/1.1 for content-heavy pages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Browser Rendering&lt;/strong&gt; — What Happens With the Response&lt;br&gt;
Once the browser starts receiving the HTML, it begins parsing and rendering before the entire response even arrives. The process:&lt;/p&gt;

&lt;p&gt;21.Parse HTML → Build DOM (Document Object Model) — a tree of every element on the page&lt;br&gt;
22.Parse CSS → Build CSSOM (CSS Object Model) — style rules for every element&lt;br&gt;
23.Execute JavaScript — which may modify the DOM or trigger additional network requests&lt;br&gt;
24.Combine DOM + CSSOM → Render Tree — only the visible elements with their computed styles&lt;br&gt;
25.Layout — calculate the exact position and size of every element on screen&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Paint — draw pixels to the display&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Performance Note: JavaScript blocks HTML parsing by default. This is why performance-conscious developers place script tags at the bottom of the HTML body, or use async and defer attributes — so JS doesn't delay page rendering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. The Complete End-to-End Flow&lt;/strong&gt;&lt;br&gt;
Here is the full sequence from URL to rendered page, with every protocol in order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; User types URL in browser&lt;/li&gt;
&lt;li&gt; Browser checks its own DNS cache&lt;/li&gt;
&lt;li&gt; If no cache → Resolver query → Root → TLD → Authoritative → IP&lt;/li&gt;
&lt;li&gt; TCP 3-way handshake (SYN → SYN-ACK → ACK)&lt;/li&gt;
&lt;li&gt; TLS handshake (ClientHello → ServerHello → Cert verify → Keys → Finished)&lt;/li&gt;
&lt;li&gt; HTTP GET request (encrypted inside TLS)&lt;/li&gt;
&lt;li&gt; Server processes request&lt;/li&gt;
&lt;li&gt; HTTP response with HTML (encrypted inside TLS)&lt;/li&gt;
&lt;li&gt; Browser parses HTML, requests additional resources (CSS, JS, images)&lt;/li&gt;
&lt;li&gt;Browser renders the page&lt;/li&gt;
&lt;li&gt;TCP connection kept alive for further requests (or closed with FIN)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpuwjj6ex5r96d3c6k0ai.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpuwjj6ex5r96d3c6k0ai.png" alt=" " width="800" height="97"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwow9ya4fv6a80omavwc9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwow9ya4fv6a80omavwc9.png" alt=" " width="800" height="109"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Security Risks at Each Stage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yulzggojnbeb52jruym.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yulzggojnbeb52jruym.png" alt=" " width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Key Takeaways&lt;br&gt;
•DNS translates domain names to IPs through a hierarchy: Resolver → Root → TLD → Authoritative&lt;br&gt;
•The Resolver is your PC's single point of contact — it walks the hierarchy on your behalf&lt;br&gt;
•DNS caching (TTL) prevents this full lookup on every request — most lookups are instant cache hits&lt;br&gt;
•TCP's 3-way handshake (SYN/SYN-ACK/ACK) establishes a reliable, ordered connection before any data flows&lt;br&gt;
•TLS provides confidentiality, integrity, and authentication — it is the reason HTTPS is trustworthy&lt;br&gt;
•Certificate verification is the critical security step — it prevents you from being fooled by fake servers&lt;br&gt;
•TLS uses hybrid cryptography: asymmetric (RSA/ECDHE) for key exchange, symmetric (AES) for data — the best of both worlds&lt;br&gt;
•HTTP is a request/response protocol — one page load triggers many individual requests for resources&lt;br&gt;
•Modern browsers pipeline and parallelize requests; HTTP/2 multiplexes them over one TCP connection&lt;br&gt;
•Every stage has a corresponding attack surface — understanding the protocol is the first step to understanding the security&lt;/p&gt;

&lt;p&gt;--&amp;gt;The full order is always DNS → TCP → TLS → HTTP. You cannot skip steps. Each layer depends on the one before it being established correctly.&lt;/p&gt;

</description>
      <category>dns</category>
      <category>tcp</category>
      <category>tls</category>
      <category>http</category>
    </item>
    <item>
      <title>SUBNETTING EXPLAINED</title>
      <dc:creator>Manoj Kumar Vemula</dc:creator>
      <pubDate>Tue, 24 Feb 2026 17:22:10 +0000</pubDate>
      <link>https://forem.com/manoj_kumarvemula_31e045/subnetting-explained-5hl9</link>
      <guid>https://forem.com/manoj_kumarvemula_31e045/subnetting-explained-5hl9</guid>
      <description>&lt;p&gt;Here in this blog i made complete guide to IP subnetting — from theory to practical problem solving. Let's Start&lt;br&gt;
&lt;strong&gt;1. What is Subnetting?&lt;/strong&gt;&lt;br&gt;
Subnetting is the process of dividing one large IP network into multiple smaller, logical subnetworks (subnets). This is done by borrowing bits from the host portion of an IP address and assigning them to the network portion — effectively shrinking each network's host space to create more networks.&lt;/p&gt;

&lt;p&gt;Think of it like splitting a large apartment building into separate floors. Each floor (subnet) has its own numbered units (hosts), and the building's address (network ID) identifies which floor you're on.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Do We Subnet?&lt;/strong&gt;&lt;br&gt;
•Efficient IP address usage — avoid wasting large blocks of addresses on small networks&lt;br&gt;
•Reduce broadcast traffic — broadcasts stay confined within each subnet&lt;br&gt;
•Improve performance — less unnecessary traffic on each segment&lt;br&gt;
•Better security segmentation — isolate departments or systems&lt;br&gt;
•Easier network management — logical groupings make troubleshooting simpler&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. IPv4 Address Structure&lt;/strong&gt;&lt;br&gt;
An IPv4 address is 32 bits long, written in dotted-decimal notation — four groups of 8 bits (called octets), each ranging from 0 to 255.&lt;/p&gt;

&lt;p&gt;Example: 192.168.1.10&lt;br&gt;
Binary:  11000000.10101000.00000001.00001010&lt;/p&gt;

&lt;p&gt;Every IPv4 address is split into two logical parts:&lt;br&gt;
•Network bits — identify which network the device belongs to&lt;br&gt;
•Host bits — identify the specific device within that network&lt;/p&gt;

&lt;p&gt;The subnet mask determines where the boundary between network bits and host bits falls. A /24 mask means the first 24 bits are the network portion and the last 8 bits are for hosts.&lt;/p&gt;

&lt;p&gt;IP:  192.168.1.10&lt;br&gt;
Mask: 255.255.255.0  (/24)&lt;br&gt;
      |--Network----|Host|&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. The Subnet Mask&lt;/strong&gt;&lt;br&gt;
The subnet mask is a 32-bit number that tells both routers and hosts which part of an IP address is the network ID and which part is the host ID. In binary, it is always a sequence of 1s followed by 0s — no mixing.&lt;/p&gt;

&lt;p&gt;255.255.255.0 = /24&lt;br&gt;
11111111.11111111.11111111.00000000&lt;br&gt;
  1s = network bits      0s = host bits&lt;/p&gt;

&lt;p&gt;Devices use the subnet mask to decide whether a destination IP is on the same local network (send directly) or a different network (send to the gateway router).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. How Devices Use the AND Operation&lt;/strong&gt;&lt;br&gt;
When a device wants to communicate with another IP address, it needs to determine if that address is on the same subnet. It does this using a bitwise AND operation — comparing each bit of the IP address against the corresponding bit of the subnet mask.&lt;/p&gt;

&lt;p&gt;The rule is simple: 1 AND 1 = 1, anything AND 0 = 0. The result is the Network ID.&lt;/p&gt;

&lt;p&gt;Source IP:   192.168.1.10&lt;br&gt;
Subnet Mask: 255.255.255.0&lt;/p&gt;

&lt;p&gt;IP:   11000000.10101000.00000001.00001010&lt;br&gt;
Mask: 11111111.11111111.11111111.00000000&lt;br&gt;
AND:  11000000.10101000.00000001.00000000&lt;/p&gt;

&lt;p&gt;Result: 192.168.1.0  (this is the Network ID)&lt;/p&gt;

&lt;p&gt;The device performs this AND operation on BOTH the source and destination IPs. If both results match, they are on the same subnet — communicate directly. If they differ, the packet goes to the default gateway.&lt;/p&gt;

&lt;p&gt;This AND logic is performed in hardware at wire speed — it happens on every single packet a device sends or receives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Network ID and Broadcast Address&lt;/strong&gt;&lt;br&gt;
Network ID (First Address)&lt;br&gt;
The Network ID is the address where all host bits are set to 0. It identifies the subnet itself — you cannot assign this address to any device.&lt;br&gt;
192.168.1.0/24  →  Host bits = 00000000  →  Network ID&lt;/p&gt;

&lt;p&gt;Broadcast Address (Last Address)&lt;br&gt;
The broadcast address is where all host bits are set to 1. Any packet sent to this address is delivered to every device on the subnet. You cannot assign this address to any device either.&lt;br&gt;
192.168.1.255/24  →  Host bits = 11111111  →  Broadcast&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Usable Host Addresses&lt;/strong&gt;&lt;br&gt;
Since the first address (Network ID) and the last address (Broadcast) in any subnet are reserved and cannot be assigned to hosts, the formula for usable hosts is:&lt;/p&gt;

&lt;p&gt;Usable Hosts = 2^H − 2&lt;/p&gt;

&lt;p&gt;Where H = the number of host bits remaining after subnetting.&lt;/p&gt;

&lt;p&gt;Example for /24:&lt;br&gt;
  Host bits (H) = 32 - 24 = 8&lt;br&gt;
  Usable hosts  = 2^8 - 2 = 256 - 2 = 254&lt;br&gt;
  Range: 192.168.1.1 to 192.168.1.254&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Subnetting Formulas&lt;/strong&gt;&lt;br&gt;
Two core formulas drive every subnetting decision:&lt;/p&gt;

&lt;p&gt;For number of subnets needed:&lt;br&gt;
2^N ≥ required subnets    (N = bits to borrow)&lt;/p&gt;

&lt;p&gt;For hosts per subnet:&lt;br&gt;
2^H − 2 ≥ required hosts  (H = remaining host bits)&lt;/p&gt;

&lt;p&gt;You borrow N bits from the host portion of the original mask, which increases the prefix length by N. The remaining H bits define how many hosts each subnet can hold.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Borrowing Bits — What It Actually Means&lt;/strong&gt;&lt;br&gt;
When you "borrow" bits, you are shifting the boundary between network and host portions further into the host space. This creates more network addresses (subnets) but reduces the host space in each one.&lt;/p&gt;

&lt;p&gt;Original network: 192.168.1.0/24&lt;br&gt;
Original mask:    11111111.11111111.11111111.00000000&lt;/p&gt;

&lt;p&gt;Borrow 2 bits:    11111111.11111111.11111111.11000000&lt;br&gt;
New mask:         255.255.255.192  (/26)&lt;/p&gt;

&lt;p&gt;Borrowing 2 bits gives us 2² = 4 subnets, each with 2^6 − 2 = 62 usable hosts. More subnets, fewer hosts per subnet — that's the fundamental trade-off.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. Block Size — The Most Useful Trick&lt;/strong&gt;&lt;br&gt;
The block size tells you how many IP addresses each subnet contains (including Network ID and Broadcast). It's the increment between subnet starting addresses, and it makes finding subnet ranges fast without binary math.&lt;/p&gt;

&lt;p&gt;Block Size = 256 − (interesting octet value)&lt;/p&gt;

&lt;p&gt;The "interesting octet" is the octet where the subnet mask is neither 255 (fully network) nor 0 (fully host) — it is the octet being split.&lt;/p&gt;

&lt;p&gt;Example: /26  →  Mask = 255.255.255.192&lt;br&gt;
Interesting octet value = 192&lt;br&gt;
Block size = 256 - 192 = 64&lt;/p&gt;

&lt;p&gt;Subnets start at: 0, 64, 128, 192&lt;/p&gt;

&lt;p&gt;--&amp;gt;Memorize block sizes: /25→128, /26→64, /27→32, /28→16, /29→8, /30→4. These come up in every subnetting problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. Solving Subnet Problems — Step by Step&lt;/strong&gt;&lt;br&gt;
This is where most people get stuck. The key is following a repeatable process every single time. Here is the universal method with full explanation of each step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The 6-Step Method&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.Identify the prefix length (/x) from the problem&lt;br&gt;
2.Determine the interesting octet (where the split happens)&lt;br&gt;
3.Calculate the block size: 256 − mask value in that octet&lt;br&gt;
4.List the subnet ranges by adding block size repeatedly&lt;br&gt;
5.Find which range your IP falls into&lt;br&gt;
6.Read off Network ID (first), Broadcast (last), and host range (between)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Worked Example 1 — /26 subnet&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Problem: Given IP address 192.168.1.70/26, find the Network ID, Broadcast, and usable host range.&lt;/p&gt;

&lt;p&gt;Step 1 — Identify the prefix&lt;br&gt;
/26 → 26 network bits, 6 host bits&lt;/p&gt;

&lt;p&gt;Step 2 — Find the interesting octet&lt;br&gt;
Mask for /26: 255.255.255.192&lt;br&gt;
Octets 1,2,3 = 255 (fully network — not interesting)&lt;br&gt;
Octet 4 = 192 (this is the interesting octet)&lt;/p&gt;

&lt;p&gt;Step 3 — Calculate block size&lt;br&gt;
Block size = 256 - 192 = 64&lt;/p&gt;

&lt;p&gt;Step 4 — List the subnet ranges&lt;br&gt;
Subnet 1:  0   to  63&lt;br&gt;
Subnet 2:  64  to 127   ← our IP (70) falls here&lt;br&gt;
Subnet 3:  128 to 191&lt;br&gt;
Subnet 4:  192 to 255&lt;/p&gt;

&lt;p&gt;Step 5 — Confirm which range contains 70&lt;br&gt;
70 is between 64 and 127, so we are in the second subnet.&lt;/p&gt;

&lt;p&gt;Step 6 — Read off the answers&lt;br&gt;
Network ID:     192.168.1.64  (first address in range)&lt;br&gt;
Broadcast:      192.168.1.127 (last address in range)&lt;br&gt;
First host:     192.168.1.65&lt;br&gt;
Last host:      192.168.1.126&lt;br&gt;
Usable hosts:   62  (2^6 - 2)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Worked Example 2 — /22 subnet&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Problem: Given IP address 10.205.79.90/22, find the Network ID, Broadcast, and host range.&lt;/p&gt;

&lt;p&gt;Step 1 — Identify the prefix&lt;br&gt;
/22 → 22 network bits, 10 host bits&lt;/p&gt;

&lt;p&gt;Step 2 — Find the interesting octet&lt;br&gt;
Mask for /22: 255.255.252.0&lt;br&gt;
Octet 1 = 255, Octet 2 = 255 (not interesting)&lt;br&gt;
Octet 3 = 252 (this is the interesting octet!)&lt;br&gt;
Octet 4 = 0 (fully host — not interesting)&lt;/p&gt;

&lt;p&gt;Step 3 — Calculate block size&lt;br&gt;
Block size = 256 - 252 = 4&lt;/p&gt;

&lt;p&gt;Step 4 — List subnet ranges in the 3rd octet&lt;br&gt;
...72-75, 76-79, 80-83, 84-87...&lt;/p&gt;

&lt;p&gt;Step 5 — The 3rd octet of our IP is 79&lt;br&gt;
79 falls in the range 76–79. So the network starts at 76 in the third octet.&lt;/p&gt;

&lt;p&gt;Step 6 — Read off the answers&lt;br&gt;
Network ID:   10.205.76.0    (3rd octet = 76, 4th = 0)&lt;br&gt;
Broadcast:    10.205.79.255  (3rd octet = 79, 4th = 255)&lt;br&gt;
First host:   10.205.76.1&lt;br&gt;
Last host:    10.205.79.254&lt;br&gt;
Usable hosts: 1022  (2^10 - 2)&lt;/p&gt;

&lt;p&gt;When the interesting octet is not the last one (like /22), the full host range spans multiple values of the last octet. The network starts at (block_start).0 and ends at (block_end).255.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Worked Example 3&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Problem: A company has the network 192.168.1.0/24 and needs to divide it into at least 3 departments.&lt;/p&gt;

&lt;p&gt;Step 1 — Find how many bits to borrow&lt;br&gt;
We need 3 subnets&lt;br&gt;
2^1 = 2  (not enough)&lt;br&gt;
2^2 = 4  (enough — borrow 2 bits)&lt;/p&gt;

&lt;p&gt;Step 2 — Calculate the new mask&lt;br&gt;
Original: /24&lt;br&gt;
Borrow 2 bits → /24 + 2 = /26&lt;br&gt;
New mask: 255.255.255.192&lt;/p&gt;

&lt;p&gt;Step 3 — List the available subnets&lt;br&gt;
Subnet 1: 192.168.1.0/26   Hosts: .1 to .62&lt;br&gt;
Subnet 2: 192.168.1.64/26  Hosts: .65 to .126&lt;br&gt;
Subnet 3: 192.168.1.128/26 Hosts: .129 to .190&lt;br&gt;
Subnet 4: 192.168.1.192/26 Hosts: .193 to .254  (spare)&lt;/p&gt;

&lt;p&gt;You now have 4 subnets (we needed 3 minimum), each supporting 62 hosts. Assign three to departments and keep one as a spare.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11. CIDR Notation&lt;/strong&gt;&lt;br&gt;
CIDR (Classless Inter-Domain Routing) notation is the compact /x format that replaces the older class-based system. Instead of writing out the full subnet mask, you write the number of network bits after a slash.&lt;/p&gt;

&lt;p&gt;192.168.1.0/24   means 24 network bits, 8 host bits&lt;br&gt;
10.0.0.0/8       means 8 network bits, 24 host bits&lt;br&gt;
172.16.0.0/12    means 12 network bits, 20 host bits&lt;/p&gt;

&lt;p&gt;CIDR is used everywhere — routing tables, firewall rules, cloud security groups, and IP allocation. Understanding /x notation instantly tells you the block size and host capacity of any subnet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;12. Quick Reference Table&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CIDR    Subnet Mask Block Size  Total IPs   Usable Hosts&lt;br&gt;
/24 255.255.255.0   256 256 254&lt;br&gt;
/25 255.255.255.128 128 128 126&lt;br&gt;
/26 255.255.255.192 64  64  62&lt;br&gt;
/27 255.255.255.224 32  32  30&lt;br&gt;
/28 255.255.255.240 16  16  14&lt;br&gt;
/29 255.255.255.248 8   8   6&lt;br&gt;
/30 255.255.255.252 4   4   2&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;13. Key Takeaways&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is everything you need to carry away from this guide:&lt;/p&gt;

&lt;p&gt;•Subnetting divides one network into many by borrowing host bits — more subnets means fewer hosts per subnet&lt;br&gt;
•Devices find their subnet using bitwise AND: IP AND Mask = Network ID&lt;br&gt;
•The Network ID (all host bits = 0) and Broadcast (all host bits = 1) are always reserved — never assignable&lt;br&gt;
•Block size = 256 − mask octet value — this is your fastest tool for finding subnet ranges&lt;br&gt;
•Usable hosts = 2^H − 2 where H is the number of host bits&lt;br&gt;
•CIDR /x notation tells you how many bits are network bits — everything else is host bits&lt;br&gt;
•When designing subnets, always prioritize number of networks first, then hosts per network.&lt;/p&gt;

</description>
      <category>networkingjourney</category>
      <category>subnetting</category>
      <category>ccna</category>
      <category>networkengineer</category>
    </item>
    <item>
      <title>Address Resolution Protocol (ARP) and Communication Flow Analysis</title>
      <dc:creator>Manoj Kumar Vemula</dc:creator>
      <pubDate>Mon, 23 Feb 2026 07:28:01 +0000</pubDate>
      <link>https://forem.com/manoj_kumarvemula_31e045/address-resolution-protocol-arp-and-communication-flow-analysis-3o64</link>
      <guid>https://forem.com/manoj_kumarvemula_31e045/address-resolution-protocol-arp-and-communication-flow-analysis-3o64</guid>
      <description>&lt;p&gt;Hello guys, You know I used to get stuck thinking about how devices communicate each other, because unlike humans they don't have any senses right. But this concept answered all my questions and i am really excited to share my learning.&lt;br&gt;
So the very important Topic is ARP, here it works at layer 2 with MAC addresses and there are different types in ARP requests like reverse ARP, Gratuitous ARP.&lt;br&gt;
These are the contents i am going to discuss in this blog:&lt;br&gt;
--&amp;gt;ARP Fundamentals&lt;br&gt;
--&amp;gt;ARP Operation in Same Subnet Communication&lt;br&gt;
--&amp;gt;ARP Operation Across Different Networks (via Router)&lt;br&gt;
--&amp;gt;Switch MAC Learning Behavior&lt;br&gt;
--&amp;gt;ICMP Communication Flow&lt;br&gt;
--&amp;gt;Default Gateway Logic&lt;br&gt;
--&amp;gt;Network Addressing Concepts&lt;br&gt;
--&amp;gt;NIC, Network ID, Host ID&lt;br&gt;
--&amp;gt;CCNA Key Concepts&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1]Address Resolution Protocol (ARP)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Address Resolution Protocol (ARP) is defined in RFC 826 and is used to resolve a Layer 3 IPv4 address into a corresponding Layer 2 MAC address within an Ethernet network segment.&lt;/p&gt;

&lt;p&gt;In Ethernet LAN communication, devices send frames using MAC addresses, but applications and routing decisions use IP addresses. ARP provides the necessary mapping between these two address types.&lt;/p&gt;

&lt;p&gt;ARP entries are temporarily stored in an ARP cache on Layer 3 devices such as hosts and routers.&lt;/p&gt;

&lt;p&gt;ARP Operational Behavior:&lt;br&gt;
When a sender needs to discover the MAC address associated with an IP address:&lt;br&gt;
The sender transmits an ARP Request as a Layer 2 broadcast.&lt;br&gt;
All devices in the broadcast domain receive and process the request.&lt;br&gt;
The device that owns the requested IP responds with an ARP Reply.&lt;br&gt;
The ARP Reply is sent as a Layer 2 unicast to the original sender.&lt;/p&gt;

&lt;p&gt;Thus:&lt;br&gt;
ARP Request → Broadcast&lt;br&gt;
ARP Reply → Unicast&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Scenario 1 — Communication Within Same Subnet&lt;/strong&gt;&lt;br&gt;
Topology:&lt;/p&gt;

&lt;p&gt;PC1 (10.1.1.1/24, MAC AAAA) — Switch — PC2 (10.1.1.2/24, MAC BBBB)&lt;/p&gt;

&lt;p&gt;All devices initially have empty ARP caches and the switch has an empty MAC address table.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Communication Process&lt;/strong&gt;&lt;br&gt;
Step 1 — Layer 3 Subnet Decision (PC1)&lt;/p&gt;

&lt;p&gt;When PC1 attempts to ping 10.1.1.2, it first determines whether the destination is local or remote.&lt;/p&gt;

&lt;p&gt;Using the subnet mask 255.255.255.0, PC1 performs a logical AND operation on both its own IP address and the destination IP address.&lt;/p&gt;

&lt;p&gt;Both results produce the same network ID (10.1.1.0), confirming that the destination is on the same subnet.&lt;/p&gt;

&lt;p&gt;PC1 therefore decides that it must send the packet directly to the destination host rather than via a router. To do this, it requires the destination MAC address.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2 — ARP Cache Lookup and Request Generation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PC1 checks its ARP cache and finds no entry for 10.1.1.2.&lt;/p&gt;

&lt;p&gt;The ICMP Echo Request packet is temporarily queued while PC1 initiates ARP resolution.&lt;/p&gt;

&lt;p&gt;PC1 constructs an ARP Request frame with:&lt;br&gt;
Destination MAC: FF:FF:FF:FF:FF:FF (broadcast)&lt;br&gt;
Source MAC: PC1’s MAC&lt;br&gt;
Sender IP: 10.1.1.1&lt;br&gt;
Target IP: 10.1.1.2&lt;br&gt;
Target MAC: unknown (all zeros)&lt;/p&gt;

&lt;p&gt;The broadcast nature ensures all devices in the LAN receive the request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3 — Switch Processing of ARP Request&lt;/strong&gt;&lt;br&gt;
The switch receives the broadcast frame on PC1’s port.&lt;/p&gt;

&lt;p&gt;Before forwarding, the switch learns the source MAC address and records that PC1’s MAC resides on that port.&lt;/p&gt;

&lt;p&gt;Because the destination MAC is broadcast, the switch floods the frame out all ports except the incoming port. PC2 therefore receives the ARP Request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4 — PC2 Processes ARP Request&lt;/strong&gt;&lt;br&gt;
PC2 examines the ARP packet and finds that the target IP matches its own IP address.&lt;/p&gt;

&lt;p&gt;PC2 therefore:&lt;/p&gt;

&lt;p&gt;Updates its ARP cache with PC1’s IP–MAC mapping.&lt;/p&gt;

&lt;p&gt;Generates an ARP Reply containing its own MAC address.&lt;/p&gt;

&lt;p&gt;The ARP Reply is sent as a unicast frame directly to PC1’s MAC address.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5 — Switch Forwards ARP Reply&lt;/strong&gt;&lt;br&gt;
The switch receives the ARP Reply on PC2’s port.&lt;/p&gt;

&lt;p&gt;It learns PC2’s MAC address location and adds it to the MAC table.&lt;/p&gt;

&lt;p&gt;Because the destination MAC (PC1) is known, the switch forwards the frame only to PC1’s port rather than flooding.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6 — PC1 Receives ARP Reply and Sends ICMP&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PC1 updates its ARP cache with the mapping:&lt;/p&gt;

&lt;p&gt;10.1.1.2 → PC2 MAC&lt;/p&gt;

&lt;p&gt;With ARP resolution complete, PC1 retrieves the queued ICMP Echo Request and encapsulates it in an Ethernet frame addressed to PC2’s MAC.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 7–10 — ICMP Echo Exchange&lt;/strong&gt;&lt;br&gt;
The switch forwards the unicast ICMP frame to PC2.&lt;/p&gt;

&lt;p&gt;PC2 validates the packet and generates an ICMP Echo Reply.&lt;/p&gt;

&lt;p&gt;The reply is sent back through the switch to PC1, completing successful ping communication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Concepts from Same-Subnet Communication:&lt;/strong&gt;&lt;br&gt;
--&amp;gt;Direct communication occurs when network IDs match.&lt;br&gt;
--&amp;gt;ARP resolves the destination host MAC.&lt;br&gt;
--&amp;gt;Switches learn MAC addresses from source fields.&lt;br&gt;
--&amp;gt;Broadcast frames are flooded; known unicast frames are forwarded selectively.&lt;br&gt;
--&amp;gt;ICMP communication depends on successful ARP resolution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Scenario 2 — Communication Across Different Networks&lt;br&gt;
Topology&lt;/strong&gt;&lt;br&gt;
PC1 (10.1.1.1/24) — Switch1 — Router — Switch2 — PC2 (10.1.2.2/24)&lt;/p&gt;

&lt;p&gt;PC1 default gateway: 10.1.1.254&lt;br&gt;
PC2 default gateway: 10.1.2.254&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Step-by-Step Inter-Network Communication&lt;br&gt;
Step 1 — PC1 Determines Destination is Remote&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
PC1 compares network IDs:&lt;/p&gt;

&lt;p&gt;PC1 network: 10.1.1.0&lt;/p&gt;

&lt;p&gt;Destination network: 10.1.2.0&lt;/p&gt;

&lt;p&gt;Since they differ, PC1 concludes the destination is on another network.&lt;/p&gt;

&lt;p&gt;Therefore, the packet must be sent to the default gateway rather than directly to the destination host.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2 — ARP for Default Gateway&lt;/strong&gt;&lt;br&gt;
PC1 checks its ARP cache for the gateway IP 10.1.1.254 and finds no entry.&lt;/p&gt;

&lt;p&gt;PC1 sends an ARP Request asking:&lt;/p&gt;

&lt;p&gt;“Who has 10.1.1.254?”&lt;/p&gt;

&lt;p&gt;This request is broadcast on the local LAN.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3–5 — Gateway ARP Resolution&lt;/strong&gt;&lt;br&gt;
The router’s interface with IP 10.1.1.254 receives the request and recognizes the target IP as its own.&lt;/p&gt;

&lt;p&gt;The router:&lt;/p&gt;

&lt;p&gt;Learns PC1’s MAC&lt;/p&gt;

&lt;p&gt;Sends an ARP Reply with its own MAC&lt;/p&gt;

&lt;p&gt;PC1 updates its ARP cache with:&lt;/p&gt;

&lt;p&gt;10.1.1.254 → Router MAC&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6 — Critical Encapsulation Concept&lt;/strong&gt;&lt;br&gt;
PC1 now sends the ICMP packet.&lt;/p&gt;

&lt;p&gt;Important distinction:&lt;/p&gt;

&lt;p&gt;Layer 3 destination IP: 10.1.2.2 (PC2)&lt;/p&gt;

&lt;p&gt;Layer 2 destination MAC: Router MAC&lt;/p&gt;

&lt;p&gt;Thus the frame is addressed to the router, but the IP packet remains addressed to PC2.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Router Forwarding Process&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
When the router receives the frame:&lt;br&gt;
Layer 2 header is removed.&lt;br&gt;
Router examines IP destination.&lt;br&gt;
Routing table lookup identifies outgoing interface.&lt;br&gt;
Router resolves destination MAC via ARP on the new network.&lt;br&gt;
Router forwards packet with new Layer 2 header.&lt;br&gt;
TTL is decremented by one.&lt;br&gt;
This is the fundamental router forwarding workflow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. ARP Across Multiple Networks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Each network segment has its own ARP domain.&lt;/p&gt;

&lt;p&gt;Key rule:&lt;br&gt;
Hosts ARP only for devices in their own subnet.&lt;br&gt;
Routers perform ARP on behalf of remote networks.&lt;/p&gt;

&lt;p&gt;Thus:&lt;br&gt;
PC1 ARPs for gateway&lt;br&gt;
Router ARPs for PC2&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Default Gateway Logic&lt;/strong&gt;&lt;br&gt;
Host decision process:&lt;/p&gt;

&lt;p&gt;If destination network = local → direct ARP&lt;br&gt;
If destination network ≠ local → send to gateway&lt;/p&gt;

&lt;p&gt;The default route (0.0.0.0/0) in the routing table defines the gateway used for unknown networks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Switch MAC Learning Principles&lt;/strong&gt;&lt;br&gt;
Switches operate at Layer 2 and learn MAC addresses dynamically.&lt;/p&gt;

&lt;p&gt;Rules:&lt;br&gt;
Learn source MAC on ingress&lt;br&gt;
Flood broadcast and unknown unicast&lt;br&gt;
Forward known unicast to specific port&lt;br&gt;
Aging timer removes inactive entries&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Network Addressing Concepts&lt;/strong&gt;&lt;br&gt;
NIC (Network Interface Card)&lt;/p&gt;

&lt;p&gt;A NIC is the physical hardware that connects a device to a network and contains a unique MAC address.&lt;/p&gt;

&lt;p&gt;It converts digital data into electrical or optical signals for transmission.&lt;/p&gt;

&lt;p&gt;Network ID&lt;br&gt;
The Network ID is the portion of an IP address that identifies the network.&lt;/p&gt;

&lt;p&gt;It is obtained by performing a logical AND between the IP address and subnet mask.&lt;/p&gt;

&lt;p&gt;Devices with the same Network ID can communicate directly.&lt;/p&gt;

&lt;p&gt;Host ID&lt;br&gt;
The Host ID uniquely identifies a device within a network.&lt;/p&gt;

&lt;p&gt;Valid host range excludes:&lt;br&gt;
Network address (all host bits 0)&lt;br&gt;
Broadcast address (all host bits 1)&lt;/p&gt;

&lt;p&gt;Default Gateway&lt;br&gt;
The default gateway is the router IP used to reach external networks.&lt;/p&gt;

&lt;p&gt;All inter-network communication passes through this gateway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. TTL Behavior&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Routers decrement the TTL field by one for each hop.&lt;br&gt;
Thus a packet sent with TTL 128 and received with TTL 127 confirms traversal through one router.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. Complete Communication Model&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Same subnet:&lt;br&gt;
Host → ARP → Direct MAC → Destination&lt;/p&gt;

&lt;p&gt;Different subnet:&lt;br&gt;
Host → ARP gateway → Router → ARP destination → Destination&lt;/p&gt;

&lt;p&gt;CCNA Key Takeaways:&lt;br&gt;
ARP maps IP to MAC within a broadcast domain.&lt;br&gt;
ARP Request is broadcast; ARP Reply is unicast.&lt;br&gt;
Same subnet hosts communicate directly.&lt;br&gt;
Different subnet hosts communicate via gateway.&lt;br&gt;
Routers rewrite Layer 2 headers at each hop.&lt;br&gt;
Switches learn MAC from source addresses.&lt;br&gt;
Each network segment has a separate ARP domain.&lt;br&gt;
TTL decrement proves router traversal.&lt;/p&gt;

</description>
      <category>arp</category>
      <category>networking</category>
      <category>tcpip</category>
    </item>
    <item>
      <title>Introduction to TCP/IP and Data Flow</title>
      <dc:creator>Manoj Kumar Vemula</dc:creator>
      <pubDate>Sun, 22 Feb 2026 09:16:25 +0000</pubDate>
      <link>https://forem.com/manoj_kumarvemula_31e045/introduction-to-tcpip-and-data-flow-4l49</link>
      <guid>https://forem.com/manoj_kumarvemula_31e045/introduction-to-tcpip-and-data-flow-4l49</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. Data Flow&lt;/strong&gt;&lt;br&gt;
Data flow in computer networks refers to the structured movement, management, and transformation of data packets between devices, ensuring efficient, error-free transmission.&lt;br&gt;
Data flow generally involves preparing data at the source, moving it through network infrastructure (routers/switches),, and reconstructing it at the destination.&lt;br&gt;
Direction of Transfer: Data flow can be categorized by direction:&lt;br&gt;
Simplex: One-way only (e.g., computer to printer).&lt;br&gt;
Half-Duplex: Two-way, but not at the same time (e.g., walkie-talkie).&lt;br&gt;
Full-Duplex: Simultaneous two-way communication (e.g., telephone call).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Encapsulation and Decapsulation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Encapsulation&lt;/strong&gt;&lt;br&gt;
Encapsulation is the process of adding protocol information (headers and trailers) to data as it moves down the network stack from the sender.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Decapsulation&lt;/strong&gt;&lt;br&gt;
Decapsulation is the reverse process at the receiver, where each layer removes its corresponding header/trailer to reveal the original data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Network Layers Overview&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Layer 1 — Physical Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7l49xla42kd75juhuos8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7l49xla42kd75juhuos8.png" alt=" " width="800" height="316"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Physical Layer is responsible for transmitting raw binary data (0s and 1s) over the physical medium.&lt;/p&gt;

&lt;p&gt;Transmission Types&lt;/p&gt;

&lt;p&gt;Radio transmission — Wi-Fi, Bluetooth (short distance)&lt;/p&gt;

&lt;p&gt;Microwave transmission — Cellular networks (4G, 5G)&lt;/p&gt;

&lt;p&gt;Fiber optic transmission — High-speed long-distance communication&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F40jm1fkc0y2s2vaw955s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F40jm1fkc0y2s2vaw955s.png" alt=" " width="605" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fiber Splicing Machine&lt;/p&gt;

&lt;p&gt;A fiber optic splicing machine joins two fiber cables permanently using an electric arc, minimizing signal loss.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 2 — Data Link Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Data Link Layer (Layer 2 of the OSI model) handles local network communication and uses MAC addresses for device identification.&lt;br&gt;
The data link layer ensures reliable, node-to-node data transfer across a physical link by organizing raw bits from the physical layer into frames.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Aspects of the Data Link Layer:&lt;/strong&gt;&lt;br&gt;
Sublayers: Comprised of the Logical Link Control (LLC), which handles network protocols and flow control, and the Media Access Control (MAC), which manages hardware addressing and medium access.&lt;br&gt;
Framing: The process of encapsulating packets from the network layer into frames with a header (source/destination MAC) and trailer (error checking) to define boundaries.&lt;br&gt;
Physical Addressing: Utilizes MAC addresses to identify devices on the local area network (LAN).&lt;br&gt;
Error Control: Detects and/or corrects errors caused by physical layer transmission (e.g., using Frame Check Sequence/CRC).&lt;br&gt;
Flow Control: Regulates the amount of data transmitted to prevent a fast sender from overwhelming a slow receiver.&lt;br&gt;
Access Control: Determines which device has control over the physical medium at any given time.&lt;/p&gt;

&lt;p&gt;Key Points&lt;/p&gt;

&lt;p&gt;Devices: Switches&lt;/p&gt;

&lt;p&gt;Address type: MAC address (48-bit hexadecimal)&lt;/p&gt;

&lt;p&gt;Frame format: Ethernet header&lt;/p&gt;

&lt;p&gt;Scope: Local network (LAN)&lt;/p&gt;

&lt;p&gt;Important Note&lt;/p&gt;

&lt;p&gt;MAC addresses were designed for delivery, not security.&lt;br&gt;
They can be spoofed.&lt;/p&gt;

&lt;p&gt;MAC Address Spoofing&lt;br&gt;
Can a device claim another MAC?&lt;/p&gt;

&lt;p&gt;Yes. A device can impersonate another MAC address.&lt;br&gt;
This is called MAC spoofing.&lt;/p&gt;

&lt;p&gt;Why switches accept it&lt;/p&gt;

&lt;p&gt;Switches operate at Layer 2 and do not authenticate the MAC source.&lt;/p&gt;

&lt;p&gt;Layer 2 Security Mechanisms&lt;/p&gt;

&lt;p&gt;Port Security&lt;/p&gt;

&lt;p&gt;Limits MAC addresses per port&lt;/p&gt;

&lt;p&gt;Binds MAC to specific port&lt;/p&gt;

&lt;p&gt;Can disable port on violation&lt;/p&gt;

&lt;p&gt;802.1X Authentication&lt;/p&gt;

&lt;p&gt;Requires device authentication&lt;/p&gt;

&lt;p&gt;Uses RADIUS server&lt;/p&gt;

&lt;p&gt;Stronger than MAC-based security&lt;/p&gt;

&lt;p&gt;DHCP Snooping&lt;/p&gt;

&lt;p&gt;Tracks legitimate DHCP assignments&lt;/p&gt;

&lt;p&gt;Blocks rogue DHCP servers&lt;/p&gt;

&lt;p&gt;Dynamic ARP Inspection (DAI)&lt;/p&gt;

&lt;p&gt;Validates ARP packets&lt;/p&gt;

&lt;p&gt;Prevents ARP spoofing&lt;/p&gt;

&lt;p&gt;Network Access Control (NAC)&lt;/p&gt;

&lt;p&gt;Checks device compliance&lt;/p&gt;

&lt;p&gt;Enforces policies&lt;/p&gt;

&lt;p&gt;Layer 2 Security Conclusion&lt;/p&gt;

&lt;p&gt;Layer 2 was designed for efficient communication, not security.&lt;br&gt;
Real security uses multiple layers (defense-in-depth).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 3 — Network Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Network Layer (Layer 3) enables communication between networks using IP addressing and routing.&lt;br&gt;
The network layer of the OSI model manages logical addressing, packet routing, and forwarding to ensure data traverses different, interconnected networks. It converts transport layer segments into packets, determines the best path, and enables end-to-end communication, primarily using the Internet Protocol (IP). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key aspects of the network layer include:&lt;/strong&gt;&lt;br&gt;
Routing: Determining the most efficient path for data to travel from source to destination.&lt;br&gt;
Logical Addressing: Using IP addresses to uniquely identify devices across networks, distinct from physical (MAC) addresses.&lt;br&gt;
Packetizing: Encapsulating segments from the transport layer into packets on the sending device and reassembling them at the destination.&lt;br&gt;
Forwarding: Moving packets from a router's input interface to the appropriate output interface.&lt;br&gt;
Protocols: Key protocols include Internet Protocol (IP), Internet Control Message Protocol (ICMP), and Internet Group Message Protocol (IGMP). &lt;/p&gt;

&lt;p&gt;Devices:&lt;br&gt;
Routers&lt;br&gt;
Address Type&lt;br&gt;
IP address&lt;br&gt;
Function:&lt;br&gt;
Routing packets between networks (WAN)&lt;/p&gt;

&lt;p&gt;IP Address Spoofing (Layer 3)&lt;br&gt;
Similar to MAC spoofing, IP addresses can also be faked.&lt;/p&gt;

&lt;p&gt;Scenario A — Same Network Conflict&lt;br&gt;
Two devices use the same IP → IP conflict → network instability.&lt;/p&gt;

&lt;p&gt;Scenario B — Fake Source IP&lt;br&gt;
A device sends packets pretending to be another IP → impersonation attack.&lt;/p&gt;

&lt;p&gt;This is more dangerous and used in:&lt;/p&gt;

&lt;p&gt;DDoS&lt;/p&gt;

&lt;p&gt;Session hijacking&lt;/p&gt;

&lt;p&gt;Man-in-the-middle attacks&lt;/p&gt;

&lt;p&gt;Layer 3 Security Mechanisms&lt;/p&gt;

&lt;p&gt;Ingress / Egress Filtering&lt;/p&gt;

&lt;p&gt;Drops packets with invalid source IP ranges&lt;/p&gt;

&lt;p&gt;Unicast Reverse Path Forwarding (uRPF)&lt;/p&gt;

&lt;p&gt;Checks if packet arrived on correct interface&lt;/p&gt;

&lt;p&gt;Drops spoofed packets&lt;/p&gt;

&lt;p&gt;IPSec&lt;/p&gt;

&lt;p&gt;Adds authentication and encryption&lt;/p&gt;

&lt;p&gt;Verifies sender identity cryptographically&lt;/p&gt;

&lt;p&gt;TTL Monitoring&lt;/p&gt;

&lt;p&gt;Detects abnormal hop distance&lt;/p&gt;

&lt;p&gt;Firewall Rules&lt;/p&gt;

&lt;p&gt;Blocks private IP from public side&lt;/p&gt;

&lt;p&gt;Blocks internal IP from external interface&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 4 — Transport Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Transport Layer provides communication between applications.&lt;br&gt;
The transport layer (Layer 4 in OSI) enables end-to-end communication between devices, ensuring data is delivered reliably, in order, and without errors. It manages data segmentation, flow control, and error correction, taking data from the session layer and passing it to the network layer via protocols like TCP and UDP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Responsibilities &amp;amp; Functions&lt;/strong&gt;&lt;br&gt;
Segmentation and Reassembly: Breaks large data packets from the session layer into smaller chunks called segments at the source, and reassembles them at the destination.&lt;br&gt;
Service-Point Addressing (Ports): Uses port numbers to direct data to specific applications (e.g., HTTP, FTP) on a host.&lt;br&gt;
Connection Control: Provides connection-oriented (TCP) service for reliable, guaranteed delivery, or connectionless (UDP) service for faster, best-effort delivery.&lt;br&gt;
Flow Control: Manages data transmission speed between devices to prevent a fast sender from overwhelming a slow receiver.&lt;br&gt;
Error Control: Detects errors and handles retransmissions to ensure data integrity.&lt;br&gt;
Multiplexing and Demultiplexing: Allows multiple applications to share a single network connection simultaneously.&lt;/p&gt;

&lt;p&gt;Protocols:&lt;br&gt;
TCP(Transmission Control Protocol): Connection-oriented, reliable, used for web browsing, email, and file transfers.&lt;/p&gt;

&lt;p&gt;UDP(User Datagram Protocol): Connectionless, unreliable (best-effort), used for streaming, gaming, and VoIP. &lt;/p&gt;

&lt;p&gt;Key Concept&lt;br&gt;
Port numbers identify applications/services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 5 - Session Layer&lt;/strong&gt;&lt;br&gt;
Layer 5 is the Session Layer, which manages, maintains, and terminates connections (sessions) between applications on different network devices. It enables dialogues, establishes checkpoints for recovery, and supports data exchange in simplex, half-duplex, or full-duplex modes. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Aspects of the Session Layer:&lt;/strong&gt;&lt;br&gt;
Session Management: Establishes, maintains, and terminates connections between applications.&lt;br&gt;
Dialogue Control: Acts as a controller to manage communication, allowing devices to communicate in full-duplex or half-duplex.&lt;br&gt;
Synchronization &amp;amp; Recovery: Adds checkpoints to data streams; if a failure occurs, only data after the last checkpoint needs retransmission.&lt;br&gt;
Protocols: Common protocols include NetBIOS, RPC (Remote Procedure Call), and PPTP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 6 - Presentation Layer&lt;/strong&gt;&lt;br&gt;
The Presentation Layer acts as a "translator" for the network, ensuring that data sent from the application layer of one system can be read by the application layer of another. Its primary roles include: &lt;/p&gt;

&lt;p&gt;Data Translation: Converts data between different formats (e.g., EBCDIC to ASCII) so that systems with different character encoding can communicate.&lt;br&gt;
Encryption and Decryption: Secures data by encoding it before transmission and decoding it upon receipt, often using protocols like SSL/TLS (Secure Sockets Layer/Transport Layer Security).&lt;/p&gt;

&lt;p&gt;Data Compression: Reduces the size of data to improve transmission speed and efficiency, commonly used for multimedia formats like JPEG, MPEG, and GIF. &lt;/p&gt;

&lt;p&gt;Common Protocols and Standards&lt;br&gt;
Text/Data: ASCII, EBCDIC, XML, JSON.&lt;br&gt;
Security: SSL, TLS.&lt;br&gt;
Images: JPEG, PNG, GIF, TIFF.&lt;br&gt;
Video/Audio: MPEG, AVI, MIDI. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 7 - Application Layer&lt;/strong&gt;&lt;br&gt;
Layer 7, the Application Layer of the OSI model, is the topmost layer that directly interfaces with end-user software applications (like web browsers or email clients) to initiate network communication. It interprets user intent and manages application-level protocols such as HTTP, HTTPS, SMTP, FTP, and DNS, allowing for data exchange, service authentication, and resource sharing.&lt;/p&gt;

&lt;p&gt;Key Aspects of Layer 7:&lt;br&gt;
Function: It enables communication by providing services directly to applications, allowing software to send/receive data, rather than being the application itself.&lt;br&gt;
Protocols: Common protocols include HTTP/HTTPS (web browsing), SMTP/IMAP (email), FTP (file transfer), and DNS (name resolution).&lt;br&gt;
Interaction: It acts as the intermediary between network services and software, transforming user requests into network-compatible formats.&lt;br&gt;
Security &amp;amp; Load Balancing: Layer 7 is critical for security, with Web Application Firewalls (WAFs) protecting against application-level attacks (e.g., HTTP floods). It also enables content-based load balancing, where traffic is distributed based on user requests.&lt;br&gt;
Examples: When a user clicks a link, the web browser uses HTTP/HTTPS (Layer 7) to request the page&lt;/p&gt;

</description>
      <category>networking</category>
      <category>tcpip</category>
      <category>osi</category>
    </item>
    <item>
      <title>Splunk Basics</title>
      <dc:creator>Manoj Kumar Vemula</dc:creator>
      <pubDate>Tue, 16 Dec 2025 11:35:12 +0000</pubDate>
      <link>https://forem.com/manoj_kumarvemula_31e045/splunk-basics-5fp2</link>
      <guid>https://forem.com/manoj_kumarvemula_31e045/splunk-basics-5fp2</guid>
      <description>&lt;p&gt;&lt;strong&gt;Splunk Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftk229rkvo0xyqukup2y9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftk229rkvo0xyqukup2y9.png" alt=" " width="800" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In splunk logs are Collected, Processed, Stored, Searched &amp;amp; Analyzed through 3 main components :&lt;/p&gt;

&lt;p&gt;Data Source → Forwarder → Indexer → Search Head → User&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I] Data Input Stage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1}Splunk Forwarder (Data Collection Stage) :&lt;br&gt;
It is a lightweight agent installed on machines where logs are generated.&lt;br&gt;
Examples of machines :&lt;br&gt;
Linux servers, Windows servers, Web servers, Firewalls, Routers, Databases, Applications.&lt;/p&gt;

&lt;p&gt;Its job is to collect logs and send them to splunk Indexer.&lt;br&gt;
We need forwarders because :&lt;br&gt;
Imagine :&lt;br&gt;
5,000 servers generating logs, we cannot manually copy logs from each server. So Splunk Forwarder does this job.&lt;br&gt;
Advantages :&lt;br&gt;
Very Low CPU usage.&lt;br&gt;
Runs in background.&lt;br&gt;
Can scale up to tens of thousands of machines.&lt;br&gt;
Secure(SSl/TLS) real time log forwarding.&lt;/p&gt;

&lt;p&gt;Types of Splunk Forwarders :&lt;br&gt;
Universal Forwarder : In short, its non-intelligent and only forwards logs no other job&lt;br&gt;
Heavy Forwarder : It filters logs based on our requirement.&lt;/p&gt;

&lt;p&gt;At this point data is not event, data is just raw.&lt;br&gt;
EX : JULY date sever2 sshd[1234]: Failed Password for root from &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Points&lt;/strong&gt;&lt;br&gt;
-&amp;gt;Splunk doesn't process the entire file at once, It cuts incoming data into 64 kilobyte chunks. These are data blocks.&lt;br&gt;
-&amp;gt;Splunk adds labels[metadata] to each 64k block.&lt;br&gt;
Metadata : Information about the data, like :&lt;br&gt;
host&lt;br&gt;
source&lt;br&gt;
source type&lt;/p&gt;

&lt;p&gt;After the data/logs reached to splunk they must be stored right!!. They store in indexes.&lt;br&gt;
2}Indexes : It's crucial, as it decides which index data goes into. There are different indexes by your choice and also default indexes.&lt;br&gt;
Example :&lt;br&gt;
index = security, index = firewall, index = authentication.&lt;/p&gt;

&lt;p&gt;End of Data Input Stage :&lt;br&gt;
Data is still raw.&lt;br&gt;
Data is tagged with meta data.&lt;br&gt;
Data is not searchable yet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;II] Data storage Stage&lt;/strong&gt;(RAW data becomes usefull)&lt;/p&gt;

&lt;p&gt;This stage has 2 phases&lt;br&gt;
i)Parsing&lt;br&gt;
ii)Indexing&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Parsing :&lt;/strong&gt;&lt;br&gt;
Parsing can be done in automated and manual, if the logs are in non-standard forward manual parsing through regex is recommended. For standard format of logs splunk automates parsing phase.&lt;/p&gt;

&lt;p&gt;Raw Text --&amp;gt; Individual Searchable Events.&lt;/p&gt;

&lt;p&gt;Sub-Phases of Parsing :&lt;br&gt;
--&amp;gt;Breaking the stream into individual lines where one event ends &amp;amp; where next event begins.&lt;br&gt;
--&amp;gt;Identifying, Parsing, Setting Timestamps.&lt;br&gt;
--&amp;gt;Annotating individual events with meta data.(Splunk copies meta data generated from i/p stage)&lt;br&gt;
--&amp;gt;Transforming event data using regex. This uses&lt;br&gt;
props.config, transforms.config.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Indexing Process&lt;/strong&gt;&lt;br&gt;
Splunk decides which parts are timestamp, message. what fields exists...&lt;br&gt;
This process also known as Event Processing.&lt;br&gt;
Indexing = Event Processing&lt;br&gt;
Splunk does the following:&lt;br&gt;
Step 1: Event Breaking&lt;br&gt;
Splits continuous data stream into individual events&lt;br&gt;
Example:&lt;br&gt;
One log file → 1,000 separate events&lt;br&gt;
Step 2: Timestamp Identification&lt;br&gt;
Finds time for each event&lt;br&gt;
Uses:&lt;br&gt;
Event timestamp&lt;br&gt;
Or system time&lt;br&gt;
This allows:&lt;br&gt;
Time-based searches&lt;br&gt;
Timeline analysis&lt;br&gt;
Step 3: Field Extraction&lt;br&gt;
Splunk extracts default fields like:&lt;br&gt;
host&lt;br&gt;
source&lt;br&gt;
sourcetype&lt;br&gt;
Example:&lt;br&gt;
host=webserver1&lt;br&gt;
source=/var/log/auth.log&lt;br&gt;
sourcetype=linux_secure&lt;/p&gt;

&lt;p&gt;Step 4: User-Defined Processing&lt;br&gt;
At index time, Splunk can:&lt;br&gt;
Mask sensitive data (passwords, credit cards)&lt;br&gt;
Create custom fields&lt;br&gt;
Drop unwanted events&lt;br&gt;
Route logs to specific indexes&lt;br&gt;
Apply multi-line rules&lt;/p&gt;

&lt;p&gt;Step 5: Store Data in Indexes&lt;br&gt;
Indexer stores data in Buckets&lt;br&gt;
Each bucket contains:&lt;br&gt;
Raw data (compressed)&lt;br&gt;
Index files (tsidx)&lt;br&gt;
Metadata&lt;/p&gt;

&lt;p&gt;WHAT ARE BUCKETS IN SPLUNK?&lt;br&gt;
Splunk does NOT store all data in one folder.&lt;br&gt;
Instead, it stores data in multiple folders called BUCKETS.&lt;/p&gt;

&lt;p&gt;What is a Bucket : A bucket is a directory on disk contains :&lt;br&gt;
1}Raw log data&lt;br&gt;
2}Index files&lt;br&gt;
3}Metadata&lt;/p&gt;

&lt;p&gt;1}Hot Bucket :&lt;br&gt;
Contains newly arriving data&lt;br&gt;
Currently being written&lt;br&gt;
Always open&lt;/p&gt;

&lt;p&gt;2}Warm Bucket &lt;br&gt;
A Hot bucket becomes warm when &lt;br&gt;
Size limit is reached OR&lt;br&gt;
Time limit is reached OR&lt;br&gt;
Splunk is restarted&lt;/p&gt;

&lt;p&gt;Contains recent but stable data&lt;br&gt;
No longer writable&lt;br&gt;
Still searched very often&lt;/p&gt;

&lt;p&gt;3]Cold Bucket&lt;br&gt;
When does data move to Cold?&lt;br&gt;
When:&lt;br&gt;
Warm bucket count exceeds configured limit&lt;/p&gt;

&lt;p&gt;What is a COLD bucket?&lt;br&gt;
Contains older data&lt;br&gt;
Rarely searched&lt;br&gt;
Stored on slower &amp;amp; cheaper storage&lt;br&gt;
Think:&lt;br&gt;
Cold = old logs, used occasionally&lt;/p&gt;

&lt;p&gt;4}Frozen Bucket&lt;br&gt;
What is Frozen bucket :&lt;br&gt;
Data is removed from Splunk indexes&lt;br&gt;
IMPORTANT:&lt;br&gt;
Frozen data is NOT searchable&lt;br&gt;
It may be:&lt;br&gt;
Deleted permanently &lt;br&gt;
Archived to external storage &lt;br&gt;
Why Frozen exists?&lt;br&gt;
Because:&lt;br&gt;
Storage is expensive&lt;br&gt;
Compliance rules define retention&lt;br&gt;
Old logs are useless after some time&lt;br&gt;
Think:&lt;br&gt;
Frozen = dead / archived data&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3}Data Searching Stage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The data searching stage is the phase where users query, analyze and visualize indexed data to extract insights.&lt;br&gt;
This stage happens after data is already indexed.&lt;/p&gt;

&lt;p&gt;During the data searching stage, Splunk :&lt;br&gt;
-&amp;gt;Searches events stored in indexes.&lt;br&gt;
-&amp;gt;Filters relevant data.&lt;br&gt;
-&amp;gt;Transform and analyze data&lt;br&gt;
-&amp;gt;Visualize results&lt;/p&gt;

&lt;p&gt;SPL : SPL (Search Processing Language): It is the core engine of Splunk, used to search, filter, analyze, and visualize indexed data, and it primarily runs on the Search Head.&lt;br&gt;
In the next blog I'll be discussing about top 25 commands in SPL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quick Summary Table&lt;/strong&gt;&lt;br&gt;
| Component          | Role                     |&lt;br&gt;
| ------------------ | ------------------------ |&lt;br&gt;
| Forwarder          | Collects &amp;amp; sends data    |&lt;br&gt;
| Indexer            | Stores &amp;amp; indexes data    |&lt;br&gt;
| Index              | Logical storage location |&lt;br&gt;
| Search Head        | Search &amp;amp; visualization   |&lt;br&gt;
| Deployment Server  | Manage forwarders        |&lt;br&gt;
| License Master     | License tracking         |&lt;br&gt;
| Cluster Manager    | Indexer clustering       |&lt;br&gt;
| Monitoring Console | Health monitoring        |&lt;/p&gt;

</description>
      <category>splunk</category>
      <category>soc</category>
      <category>security</category>
      <category>siem</category>
    </item>
    <item>
      <title>How To Read Logs From Windows using python</title>
      <dc:creator>Manoj Kumar Vemula</dc:creator>
      <pubDate>Fri, 12 Dec 2025 10:12:32 +0000</pubDate>
      <link>https://forem.com/manoj_kumarvemula_31e045/how-to-read-logs-from-windows-using-python-188b</link>
      <guid>https://forem.com/manoj_kumarvemula_31e045/how-to-read-logs-from-windows-using-python-188b</guid>
      <description>&lt;p&gt;Hello there!&lt;br&gt;
In this blog post, I am sharing one of the steps from my SOAR project.&lt;br&gt;
By completing this guide, you will be able to retrieve Windows logs using Python.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1}Understanding Windows Logs&lt;/strong&gt;&lt;br&gt;
Before retrieving logs using Python, you must understand where Windows stores logs and how they are structured.&lt;/p&gt;

&lt;p&gt;Open Event Viewer → expand Windows Logs.&lt;br&gt;
You will see:&lt;br&gt;
Application&lt;br&gt;
Security&lt;br&gt;
Setup&lt;br&gt;
System&lt;br&gt;
Forwarded Events&lt;br&gt;
Each category contains events stored in a structured format.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2}Windows Event Structure&lt;/strong&gt;&lt;br&gt;
Windows event has 5 parts.&lt;br&gt;
Log Name  : Application, Security, System, Setup.&lt;br&gt;
Level     : The level of security e.g, Info, warning, Critical, Verbose.&lt;br&gt;
Data and Time : When event has occurred.&lt;br&gt;
Source    : The program, service or component that generated the event.&lt;br&gt;
Event ID  : A unique Identification of number.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Event Log Structure:&lt;/strong&gt;&lt;br&gt;
Every Windows event has 5 important parts.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Event ID :
You already saw this (e.g., 4624 = logon).&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Level :&lt;br&gt;
This tells how serious the event is:&lt;br&gt;
Information&lt;br&gt;
Warning&lt;br&gt;
Error&lt;br&gt;
Critical&lt;br&gt;
Audit Success&lt;br&gt;
Audit Failure&lt;br&gt;
4624 = Audit Success&lt;br&gt;
4625 = Audit Failure&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Time Created&lt;br&gt;
The exact timestamp when the event happened.&lt;br&gt;
This tells you when the action occurred.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Provider (Source)&lt;br&gt;
This tells you who created the event.&lt;br&gt;
Examples:&lt;br&gt;
Microsoft-Windows-Security-Auditing&lt;br&gt;
Service Control Manager&lt;br&gt;
Application Error&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Event Details (Description / XML)&lt;br&gt;
Scroll down to the bottom and you will see a section called “Details”.&lt;br&gt;
Click Details → Select XML view.&lt;br&gt;
This XML view is exactly what Python reads using libraries like pywin32 or win32evtlog.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;2}Python Libraries for Windows Logs&lt;/strong&gt;&lt;br&gt;
There are three major options&lt;br&gt;
--&amp;gt;Option 1: pywin32&lt;br&gt;
Allows Python access to Windows APIs.&lt;br&gt;
Offers win32evtlog and win32evtlogutil.&lt;br&gt;
Learn:&lt;br&gt;
Installing: pip install pywin32&lt;br&gt;
Reading event logs using win32evtlog.OpenEventLog&lt;br&gt;
Parsing event records&lt;/p&gt;

&lt;p&gt;--&amp;gt;Option 2: win32com / WMI&lt;br&gt;
Use WMI to query logs.&lt;br&gt;
Learn:&lt;br&gt;
Installing: pip install wmi&lt;br&gt;
Basic WMI queries (e.g., SELECT * FROM Win32_NTLogEvent)&lt;/p&gt;

&lt;p&gt;--&amp;gt;Option 3: subprocess + PowerShell&lt;br&gt;
Run PowerShell command Get-WinEvent or Get-EventLog from Python and parse output.&lt;br&gt;
Learn:&lt;br&gt;
Using subprocess.run&lt;br&gt;
Reading command output (stdout)&lt;/p&gt;

&lt;p&gt;I choose option 3, here i use python(subprocess) and power shell.&lt;br&gt;
Let's start with power shell basics, Basic level of power shell learning is necessary for this.&lt;br&gt;
PowerShell : It is a cross-platform command-line shell and object-oriented scripting language used for system administration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3} Power Shell Basics&lt;/strong&gt; &lt;br&gt;
--&amp;gt;Core Log Reading Commands&lt;br&gt;
1}Get-WinEvent &lt;br&gt;
2}Get-EventLog&lt;br&gt;
3}wevtutil qe&lt;br&gt;
4}Get-Wmiobject win32_NTLogEvent&lt;br&gt;
5}Get-CimInstance Win32_NTLogEvent&lt;/p&gt;

&lt;p&gt;--&amp;gt;Core Log Filtering Commands&lt;br&gt;
1}Where-Object&lt;br&gt;
2}Select-Object&lt;br&gt;
3}Sort-Object&lt;br&gt;
4}Group-Object&lt;br&gt;
5}Measure-Object&lt;br&gt;
6}Select-String&lt;/p&gt;

&lt;p&gt;--&amp;gt;Log Exporting Commands&lt;br&gt;
1}Out-File&lt;br&gt;
2}Export-Csv&lt;br&gt;
3}ConvertTo-Json&lt;br&gt;
4}wevtutil epl&lt;br&gt;
5}Out-GridView&lt;/p&gt;

&lt;p&gt;--&amp;gt;Log Management Command&lt;br&gt;
1}wevtutil cl&lt;br&gt;
2}wevtutil gl&lt;br&gt;
3}New-EventLog&lt;br&gt;
4}Write-EventLog&lt;br&gt;
5}Remove-EventLog&lt;/p&gt;

&lt;p&gt;--&amp;gt;Log File / Folder Commands&lt;br&gt;
1}Get-ChildItem&lt;br&gt;
2}Set-Location&lt;br&gt;
3}New-Item&lt;br&gt;
4}Test-Path&lt;br&gt;
5}Get-Content&lt;br&gt;
6}Get-Content-Wait&lt;br&gt;
7}Get-Content-Tail&lt;/p&gt;

&lt;p&gt;--&amp;gt;System/Metadata Commands&lt;br&gt;
1}Get-EventSubscriber&lt;br&gt;
2}Get-Service&lt;br&gt;
3}Get-Process&lt;br&gt;
4}Get-WinEvent -ListLog *&lt;br&gt;
5}Get-WinEvent -ListProvider *&lt;/p&gt;

&lt;p&gt;--&amp;gt;PowerShell "Thinking Tools"&lt;br&gt;
1}Get-Help &lt;br&gt;
2}Get-Help  -Examples&lt;br&gt;
3}Get-Command&lt;br&gt;
4}Get-Member&lt;br&gt;
5}Get-Alias&lt;/p&gt;

&lt;p&gt;Each commands accepts only certain parameter. view them by&lt;br&gt;
Get-Help &lt;br&gt;
Example :&lt;/p&gt;

&lt;h1&gt;
  
  
  Get help for Get-EventLog
&lt;/h1&gt;

&lt;p&gt;-&amp;gt;Get-Help Get-EventLog&lt;/p&gt;

&lt;p&gt;I recommend learn it online and complete some tasks to get familiar with it like ask AI tools to assign some tasks for power shell commands and complete them.&lt;/p&gt;

&lt;p&gt;But Not all commands will work for normal user in power shell you need to run it at Administrative level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4}How Windows Admin Rights Actually Work&lt;/strong&gt;&lt;br&gt;
Windows does not allow any program to just become admin out of no where.&lt;br&gt;
Instead :&lt;br&gt;
Every program is launched with a security token.&lt;br&gt;
That token is either:&lt;br&gt;
-- A standard User.&lt;br&gt;
-- Administrator.&lt;br&gt;
If your script starts as a normal user, the only way to become Admin is:&lt;br&gt;
Show a UAC popup.&lt;br&gt;
Or run the script inside a session that is already elevated.&lt;br&gt;
Or use a scheduled task that runs elevated.&lt;/p&gt;

&lt;p&gt;Understanding the Admin Check Code:&lt;br&gt;
ctypes : A python module that lets python call windows system DLLs&lt;br&gt;
ctypes.windll.shell32 means:&lt;br&gt;
Access the Windows system DLL shell32.dll&lt;/p&gt;

&lt;p&gt;Code :&lt;/p&gt;

&lt;p&gt;import ctypes &lt;br&gt;
import sys &lt;br&gt;
def is_admin(): &lt;br&gt;
      try: &lt;br&gt;
         return ctypes.windll.shell32.IsUserAnAdmin()&lt;br&gt;&lt;br&gt;
      except: &lt;br&gt;
         return False &lt;br&gt;
if not is_admin(): &lt;br&gt;
       ctypes.windll.shell32.ShellExecuteW( None, "runas",  sys.executable, " ".join(sys.argv),None, 1) &lt;/p&gt;

&lt;p&gt;print("Running as admin!")&lt;/p&gt;

&lt;p&gt;--&amp;gt;ctypes.windll.shell32.IsUserAnAdmin() &lt;br&gt;
This line check whether user or admin&lt;/p&gt;

&lt;p&gt;How Python Elevates Itself :&lt;br&gt;
If Python is not already admin,&lt;br&gt;
if not is_admin():&lt;br&gt;
       ctypes.windll.shell32.ShellExecuteW(&lt;br&gt;
                None, "runas", sys.executable, " ".join(sys.argv),None, 1)&lt;br&gt;
       sys.exit()&lt;/p&gt;

&lt;p&gt;ShellExecuteW : A windows API function that can launch a new program.&lt;br&gt;
The above mentioned parameters :&lt;br&gt;
None               --&amp;gt; No parent Window&lt;br&gt;
runas              --&amp;gt; Tells windows "Run As Administrator"&lt;br&gt;
sys.executable     --&amp;gt;Path to python.exe&lt;/p&gt;

&lt;p&gt;" ".join(sys.argv) --&amp;gt;Arguments of your script and Because ShellExecuteW CANNOT accept a list.&lt;/p&gt;

&lt;p&gt;sys.argv is a list.&lt;br&gt;
So you cannot pass it directly.&lt;br&gt;
Example:&lt;br&gt;
['retrivelogs.py']&lt;/p&gt;

&lt;p&gt;ShellExecuteW does not understand lists.&lt;br&gt;
It only understands strings like:&lt;br&gt;
"retrivelogs.py"&lt;br&gt;
So we convert:&lt;br&gt;
sys.argv   →   " ".join(sys.argv)&lt;/p&gt;

&lt;p&gt;That is the ONLY reason.&lt;/p&gt;

&lt;p&gt;We used " ".join(sys.argv)&lt;br&gt;
 because Windows API requires ONE STRING&lt;br&gt;
 not a Python list.&lt;/p&gt;

&lt;p&gt;" ".join(sys.argv) = "retrivelogs.py"&lt;/p&gt;

&lt;p&gt;None               --&amp;gt;Working directory&lt;br&gt;
1                  --&amp;gt;Shows the windows&lt;/p&gt;

&lt;p&gt;Now you can  guess what are we trying to do, &lt;br&gt;
We are just executing power shell commands but in python code. &lt;/p&gt;

&lt;p&gt;Subprocess module makes our work even easier.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5}Subprocess Module&lt;/strong&gt; &lt;br&gt;
The subprocess module lets you run external commands, spawn new processes, interact with their input/output and retrieve results.&lt;/p&gt;

&lt;p&gt;Python offers four main ways to run subprocesses but here we discuss main two:&lt;br&gt;
1}subprocess.run() : Recommended High-Level Function.&lt;br&gt;
This is the best way to run a command and collect the result.&lt;/p&gt;

&lt;p&gt;Signature :&lt;br&gt;
subprocess.run(args, *, &lt;br&gt;
              stdin=None, &lt;br&gt;
              input=None, &lt;br&gt;
              stdout=None, &lt;br&gt;
              stderr=None,&lt;br&gt;
              capture_output=False, &lt;br&gt;
              shell=False, cwd=None, &lt;br&gt;
              timeout=None, &lt;br&gt;
              check=False,&lt;br&gt;
              text=False, encoding=None, errors=None)&lt;/p&gt;

&lt;p&gt;Example :&lt;br&gt;
import subprocess &lt;br&gt;
res = subprocess.run(["ls","-l"],&lt;br&gt;
      capture_output = True,&lt;br&gt;
      text = True,&lt;br&gt;
      check =True #raise error if command fails)&lt;/p&gt;

&lt;p&gt;2}subprocess.Popen() :&lt;br&gt;
This is the advanced, fully configurable way.&lt;br&gt;
Signature :&lt;br&gt;
subprocess.Popen(args, &lt;br&gt;
                 bufsize=0, &lt;br&gt;
                 executable=None, &lt;br&gt;
                 stdin=None, &lt;br&gt;
                 stdout=None, stderr=None,&lt;br&gt;
                 preexec_fn=None, &lt;br&gt;
                 close_fds=True, shell=False, &lt;br&gt;
                 cwd=None, env=None,&lt;br&gt;
                 universal_newlines=False, text=None,&lt;br&gt;&lt;br&gt;
                 startupinfo=None, creationflags=0,&lt;br&gt;
                 pipesize=-1)&lt;/p&gt;

&lt;p&gt;Example :&lt;br&gt;
from subprocess import Popen, PIPE&lt;/p&gt;

&lt;p&gt;p = Popen(["grep", "hello"], &lt;br&gt;
          stdin=PIPE, &lt;br&gt;
          stdout=PIPE, &lt;br&gt;
          text=True)&lt;br&gt;
out = p.communicate("hello world")[0]&lt;br&gt;
print(out)&lt;/p&gt;

&lt;p&gt;2}Important Classes&lt;br&gt;
Returned by run()&lt;br&gt;
Attributes:&lt;br&gt;
args&lt;br&gt;
returncode&lt;br&gt;
stdout&lt;br&gt;
stderr&lt;/p&gt;

&lt;p&gt;Returned by Popen()&lt;br&gt;
Methods:&lt;br&gt;
poll() — check if process ended&lt;br&gt;
wait() — wait until finished&lt;br&gt;
communicate() — send input &amp;amp; read output&lt;br&gt;
terminate() — graceful stop (SIGTERM)&lt;br&gt;
kill() — force kill (SIGKILL)&lt;/p&gt;

&lt;p&gt;NOTE : Popen can stream real time output but run can't.&lt;br&gt;
1) Stream real-time output&lt;br&gt;
from subprocess import Popen, PIPE&lt;br&gt;
p = Popen(["ping", "google.com"], stdout=PIPE, text=True)&lt;br&gt;
for line in p.stdout:&lt;br&gt;
    print("LIVE:", line, end="")&lt;/p&gt;

&lt;p&gt;run() cannot do this — it waits until the command finishes.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Python Code *&lt;/em&gt;:&lt;br&gt;
import subprocess&lt;br&gt;
import json&lt;br&gt;
import ctypes &lt;br&gt;
import sys&lt;/p&gt;

&lt;p&gt;def is_admin():&lt;br&gt;
       try:&lt;br&gt;
            return ctypes.windll.shell32.IsUserAnAdmin()&lt;br&gt;
       except:&lt;br&gt;
            return False&lt;/p&gt;

&lt;p&gt;if not is_admin():&lt;br&gt;
       ctypes.windll.shell32.ShellExecuteW(&lt;br&gt;
                None, "runas", sys.executable, " ".join(sys.argv),None, 1)&lt;br&gt;
print("Running as admin!")&lt;/p&gt;

&lt;p&gt;command = [&lt;br&gt;
    "powershell",&lt;br&gt;
    "-Command",#you can change the commands here&lt;br&gt;
    "Get-WinEvent -LogName System -MaxEvents 5 | "&lt;br&gt;
    "Select-Object Id, @{Name='TimeCreated';Expression={$_.TimeCreated.ToString('yyyy-MM-dd HH:mm:ss')}} | "&lt;br&gt;
    "ConvertTo-Json -Depth 4"&lt;br&gt;
]&lt;/p&gt;

&lt;p&gt;result = subprocess.run(command, capture_output=True, text=True)&lt;/p&gt;

&lt;p&gt;output = result.stdout&lt;/p&gt;

&lt;p&gt;try:&lt;br&gt;
    events = json.loads(output)&lt;br&gt;
except json.JSONDecodeError:&lt;br&gt;
    print("Error parsing JSON. Raw output:")&lt;br&gt;
    print(output)&lt;br&gt;
    exit()&lt;/p&gt;

&lt;p&gt;//Ensure output is always a list&lt;br&gt;
if isinstance(events, dict):&lt;br&gt;
    events = [events]&lt;/p&gt;

&lt;p&gt;for event in events:&lt;br&gt;
    print(f"ID: {event['Id']}   Time: {event['TimeCreated']}")&lt;/p&gt;

</description>
      <category>python</category>
      <category>windowslogs</category>
      <category>subprocess</category>
      <category>powershellcheatsheet</category>
    </item>
  </channel>
</rss>
