<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Emir Ozturk on Medium]]></title>
        <description><![CDATA[Stories by Emir Ozturk on Medium]]></description>
        <link>https://medium.com/@0xEmirOzturk?source=rss-6ab1b918e856------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3D_oznkOBMoKSeLzVjJKig.jpeg</url>
            <title>Stories by Emir Ozturk on Medium</title>
            <link>https://medium.com/@0xEmirOzturk?source=rss-6ab1b918e856------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 16:22:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@0xEmirOzturk/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Hosting Node-RED in GNS3 VM and Accessing It from Your Local Machine]]></title>
            <link>https://medium.com/@0xEmirOzturk/hosting-node-red-in-gns3-vm-and-accessing-it-from-your-local-machine-62f6dcd41235?source=rss-6ab1b918e856------2</link>
            <guid isPermaLink="false">https://medium.com/p/62f6dcd41235</guid>
            <category><![CDATA[vmware]]></category>
            <category><![CDATA[gns3-vm]]></category>
            <category><![CDATA[node-red]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[gns3]]></category>
            <dc:creator><![CDATA[Emir Ozturk]]></dc:creator>
            <pubDate>Fri, 06 Dec 2024 13:45:05 GMT</pubDate>
            <atom:updated>2024-12-06T18:17:54.815Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I will explain how to host Node-RED as a docker container in the GNS3 VM and how to access it from your local machine. By the end of this article, you’ll be able to use a web browser on your local computer to interact with Node-RED running in the GNS3 VM. Additionally, you’ll learn how to access Node-RED through your GNS3 topologies for integrated testing and workflows.</p><p>To start with, this is my GNS3 VM’s configuration of network adapters. It has 2 network adapters in total. One of them is “Host-only” and other one is “NAT”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*fRKB5u49oG0PiIlMvoahJQ.png" /></figure><p>Check your virtual machine’s ip address and on which subnet it is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*8yyARBWERkl__WP15dbA3Q.png" /></figure><p>Go to edit &gt; Preferences &gt; Server</p><p>Configure your server settings on your GNS3 client to be in the same network as your GNS3 VM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*zpIre-3UPAL9iLdlPA9VtQ.png" /></figure><p>Go to edit &gt; Preferences &gt; Docker &gt; Docker containers</p><p>Click the “New” button to create a new docker container template</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*OyQLX_-o7jf-MWUWkamnGw.png" /></figure><p>Choose the option “Run this Docker container on the GNS3 VM” and go next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*xrGiVx1_AgozCN9ZWSvDTQ.png" /></figure><p>Choose the option “New image” and type “nodered/node-red” as your image name. Then go next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*IqJUbgi06c3MymhVF6PEqQ.png" /></figure><p>Give your template a name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*B74x1MdLWZdtVRsOm07nOw.png" /></figure><p>You can configure multiple network adapters on your container. But for this appliance we only need 1 network adapter. Go next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*jbSX5kcXLNM7TLbzpzL5Yg.png" /></figure><p>You can leave this section blank and go next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*LU6h43dZPKQlDYQKVSNMMQ.png" /></figure><p>On this section, you can either choose telnet or VNC as your console type. But both of them are little bit problematic with nodered container on GNS3. Which kind of console type you choose doesn’t really matter because we will be accessing our container’s CLI via something called “auxiliary console” from the GNS3 client. Go next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*hAc_zi8eVOXe0s2dWXLGug.png" /></figure><p>You can leave this section blank. Finish the configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*ddVnWw8cUS9cPVNSVe7qjQ.png" /></figure><p>Click “Apply” and then “Ok”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*gFiN_2vFQT8QIzXHwjIVmw.png" /></figure><p>You should be able to see your new template among your “end devices” section in GNS3 client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*dapxaaPvR0Rkjc8i3I15vQ.png" /></figure><p>Drag and drop your new template into your topology. At this point GNS3 client should start downloading the docker image from Docker Hub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*awEHK7wMnKjKsA58tXu87A.png" /></figure><p>Inside your GNS3 VM, check your docker images with using the command “docker images”. You should be able to see your nodered image called “nodered/node-red”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*F1BkGmqgvQjSDM8YeFIFGw.png" /></figure><p>If you can’t see your nodered image when you type the command “docker images”, you can manually download it from Docker Hub with using the command “docker pull nodered/node-red”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*B26dVawnR6Pn36hNP-Vyrw.png" /></figure><p>I want to talk about an issue that I experienced in this part. I tried to drag and drop my template into topology to download the image but after sometime, GNS3 client didn’t continue downloading the image and it was stuck at the half of the process. So I tried to download the image manually by this method and I had the same issue with it. But later on when I rebooted my pc all of a sudden everything started working. So bear in mind that if you have some issues it’s nice to shut down your GNS3 client and your GNS3 VM and if it still doesn’t work, you can try rebooting your pc.</p><p>Finally, you can check your running containers by typing the command “docker ps”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*b20QfoMBB4zlIYE2g2KKhQ.png" /></figure><p>So, this will be our first topology to test the things that we did so far.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*-F3FHHvx1wZ62U7xNe_Kng.png" /></figure><p>Right-click on your nodered node and click on “Edit config”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*811aUKuFj6FMFxQaL0fCfQ.png" /></figure><p>Delete the “#” signs on the lines “auto eth0” and “iface eth0 inet dhcp” and save the configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*-KaWZt3FVI0JOfRB961jnA.png" /></figure><p>First, start your nodered node and then click on “Auxiliary console” to open the CLI of the node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*ePs0HARjDQ9498gTUgPMJQ.png" /></figure><p>Type “ifconfig” on the console and check if you got an IP address from the DHCP server. If you can’t see an IP address, just wait a little bit. Sometimes it takes some time to get the IP address from the DHCP server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*Kx8jTwmeouM8VrVW92IxFg.png" /></figure><p>Right-click on your webterm node and open a “console”. This should pop-up a VNC window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*LSnp4Il2YVUwRr69jnvAvw.png" /></figure><p>Type the IP address of your node on the URL bar and add “:1880” at the end of the IP address to specify the default port that the nodered runs on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*0zQC2QTgiDcck3HMV5btDQ.png" /></figure><p>This is our second topology. The nodered node is connected to the Cloud1’s “eth1” interface. Last time we accessed the graphical interface of the nodered from a browser that runs on the GNS3. But this time we will use this topology to access our nodered node’s graphical interface from the browser that runs on our computer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*Gedn5Onx7xQWa_PRYd-0wA.png" /></figure><p>You also need to edit the configuration of your new nodered node to enable it to get IP address from the DHCP server. Right-click on the node and then click on the “Edit config”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*8zG4WiP_HwiaDpdwo5S-_A.png" /></figure><p>Delete the “#” signs on the lines “auto eth0” and “iface eth0 inet dhcp” and save the configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*-KaWZt3FVI0JOfRB961jnA.png" /></figure><p>Start your nodered node and then click on “Auxiliary console” to open the CLI of the node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*vvH7rU37sZW04IMCqyjhEw.png" /></figure><p>Type “ifconfig” on the console to check the IP address of the node. If you can’t see the IP address wait a little bit longer for the node to get it’s IP address from the DHCP server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*35xikSef-7iiy9FjoMH6RA.png" /></figure><p>After you see the IP address of the node, open up a new tab on your browser and enter the IP address of the node on URL bar and add “:1880” at the end of the IP address to specify the default port of the nodered. You should be able to access the nodered’s graphical interface from outside of the GNS3 and by using your browser that runs on your computer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*a5L0XzQRkZp-N6O1prBUmg.png" /></figure><p>Special thanks to my supervisor Adjunct Professor Pawel KRÓL for inspiring me to write this article and also for analyzing the article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62f6dcd41235" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying Subnetting: From Classful Addresses to VLSM and CIDR]]></title>
            <link>https://medium.com/@0xEmirOzturk/demystifying-subnetting-from-classful-addresses-to-vlsm-and-cidr-2f11a03e61bf?source=rss-6ab1b918e856------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f11a03e61bf</guid>
            <category><![CDATA[subnet-mask]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[subnetting]]></category>
            <category><![CDATA[ip-addressing]]></category>
            <category><![CDATA[binary]]></category>
            <dc:creator><![CDATA[Emir Ozturk]]></dc:creator>
            <pubDate>Fri, 28 Jul 2023 14:22:06 GMT</pubDate>
            <atom:updated>2024-06-06T09:37:23.160Z</atom:updated>
            <content:encoded><![CDATA[<p>In the realm of modern networking, two powerful tools, Variable Length Subnet Mask (VLSM) and Classless Inter-Domain Routing (CIDR), have emerged as essential elements for effectively managing IP addresses. These tools have successfully overcome the limitations posed by the older class-based addressing system. In the initial stages of the internet’s development, IP addresses were categorized into classes, namely A, B, C, D, and E, each serving distinct purposes.Class A, B and C were assigned for unicast traffic, class D was assigned for multicast traffic and class E was assigned for experimental purposes.</p><h3>Class A Address</h3><p>In class A addresses the first bit of the first octet is always set to 0. The first bit in the network address is dedicated to indicating the network class, leaving 7 bits for the actual network address. There are 128 possible Class A network addresses. Of the 128 possible network addresses, two are reserved for special cases: the network address 127 is reserved for local loopback addresses, and a network address of all ones indicates a broadcast address.</p><p>There are 126 possible Class A network addresses and 16,777,214 possible local host addresses.</p><pre>The first octet of a Class A address is in the range 1 to 126.<br>0000 0001 is equals to  1  in decimal<br>0111 1110 is equals to 126 in decimal<br><br>So class A address ranges from :<br>0000 0001.0000 0000.0000 0000.0000 0000 = 1.0.0.0 to<br>0111 1110.1111 1111.1111 1111.1111 1111 = 126.255.255.255<br><br>The default subnet mask of the class A ip address is 255.0.0.0<br>which is equals to <br>1111 1111.0000 0000.0000 0000.0000 0000<br><br>(we will cover what is subnet mask later on)</pre><h3>Class B Address</h3><p>In class B addresses the first and second bits of the first octet is always set to 10.The first two bits in the network address are dedicated to indicating the network class, leaving 14 bits for the actual network address. There are 16,384 possible network addresses and 65,534 local host addresses.</p><pre>The first octet of a Class B address is in the range 128 to 191.<br>1000 0000 is equals to 128<br>1011 1111 is equals to 191<br><br>So class B address ranges from :<br>1000 0000.0000 0000.0000 0000.0000 0000 = 128.0.0.0 to<br>1011 1111.1111 1111.1111 1111.1111 1111 = 191.255.255.255<br><br>The default subnet mask of the class B ip address is 255.255.0.0<br>which is equals to <br>1111 1111.1111 1111.0000 0000.0000 0000</pre><h3>Class C Address</h3><p>In class C addresses the first, second and third bits of the first octet is always set to 110.The first three bits in the network address indicate the network class, leaving 21 bits for the actual network address. Therefore, there are 2,097,152 possible network addresses and 254 possible local host addresses.</p><pre>The first octet of a Class C address is in the range 192 to 223.<br>1100 0000 is equals to 192<br>1101 1111 is equals to 223<br><br>So class C address ranges from :<br>1100 0000.0000 0000.0000 0000.0000 0000 = 192.0.0.0 to<br>1101 1111.1111 1111.1111 1111.1111 1111 = 223.255.255.255<br><br>The default subnet mask of the class C ip address is 255.255.255.0<br>which is equals to <br>1111 1111.1111 1111.1111 1111.0000 0000</pre><h3>Class D Address</h3><p>IP address belonging to class D is reserved for multi-casting. The very first four bits of the first octet of IP addresses belonging to class D is always set to 1110. The remaining bits are for the address that interested hosts recognize.Class D does not possess any subnet mask. IP addresses belonging to class D range from 224.0.0.0–239.255.255.255.</p><pre>The first octet of a Class D address is in the range 224 to 239.<br>1110 0000 is equals to 224<br>1110 1111 is equals to 239<br><br>So class D address ranges from :<br>1110 0000.0000 0000.0000 0000.0000 0000 = 224.0.0.0<br>1110 1111.1111 1111.1111 1111.1111 1111 = 239.255.255.255</pre><h3>Class E Address</h3><p>IP addresses belonging to class E are reserved for experimental and research purposes. IP addresses of class E range from 240.0.0.0–255.255.255.254. This class doesn’t have any subnet mask. The very first four bits of the first octet of class E are always set to 1111.</p><pre>The first octet of a Class D address is in the range 240 to 255.<br>1111 0000 is equals to 240<br>1111 1111 is equals to 255<br><br>So class E address ranges from :<br>1111 0000.0000 0000.0000 0000.0000 0000 = 240.0.0.0<br>1111 1111.1111 1111.1111 1111.1111 1111 = 255.255.255.255</pre><p>This class-based approach led to inefficient utilization of addresses and restricted scalability, creating significant challenges for network administrators. Class A networks, with their vast address space, were often underutilized in smaller network scenarios, leading to the wastage of approximately 16 million host IP addresses in each Class A network. Class B networks, with a more moderate address space, allowed for around 65,000 host IP addresses, often providing excessive amount of IP addresses for smaller organizations. On the other hand, Class C networks, with their relatively smaller address space, could only accommodate approximately 254 host IP addresses, making them inadequate for larger enterprises. To address these inefficiencies and optimize IP address allocation, VLSM and CIDR became indispensable.</p><h3>What is Variable Lenght Subnet Mask(VLSM)?</h3><p>Variable Length Subnet Mask (VLSM) is a technique used in modern networking to efficiently allocate IP addresses by creating subnets of varying sizes within a larger network. Unlike the traditional classful subnetting, where each class A, B, or C has a fixed subnet mask such as class A addresses having a fixed subnet mask of 255.0.0.0(/8 for CIDR),class B addresses with the fixed subnet mask of 255.255.0.0 and so on, VLSM allows administrators to assign subnet masks of different lengths, tailoring them to suit the specific needs of each subnet. This flexibility enables more precise utilization of IP address space and eliminates the wastage that often occurs with fixed subnet masks. With VLSM, larger networks can be divided into smaller subnets, accommodating the required number of hosts in each while efficiently managing IP addresses. By embracing VLSM, network administrators can optimize address allocation, enhance scalability, and design more streamlined and resource-efficient networks.</p><h3>What is Classless Inter-Domain Routing(CIDR)?</h3><p>CIDR allows for a more flexible representation of subnet masks, using a notation that simplifies the allocation of IP addresses. In CIDR, the subnet mask is expressed as a prefix length, denoted by “/X,” where “X” represents the number of bits set to 1 in the mask. This departure from the fixed subnet masks of classful IP addresses, such as /8(class A address), /16(class B address), and /24(class C address), permits finer control over IP address allocation. By employing CIDR, network administrators can create subnets with custom mask lengths, eliminating unnecessary IP address wastage and optimizing address distribution. This approach has significantly contributed to the efficient use of IP address space on the internet, making CIDR an indispensable tool in modern networking.</p><h3>Special-Purpose Addresses</h3><p>Even with the transition from classful addresses to classless addresses, certain special-purpose IP addresses have been designated by the <a href="https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml">Internet Assigned Numbers Authority (IANA)</a>, ensuring that they remain non-routable through the internet. These reserved IP address blocks serve specific functions within private networks, documentation, and internal communication. For instance, IP addresses in the range of 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 are reserved for private networks and are widely used in intranets or home networks, allowing devices within those networks to communicate with one another but not directly with the public internet. Additionally, the loopback address 127.0.0.1 and its associated block (127.0.0.0/8) are reserved for internal testing and self-communication purposes, ensuring that network devices can verify their own functionality. These special-purpose IP addresses play a crucial role in maintaining network security and conserving public IP address space, contributing to the efficient and secure functioning of the global internet infrastructure.</p><h3>Defining Network Portion and Host Portion of an IP Address</h3><pre>To define the network portion and host portion of an ip address, we need to<br>convert our ip address from decimal to the binary. After conversion, we will<br>look at our subnet mask to see how many bits does it have. Then, we will count<br>the bits in our ip address from left to right according to how many bits<br>does our subnet mask has and this will define our network and host portions.<br><br>192.168.10.18 255.255.255.0 or 192.168.10.18/24<br>11000000.10101000.00001010.00010010 = 192.168.10.18<br>11111111.11111111.11111111.00000000 = 255.255.255.0<br>According to that conversion,<br>11000000.10101000.00001010 = 192.168.10 is our network portion.<br>And the remaining part of our ip address is our host portion.So from now on,<br>I will seperate the network and host portion with (|) sign.<br>11000000.10101000.00001010|00010010<br>         (network)          (host)<br><br>172.16.35.123 255.255.240.0 or 172.16.35.123/20<br>10101100.00010000.00100011.01111011 = 172.16.35.123<br>11111111.11111111.11110000.00000000 = 255.255.240.0 <br>so our network and host portion is:<br>10101100.00010000.0010|0011.01111011<br>       (network)           (host)</pre><h3>Defining Network/Subnet Address, First Host, Last Host and Broadcast Address</h3><pre>We will use 172.16.35.123 255.255.240.0 or 172.16.35.123/20 for this section.<br><br>Network/Subnet Address:<br>To define network/subnet address we need to fill the host portion of<br>the address with binary 0&#39;s.<br><br>10101100.00010000.0010|0000.00000000 = 172.16.32.0<br><br>First host:<br>To define first host of an IP address, we need to fill the host portion of the<br>address with binary 0&#39;s except for the last bit.<br><br>10101100.00010000.0010|0000.00000001 = 172.16.32.1<br><br>Last host:<br>To define last host of an IP address, we need to fill the host portion of the<br>address with binary 1&#39;s except for the last bit which is set to binary 0.<br><br>10101100.00010000.0010|1111.11111110 = 172.16.32.254<br><br>Broadcast Address:<br>To define broadcast address of an IP address, we need to fill the host <br>portion of an address with binary 1&#39;s.<br><br>10101100.00010000.0010|1111.11111111 = 172.16.32.255</pre><h3>Subdividing Subnets and Defining Number of Networks and Number of Hosts</h3><pre>Let&#39;s say we are given an IP address of 10.1.1.0/24 and we are asked to<br>split this subnet into smaller subnets that each subnet need to support<br>14 machines.<br><br>When we are asked for the possible host count in a subnet, we need to use<br>the formula of 2^(Number of Host Bits) - 2. The &quot;minus 2&quot; accounts for the <br>network address and the broadcast address, which cannot be assigned to <br>individual hosts.<br><br>We learnt what is network portion and what is host portion previously.<br>When we are asked for the possible host count in a subnet, we need to <br>focus on host portion of the subnet in order to define how many bits<br>do we need to support X amount of hosts in a subnet.<br>Our current subnet mask is:<br><br>00001010.00000001.00000001|00000000 = 10.1.1.0<br>11111111.11111111.11111111|00000000 = 255.255.255.0<br>         (network)          (host)<br><br>So considering we are asked for a subnet that supports 14 machines,<br>if we assign 4 bits to the host portion of the subnet and calculate<br>it with using our formula of 2^4 - 2, it is equals to 14.<br>So our new subnet mask is:<br><br>00001010.00000001.00000001.0000|0000 = 10.1.1.0<br>11111111.11111111.11111111.1111|0000 = 255.255.255.224(/28)<br>         (network)             (host)</pre><pre>Let&#39;s say we are given an IP address of 10.128.192.0/18 and we are asked to<br>split this subnet into 30 subnets with as many hosts as possible.<br><br>When we are asked for the possible subnet/network count, we need to use the <br>formula of 2^(Number of Subnet Bits).<br><br>This time we need to focus on network portion of the subnet in order to define<br>how many bits do we need to add to the network portion to subdivide it into <br>smaller subnets.<br><br>Our current subnet mask is:<br>00001010.10000000.11|000000.00000000 = 10.128.192.0<br>11111111.11111111.11|000000.00000000 = 255.255.192.0<br>       (network)         (host)<br><br>Considering our formula of 2^(Number of Subnet Bits), we need to add 5 bits<br>to our network portion in order to support 30 subnets. 2^5 = 32.<br>So our new subnet mask is:<br><br>00001010.10000000.1100000|0.00000000 = 10.128.192.0<br>11111111.11111111.1111111|0.00000000 = 255.255.254.0(/23)<br>         (network)          (host)</pre><h3>Defining Next Network Address</h3><pre>Let&#39;s say we have the IP addresses of <br>172.16.35.123 255.255.240.0 or 172.16.35.123/20<br>172.16.49.124 255.255.240.0 or 172.16.49.124/20<br><br>How do we understand if these 2 ip addresses are in the same network or not?<br>There are 2 methods to understand that.<br><br>1st Method:<br>In our subnet mask(255.255.240.0) the 3rd octet is equals to 240. If we<br>subtract 240 from 256, its 16. That means starting from 0, when our 3rd octet<br>of the IP address increments by 16, the network changes. So:<br><br>1st network: 172.16.0.0/20<br>2nd network: 172.16.16.0/20<br>3rd network: 172.16.32.0/20<br>4th network: 172.16.48.0/20<br><br>2nd Method:<br>To understand 2nd method we need to understand how binary works.<br>We know that each octet of an IP address consists of 8 bits.<br><br> 1    1    1   1    1   1   1   1<br>128   64   32  16   8   4   2   1<br>128  192  224 240  248 252 254 255<br><br>So when we are given a 255.255.240.0(/20) subnet mask, we need to look at<br>the last bit of subnet mask which is in 3rd octet.The 3rd octet looks like:<br><br> 1   1   1   1  0000<br>128  64  32  16  0<br><br>Our last bit&#39;s(which is not 0) value is equals to 16.So that means starting <br>from 0, when our 3rd octet of the IP address increments by 16, the network <br>changes.<br><br>To conclude, 172.16.35.123/20 and 172.16.49.124/20 aren&#39;t in the same network<br>because the 172.16.35.123/20 is in the 3rd network of the subnet mask and<br>the 172.16.49.124/20 is in the 4th network of the subnet mask.</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f11a03e61bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dynamic ARP Inspection (DAI) and DHCP Snooping: Combined Protection Against Man-in-the-Middle…]]></title>
            <link>https://medium.com/@0xEmirOzturk/dynamic-arp-inspection-dai-and-dhcp-snooping-combined-protection-against-man-in-the-middle-bc1d08af8d2a?source=rss-6ab1b918e856------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc1d08af8d2a</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[arp-spoofing]]></category>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[arp-protocol]]></category>
            <dc:creator><![CDATA[Emir Ozturk]]></dc:creator>
            <pubDate>Tue, 27 Jun 2023 22:57:32 GMT</pubDate>
            <atom:updated>2023-11-22T11:13:22.168Z</atom:updated>
            <content:encoded><![CDATA[<h3>Dynamic ARP Inspection (DAI) and DHCP Snooping: Combined Protection Against Man-in-the-Middle Attacks</h3><blockquote><strong><em>Introduction</em></strong></blockquote><p>In computer networks, communication between devices relies on various protocols. One fundamental protocol is Address Resolution Protocol (ARP), which facilitates the mapping between IP addresses and MAC addresses. In this article, we’ll explore ARP’s purpose, its significance in network communications, and the potential risks posed by a lack of protection. We’ll then delve into the concept of Dynamic ARP Inspection (DAI) and its role in preventing man-in-the-middle attacks combined with DHCP snooping.</p><p>Address Resolution Protocol (ARP) is a protocol used in computer networks to map an IP address to its corresponding MAC address. When a device needs to send data to another device on the same network, it requires the MAC address of the destination device. ARP facilitates this process by broadcasting an ARP request to the network, using a destination MAC address of ff:ff:ff:ff:ff:ff, which ensures that the request is received by all devices on the network. The device with the corresponding IP address responds with its MAC address, allowing the requesting device to complete the communication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*izteBII8k1MUCaQDUIw-Ug.png" /><figcaption>Device with the IP address of 10.1.1.100 sends an ARP message to the network broadcasting “who has 10.1.1.254 tell 10.1.1.100”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*97xP4ANQkiy0HuxezazKAQ.png" /><figcaption>Device with the IP address of 10.1.1.254 replies back to 10.1.1.100 stating that MAC address of 50:01:00:09:00:00 has the IP address of 10.1.1.254</figcaption></figure><p>In a scenario where Dynamic ARP Inspection is not enabled, an attacker can exploit ARP to launch a man-in-the-middle attack. Let’s examine the stages of such an attack :</p><p><strong>Network Access :</strong> The attacker gains unauthorized access to the network, either physically or through other means like compromised credentials or unsecured wireless networks.</p><p><strong>ARP Cache Poisoning :</strong> Using tools like Ettercap, the attacker sends falsified ARP responses to various devices in the network, poisoning their ARP caches. The responses associate the attacker’s MAC address with the IP addresses of legitimate devices, causing traffic to be redirected to the attacker.</p><p><strong>Man-in-the-Middle Position :</strong> By manipulating ARP caches, the attacker intercepts network traffic between two legitimate devices, establishing a position to eavesdrop and potentially modify the communication.</p><p><strong>Exploiting Unencrypted Protocols :</strong> If the network relies on unencrypted protocols like Telnet or HTTP, the attacker can capture and analyze the network traffic, potentially extracting sensitive information such as credentials, sensitive data, or session information.</p><p><strong>Other Attacks :</strong> Beyond interception, the attacker can also launch additional attacks like session hijacking, DNS spoofing, or injecting malicious payloads into network traffic.</p><p>Dynamic ARP Inspection (DAI) is a security feature implemented on switches to counteract ARP-related attacks. Here’s how DAI protects against man-in-the-middle attacks :</p><p><strong>ARP Validation :</strong> DAI examines incoming ARP packets and validates them against a trusted database that contains the legitimate IP-to-MAC mappings. For example, let’s say an attacker tries to send an ARP response with a different MAC address for a specific IP address. DAI compares the received MAC address with the trusted mapping in the database and identifies the mismatch. As a result, the malicious ARP response is dropped, preventing unauthorized ARP responses from reaching the network devices. This prevents attackers from redirecting traffic to their own devices.</p><p><strong>MAC Address Verification :</strong> DAI ensures that the MAC addresses in ARP packets match the actual MAC addresses associated with the respective IP addresses. Suppose an attacker tries to send an ARP request with a forged MAC address. DAI compares the MAC address in the ARP request with the correct MAC address associated with the IP address in its trusted database. If a mismatch occurs, indicating potential tampering, the packet is considered suspicious and discarded. By blocking these suspicious packets, DAI prevents attackers from impersonating legitimate devices on the network.</p><p><strong>Trusted Ports :</strong> With DAI, administrators can designate certain ports, such as those connected to trusted DHCP servers or other critical network devices, as trusted ports. These trusted ports allow valid ARP traffic from trusted sources to pass through without inspection. By specifying trusted ports, DAI ensures that ARP packets originating from trusted sources, such as DHCP servers providing legitimate IP address assignments, are not unnecessarily blocked or dropped. This enhances network efficiency while maintaining security.</p><p><strong>Prevention of IP Address Spoofing :</strong> DAI can also prevent IP address spoofing attacks. In an IP address spoofing attack, an attacker manipulates the source IP address in network packets to deceive the target device. By validating ARP packets, DAI verifies that the source IP address matches the MAC address of the sender. If an inconsistency is detected, indicating potential IP address spoofing, DAI takes action to protect the network by dropping the suspicious packet.</p><p>To further enhance network security, DAI can be combined with DHCP Snooping. DHCP Snooping is another security feature that prevents unauthorized DHCP servers from distributing IP addresses. By using both DAI and DHCP Snooping together, network administrators can effectively protect their networks against various network attacks, including man-in-the-middle attacks.</p><p><strong>Matching MAC and IP Addresses :</strong> By validating the MAC and IP address bindings provided by DHCP Snooping, DAI ensures that the MAC address in ARP packets matches the legitimate MAC address associated with the corresponding IP address. This prevents attackers from using MAC spoofing techniques to manipulate ARP caches and launch man-in-the-middle attacks.</p><p><strong>Preventing Rogue DHCP Servers :</strong> DHCP Snooping helps identify and block unauthorized DHCP servers that may attempt to assign IP addresses to network devices. By verifying the legitimacy of DHCP offers and acknowledgments, DHCP Snooping ensures that DHCP communication originates from trusted sources, preventing rogue DHCP servers from compromising network security.</p><blockquote><strong><em>Conclusion</em></strong></blockquote><p>By combining Dynamic ARP Inspection (DAI) and DHCP Snooping, network administrators can establish a robust security framework that defends the network against various attack vectors. These include ARP spoofing, MAC spoofing, and rogue DHCP servers. DAI validates ARP packets and ensures MAC and IP address integrity, while DHCP Snooping verifies legitimate DHCP communication. Together, they provide comprehensive protection against ARP and DHCP-related threats, significantly reducing the risk of man-in-the-middle attacks and safeguarding sensitive data. Implementing DAI and DHCP Snooping enhances network security, instilling confidence in the infrastructure.</p><p>If you want further details about DHCP Snooping, feel free to read my <a href="https://medium.com/@0xEmirOzturk/how-the-dhcp-works-and-what-is-dhcp-snooping-9f4c1dab69c6"><strong>article</strong></a> dedicated to this topic.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc1d08af8d2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How the DHCP Works and What is DHCP Snooping]]></title>
            <link>https://medium.com/@0xEmirOzturk/how-the-dhcp-works-and-what-is-dhcp-snooping-9f4c1dab69c6?source=rss-6ab1b918e856------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f4c1dab69c6</guid>
            <category><![CDATA[dhcp-server]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[dhcp-snooping]]></category>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[dhcp]]></category>
            <dc:creator><![CDATA[Emir Ozturk]]></dc:creator>
            <pubDate>Tue, 20 Jun 2023 23:40:37 GMT</pubDate>
            <atom:updated>2023-06-20T23:46:16.820Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s interconnected world, managing IP addresses and network configurations can be a daunting task. That’s where DHCP (Dynamic Host Configuration Protocol) comes to the rescue. DHCP is a network protocol that automates the process of assigning IP addresses and essential configuration parameters to devices on a network. In this article, we’ll explore the characteristics of DHCP, its benefits, and the additional information it provides to streamline network setup. We’ll also delve into DHCP snooping, a feature that enhances network security on a basic level.</p><blockquote><strong>Characteristics of DHCP</strong></blockquote><p><strong>DHCP Pool</strong><br>A DHCP pool is a range of available IP addresses that the DHCP server can assign to clients. It acts as a reservoir of IP addresses from which devices on the network can draw. By defining a DHCP pool, administrators can easily manage the allocation of IP addresses.</p><p><strong>Network Mask</strong><br>The network mask, also known as the subnet mask, is a parameter that defines the network’s address range. It determines which portion of an IP address identifies the network and which portion identifies the host. DHCP allows administrators to specify the network mask for clients to ensure proper network segmentation.</p><p><strong>Lease Time</strong><br>Lease time is the duration for which an IP address is leased to a client by the DHCP server. Clients are granted temporary usage of the IP address within the lease period. After the lease expires, the client may request a lease renewal. Lease times can be adjusted based on network requirements, allowing efficient IP address utilization.</p><p><strong>Excluded IP Addresses</strong><br>DHCP servers allow administrators to exclude certain IP addresses from the DHCP pool. These addresses are typically reserved for static assignment, such as servers or network devices that require fixed IP addresses. By excluding specific addresses, administrators ensure they remain available for manual configuration. This promotes a balanced IP address allocation strategy.</p><blockquote><strong>Additional Information Provided by DHCP</strong><br>In addition to IP addresses, DHCP servers offer several other configuration parameters to clients, including:</blockquote><p><strong>Default Gateway</strong><br>The default gateway is the IP address of the router or gateway device that connects the local network to external networks. DHCP provides this essential information to clients, enabling proper routing of network traffic.</p><p><strong>DNS Server Address</strong><br>DHCP servers can supply the IP addresses of DNS servers. These servers are responsible for translating domain names into IP addresses, enabling clients to access websites and other network resources using user-friendly names.</p><p><strong>NTP Server Address</strong><br>DHCP servers can provide the IP addresses of Network Time Protocol (NTP) servers. NTP servers enable clients to synchronize their clocks, ensuring accurate timekeeping within the network.</p><p><strong>Domain Name</strong><br>DHCP servers can also supply the domain name that clients should use for their local DNS resolution. This helps clients in resolving unqualified domain names.</p><pre>To configure a DHCP server:<br><br>en<br>conf t<br>ip dhcp pool x<br>network 10.1.1.0 255.255.255.0<br>default-router 10.1.1.254<br>dns-server 10.1.1.254<br>lease 1<br>domain-name x.com<br>exit<br>ip dhcp excluded-address 10.1.1.254<br>end<br>show ip dhcp pool</pre><blockquote>Okay but how do we get all these information in the first place? It’s done via 4-way handshake. When a client requests an IP address from a DHCP server, a 4-way handshake process is initiated.</blockquote><p><strong>DHCP Discover:</strong> The client broadcasts a DHCP Discover message, indicating its need for an IP address.</p><p><strong>DHCP Offer:</strong> The DHCP server responds with a DHCP Offer, proposing an available IP address to the client.</p><p><strong>DHCP Request:</strong> The client selects the offered IP address and sends a DHCP Request to the server, confirming its choice.</p><p><strong>DHCP Acknowledgment:</strong> The DHCP server acknowledges the request with a DHCP Acknowledgment, granting the client the requested IP address and associated configuration parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*La526QNGEIiellg9k8ylUw.png" /><figcaption>Wireshark capture of a 4-way DHCP handshake</figcaption></figure><blockquote><strong>DHCP Snooping</strong></blockquote><p>Now, let’s delve into DHCP snooping, an important security feature that can safeguard our network on a basic level. In this section, we’ll explore what DHCP snooping is, why it is used, and the benefits it provides in preventing malicious activities. We’ll also discuss how to enable DHCP snooping on a specific interface, configure trusted ports, and activate rate limiting to mitigate potential Denial of Service (DoS) attacks.</p><p><strong>What is DHCP Snooping?</strong><br>DHCP snooping is a security mechanism implemented on network switches to prevent unauthorized or malicious DHCP activity. It works by inspecting DHCP messages exchanged between DHCP clients and servers and enforcing certain security policies. By validating and filtering DHCP traffic, DHCP snooping prevents various DHCP-related attacks, such as rogue DHCP servers, DHCP spoofing, and ARP poisoning.</p><p><strong>Why is DHCP Snooping Used?</strong><br>DHCP snooping serves multiple purposes in a network environment. Firstly, it ensures that only authorized DHCP servers provide IP addresses to clients, mitigating the risk of rogue DHCP servers. Secondly, it protects against DHCP spoofing attacks, where malicious entities attempt to manipulate IP address assignments. Lastly, it helps maintaining network integrity when used with combination of dynamic ARP inspection by preventing ARP poisoning, a technique used to redirect network traffic maliciously.</p><p><strong>Enabling DHCP Snooping on a Specific Interface (e.g. VLAN 1)</strong><br>To enable DHCP snooping on a specific interface, such as VLAN 1, follow these steps:</p><p>-Access the switch’s global configuration mode.<br>-Enter the interface configuration mode for the desired interface (e.g. interface VLAN 1).<br>-Enable DHCP snooping on the interface using the command: `ip dhcp snooping`.</p><p><strong>Configuring Trusted Ports for DHCP Server</strong><br>To establish a healthy and trusted DHCP connection with the server, the switch needs to identify and trust the port through which the DHCP server is connected. Follow these steps to configure a trusted port (e.g. GigabitEthernet 0/1) for DHCP server:</p><p>-Access the switch’s global configuration mode.<br>-Enter the interface configuration mode for the DHCP server’s interface (e.g. interface GigabitEthernet 0/1).<br>-Enable DHCP snooping trust on the interface using the command: `ip dhcp snooping trust`.</p><p><strong>Enabling DHCP Snooping Rate Limiting:</strong><br>Rate limiting in DHCP snooping helps prevent DoS attacks that overwhelm the switch with excessive traffic. By setting a rate limit, the switch restricts the number of DHCP messages processed per second on each interface. To enable rate limiting on a interface, use the following commands:</p><p>-Access the switch’s global configuration mode.<br>-Enter the interface configuration mode for the interface that you want to enable rate limiting.<br>-Enable DHCP snooping rate limiting using the command: `ip dhcp snooping limit rate &lt;value&gt;`.</p><p>For example, to limit the rate to 100 DHCP packets per second, use the command: `ip dhcp snooping limit rate 100`.</p><pre>To configure DHCP snooping:<br><br>en<br>conf t<br>ip dhcp snooping<br>end<br>conf t<br>ip dhcp snooping vlan 1<br>end<br>conf t<br>int gx/x<br>ip dhcp snooping trust<br>ip dhcp snooping limit rate x<br>end<br>conf t<br>no ip dhcp snooping information option<br>end<br>sh ip dhcp snooping binding</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f4c1dab69c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>