<?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>DEV Community: Salah Ud Din</title>
    <description>The latest articles on DEV Community by Salah Ud Din (@4yub1k).</description>
    <link>https://dev.to/4yub1k</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%2F1081600%2F4d5abecb-f030-42c5-8a5e-5221f7745fbb.png</url>
      <title>DEV Community: Salah Ud Din</title>
      <link>https://dev.to/4yub1k</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/4yub1k"/>
    <language>en</language>
    <item>
      <title>Safely Extend Volume Size of VMware, Linux.</title>
      <dc:creator>Salah Ud Din</dc:creator>
      <pubDate>Mon, 22 May 2023 19:26:16 +0000</pubDate>
      <link>https://dev.to/4yub1k/safely-extend-volume-size-of-vmware-linux-5b0n</link>
      <guid>https://dev.to/4yub1k/safely-extend-volume-size-of-vmware-linux-5b0n</guid>
      <description>&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt;&lt;br&gt;
I have a VMware, increased the size of this machine from VMware GUI but still the free space is unusable in Ubuntu machine. In this tutorial will see how we can safely extend/increase the size of partition with no space. In short we will add 18 GB of space to the 100% full partition.&lt;/p&gt;

&lt;h4&gt;
  
  
  We can see the Root partition is full:
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;df -h&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nJIrSt1k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k1woijdel4yqok7oqwwa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nJIrSt1k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k1woijdel4yqok7oqwwa.png" alt="Root Partitions" width="664" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s see available free space. We can see the total size of &lt;code&gt;/dev/sda&lt;/code&gt; below image. So Size is changed. Linux will add this free space by itself. Now we will create another partition and then add it to the partition which is 100% full.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo fdisk -l&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LE7fjxg4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ze7206flie6wh0pivdrl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LE7fjxg4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ze7206flie6wh0pivdrl.png" alt="fdisk" width="703" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(Optional)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo lsblk&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zgWmSpua--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nun3osxkirb75j7a4on0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zgWmSpua--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nun3osxkirb75j7a4on0.png" alt="lsblk" width="580" height="132"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Select partition:
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;sda3 is partion of disk sda.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enter root&lt;/strong&gt; : &lt;code&gt;sudo -s&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;fdisk /dev/sda&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ERf-q7UI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2k1d8tgvyj6w5jn45gf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ERf-q7UI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2k1d8tgvyj6w5jn45gf.png" alt="fdisk" width="602" height="216"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter &lt;strong&gt;“m”&lt;/strong&gt; to list all commands:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NEcPqYqJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dwsp6ir7gjvb40nb01ht.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NEcPqYqJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dwsp6ir7gjvb40nb01ht.png" alt="fdisk options" width="456" height="565"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enter F:&lt;/strong&gt;&lt;br&gt;
To check free space, Here we have 11G (11 GBs) free space. Unpartitioned.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--808ARgQb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ixtp16aezwknae4rnzvj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--808ARgQb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ixtp16aezwknae4rnzvj.png" alt="Free space" width="679" height="146"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s create a partition,&lt;/p&gt;

&lt;p&gt;Enter n, Press Enter after it to select default max values. We can see partition is now created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m3qtHzcm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pgpiq373m1f6xiftif91.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m3qtHzcm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pgpiq373m1f6xiftif91.png" alt="fdisk options" width="800" height="104"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(Optional) In above it new partition it already selected the “Linux filesystem”. Just in case you want to change type in future partitions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enter Command n:&lt;/strong&gt;&lt;br&gt;
it will select the new partition automatically, You can also specify it. Enter L for the list.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---M9WHjvU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0tmjjsszf7g0vam566ay.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---M9WHjvU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0tmjjsszf7g0vam566ay.png" alt="partition type" width="416" height="48"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will select option 20: Linux file system. Press q to exit list.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8sZZl1Mr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eatskd4eq9903q7gfqmy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8sZZl1Mr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eatskd4eq9903q7gfqmy.png" alt="fdisk filesystem" width="588" height="467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;now, Enter 20&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zopt_JMr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g7hknrghkunck2h5hhsn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zopt_JMr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g7hknrghkunck2h5hhsn.png" alt="fdisk filesystem" width="703" height="64"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Save changes:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enter w:&lt;/strong&gt;&lt;br&gt;
write changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yZ_aA8Mv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cqttou61avwpg1qad2tv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yZ_aA8Mv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cqttou61avwpg1qad2tv.png" alt="fdisk" width="587" height="59"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Reboot:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;shudown -h now&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eoRxGmZu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zlpj80ozx2yog45b4blg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eoRxGmZu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zlpj80ozx2yog45b4blg.png" alt="Linux shutdown" width="672" height="55"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SSH or login again,&lt;/p&gt;

&lt;p&gt;We can see the new partition is added.&lt;br&gt;
&lt;code&gt;sudo fdisk -l&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6WR9Ve4j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vhnfe7sooni8m88o046f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6WR9Ve4j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vhnfe7sooni8m88o046f.png" alt="fdisk" width="765" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, Create Physical volume: &lt;code&gt;/dev/sda4&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo pvcreate /dev/sda4&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RJ5Dt4ft--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2ihtcrnlem0d8y45bkx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RJ5Dt4ft--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2ihtcrnlem0d8y45bkx.png" alt="pvcreate" width="636" height="38"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can see the volume size, and free size.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo vgdisplay&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2khWHPth--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dlu5jxohg6vpz9csgt1m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2khWHPth--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dlu5jxohg6vpz9csgt1m.png" alt="vgdisplay" width="647" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Extend:
&lt;/h4&gt;

&lt;p&gt;Here we will extend, or add the new partition &lt;code&gt;/dev/sda4&lt;/code&gt; to &lt;code&gt;VG NAME : ubuntu-vg&lt;/code&gt;. See the vg name in above image.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo vgextend ubuntu-vg /dev/sda4&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oCycfNjI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kpwj28p0mldkojhtun87.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oCycfNjI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kpwj28p0mldkojhtun87.png" alt="vgextend" width="571" height="40"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can see the Volume size, and free space is changed but Alloc size is still same. Now we need to use this free space.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t2imTdFC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ar1ylam1pvv0onws0i4c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t2imTdFC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ar1ylam1pvv0onws0i4c.png" alt="vgdisplay" width="597" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo pvscan&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--d-ix_Du9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rtj5hoyb4pogvy175ll2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--d-ix_Du9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rtj5hoyb4pogvy175ll2.png" alt="pvscan" width="680" height="70"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Get Lv path of this volume group:
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;sudo lvdisplay&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mVfrkQz7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hx8wlr47q4p2gx8nxddh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mVfrkQz7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hx8wlr47q4p2gx8nxddh.png" alt="lvdisplay" width="581" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Time to Extend it:
&lt;/h4&gt;

&lt;p&gt;+100%FREE mean use all the free space. You can also specify as much you want change command little bit &lt;code&gt;sudo lvextend -L +10G /dev/ubuntu-vg/ubuntu-lv&lt;/code&gt;. This will extend 10Gb space.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo lvextend -l +100%FREE &amp;lt;Logical Volume path&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---m25ts1q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gzdabcd10rziuthiel93.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---m25ts1q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gzdabcd10rziuthiel93.png" alt="lvextend" width="800" height="44"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point we have increased the size of the block volume where your root filesystem resides, but we still need to extend the filesystem on top of it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;df -h&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wwiQh9hD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ts3qy3ogc5qzairsrwd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wwiQh9hD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ts3qy3ogc5qzairsrwd.png" alt="size check" width="785" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Resize it:
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GcCbWAz_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f3ah9efydkjq3b07cjf2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GcCbWAz_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f3ah9efydkjq3b07cjf2.png" alt="resize2fs" width="800" height="95"&gt;&lt;/a&gt;&lt;br&gt;
Now, we are good. The free space is added successfully.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;df -h&lt;/code&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---NWZOjcK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dizj29rsrtex0il8prf6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---NWZOjcK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dizj29rsrtex0il8prf6.png" alt="size" width="772" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you for reading, and understanding it. I hope it have helped you. 😎&lt;/p&gt;

</description>
      <category>linux</category>
      <category>virtualmachine</category>
      <category>ubuntu</category>
      <category>devops</category>
    </item>
    <item>
      <title>Python and Visual Studio Code on Windows 10.</title>
      <dc:creator>Salah Ud Din</dc:creator>
      <pubDate>Sun, 14 May 2023 18:39:14 +0000</pubDate>
      <link>https://dev.to/4yub1k/easy-how-to-set-up-python-and-visual-studio-code-on-windows-10-5gon</link>
      <guid>https://dev.to/4yub1k/easy-how-to-set-up-python-and-visual-studio-code-on-windows-10-5gon</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/4yub1k"&gt;GitHub: Salah Ud Din - 4yub1k&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Goals:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Download the Python setup.&lt;/li&gt;
&lt;li&gt;Install Python.&lt;/li&gt;
&lt;li&gt;Download the VScode setup.&lt;/li&gt;
&lt;li&gt;Install VScode.&lt;/li&gt;
&lt;li&gt;Install the VScode extension “Python”.&lt;/li&gt;
&lt;li&gt;Run you first python.py script.&lt;/li&gt;
&lt;li&gt;Video tutorial complete.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Download Python:
&lt;/h4&gt;

&lt;p&gt;Go to Python official page : [&lt;a href="https://www.python.org/"&gt;Link&lt;/a&gt;]. And drop down Downloads, click “windows” in sub menu.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R9hk0Vw6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/csxvneova79x38v5dorq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R9hk0Vw6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/csxvneova79x38v5dorq.png" alt="Download Python" width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, Under “Stable Releases”, scroll down and search for the required version. As I need to install python’s latest version for &lt;strong&gt;&lt;a href="https://www.python.org/ftp/python/3.11.1/python-3.11.1-amd64.exe"&gt;“windows 64-bit”&lt;/a&gt;&lt;/strong&gt;, will select “Windows installer (64-bit)”, you can check whether your windows version is 64 or 32 bit, just visit Microsoft : [&lt;a href="https://support.microsoft.com/en-us/windows/32-bit-and-64-bit-windows-frequently-asked-questions-c6ca9541-8dce-4d48-0415-94a3faa2e13d"&gt;windows version&lt;/a&gt;].&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C_CIUcLA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/97v53ge7mtpm3t2pwohv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C_CIUcLA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/97v53ge7mtpm3t2pwohv.png" alt="Python Versions" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Install Python:
&lt;/h4&gt;

&lt;p&gt;Open the downloaded python installer, you will see this window as shown in image below. Check the “ADD pathon.exe to PATH” then click on “&lt;strong&gt;Install Now&lt;/strong&gt;”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---mfXgK6c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5w9asbqp6tkhjlokptic.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---mfXgK6c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5w9asbqp6tkhjlokptic.png" alt="Install Python" width="800" height="477"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p_wZVlpm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oa790arnu94dn45xuas3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p_wZVlpm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oa790arnu94dn45xuas3.png" alt="Python installation successful" width="746" height="438"&gt;&lt;/a&gt;&lt;br&gt;
Python installation successful.&lt;/p&gt;
&lt;h4&gt;
  
  
  Download VScode:
&lt;/h4&gt;

&lt;p&gt;Go to VScode official page : [&lt;a href="https://code.visualstudio.com/"&gt;Link&lt;/a&gt;]. And click on Download at right top corner.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6An18uSK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yqqokaqhf87ct6dzbk8b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6An18uSK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yqqokaqhf87ct6dzbk8b.png" alt="Download Vscode" width="800" height="295"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we don’t want the vscode to run for all users, we will install “User Installer”. Click on x64 in front of User Installer to downloads it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KfTSvYLd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/upbqhtlzz72kegx0kxa6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KfTSvYLd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/upbqhtlzz72kegx0kxa6.png" alt="VScode Version" width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Install VScode:
&lt;/h4&gt;

&lt;p&gt;Open the vscode .exe you download.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s5kXFEQu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ozqi6ffjeh7pl4ryshw2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s5kXFEQu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ozqi6ffjeh7pl4ryshw2.png" alt="Install VScode" width="459" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click “I accept the agreement”, and keep clicking Next. If you want shortcut of vscode on Desktop screen, make sure to check this box as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--k89ueZRW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/901i23bvqf7hx0hikmfv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k89ueZRW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/901i23bvqf7hx0hikmfv.png" alt="VScode" width="664" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NMCtcga7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5oin2kll7vpje5iqnd8c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NMCtcga7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5oin2kll7vpje5iqnd8c.png" alt="VScode" width="666" height="471"&gt;&lt;/a&gt;&lt;br&gt;
VScode installation completed, click finish to open VScode.&lt;/p&gt;
&lt;h4&gt;
  
  
  Install Python Extension:
&lt;/h4&gt;

&lt;p&gt;Now, we need to install a very powerful extension of vscode for python. For more about it, go to link [&lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-python.python"&gt;Python Extension&lt;/a&gt;]. Click on the Extensions as shown.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mwhYKVbu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aedqtned7xrcjyy1ieuv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mwhYKVbu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aedqtned7xrcjyy1ieuv.png" alt="VScode" width="800" height="548"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Search for python in search box.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zKvu0sQA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9gsbesq3irpnvv7cfkkr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zKvu0sQA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9gsbesq3irpnvv7cfkkr.png" alt="VScode" width="758" height="320"&gt;&lt;/a&gt;&lt;br&gt;
Click the one from Microsoft.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pf_Ox8A5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d7hdsbaqhthdpd1jqbdo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pf_Ox8A5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d7hdsbaqhthdpd1jqbdo.png" alt="VScode" width="800" height="359"&gt;&lt;/a&gt;&lt;br&gt;
Then click on install the extension and wait for installation to complete. We are ready !&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vJpR78_w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fxbn1ymxacorolo1bwj1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJpR78_w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fxbn1ymxacorolo1bwj1.png" alt="VScode" width="800" height="266"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Run Python Script:
&lt;/h4&gt;

&lt;p&gt;create a file , fileName.py. We will use first as file name here, ‘first.py’.&lt;br&gt;
Go to “Terminal Menu” and click “New Terminal”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nt8grW4g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqb2huknm59cldw2548m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nt8grW4g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqb2huknm59cldw2548m.png" alt="Python VScode" width="800" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It will open the command line for you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--008fnRD_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qxi2zj4xok6wtchvc9wt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--008fnRD_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qxi2zj4xok6wtchvc9wt.png" alt="VScode Terminal" width="800" height="330"&gt;&lt;/a&gt;&lt;br&gt;
Enter “py fileName.py” to run the script.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WJCnSz0v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v82hove6eg3xna04z37x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WJCnSz0v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v82hove6eg3xna04z37x.png" alt="VScode" width="800" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Video Link : [&lt;a href="https://www.youtube.com/watch?v=D8swqvpFDM8&amp;amp;ab_channel=NerdyAyubi"&gt;Python &amp;amp; VScode Installation&lt;/a&gt;]&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/D8swqvpFDM8"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Thank you. 😎👍&lt;/p&gt;

</description>
      <category>python</category>
      <category>vscode</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Art of Manually Crafting Packets (TCP/IP).</title>
      <dc:creator>Salah Ud Din</dc:creator>
      <pubDate>Sat, 13 May 2023 09:46:39 +0000</pubDate>
      <link>https://dev.to/4yub1k/art-of-manually-crafting-packets-tcpip-1phc</link>
      <guid>https://dev.to/4yub1k/art-of-manually-crafting-packets-tcpip-1phc</guid>
      <description>&lt;p&gt;Dissecting the TCP/IP packet. What’s inside the packet, in detail.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/4yub1k" rel="noopener noreferrer"&gt;Salah Ud Din — 4yub1k&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After reading tons of articles, blogs, and testing. I wrote this article complete to the point and easy to understand. I hope you’ll enjoy it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Make sure you read this introductory article before starting. [&lt;a href="https://dev.to/4yub1k/what-is-tcpip-explained-in-detail-34d3"&gt;READ&lt;/a&gt;]&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To install Python: [&lt;a href="https://dev.to/4yub1k/easy-how-to-set-up-python-and-visual-studio-code-on-windows-10-5gon"&gt;LINK&lt;/a&gt;]&lt;/p&gt;

&lt;p&gt;This article and script is purely for educational purposes. Ignore mistakes.&lt;/p&gt;

&lt;h4&gt;
  
  
  IP:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.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%2Ftea0hjk3r4wehjtiot70.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ftea0hjk3r4wehjtiot70.jpg" alt="IP"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IMPORTANT:&lt;/strong&gt;&lt;br&gt;
You must make a minimum 8 bit word, for any calculation (except Addition see checksum), if it is in hex or binary in order to avoid errors. And fill the zeros as shown in figure above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Examples:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Version + IHL &amp;amp; TOS ( Type Of Service) = 0x45 is 8 bit, and 0x00 is also 8 bit word (1 Byte) , In binary = 01000101 00000000 16 bits.&lt;/li&gt;
&lt;li&gt;Flags &amp;amp; Fragment Offset = (000 3 bit) &amp;amp; (000000000 13 bit), But for calculation make a 8 bit word or 1 byte, Binary = 00000000 0000000 = 00 00.&lt;/li&gt;
&lt;li&gt;You can’t write protocol only 0x6 as it will be considered as 4 bit, so it must be 0x06, Binary = 00000110 = 06 = 0x06. No room to drop any bit even if it is ‘0’ as Leading.&lt;/li&gt;
&lt;li&gt;As in figure above there are total 5 rows, each row is of 32 bits, divided in 16 bits of chunks except the address rows.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  We need for IP:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Version : 4 bit&lt;/li&gt;
&lt;li&gt;IHL : 4 bit&lt;/li&gt;
&lt;li&gt;Type Of Service : 8 bit&lt;/li&gt;
&lt;li&gt;Total Length : 16 bit&lt;/li&gt;
&lt;li&gt;Identification : 16 bit&lt;/li&gt;
&lt;li&gt;Flag : 3 bit&lt;/li&gt;
&lt;li&gt;Fragment Offset : 13 bit&lt;/li&gt;
&lt;li&gt;Time To live (TTL) : 8 bit&lt;/li&gt;
&lt;li&gt;Protocol : 8 bit&lt;/li&gt;
&lt;li&gt;Header Checksum : 16 bit&lt;/li&gt;
&lt;li&gt;Source Address : 32 bits&lt;/li&gt;
&lt;li&gt;Destination Address : 32 bits&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  IHL:
&lt;/h4&gt;

&lt;p&gt;Number of 32 bit words in packet: Count the number of fields/rows in above figure = 5. So, IHL will be 5 = 0x5 (4 bit).&lt;/p&gt;

&lt;h4&gt;
  
  
  Total Length:
&lt;/h4&gt;

&lt;p&gt;Combine length of 32 bit word in both (IP and TCP). In short number of rows of 32 bit words in packet.&lt;br&gt;
*we will fill it after filling TCP header.&lt;/p&gt;

&lt;h4&gt;
  
  
  Identification:
&lt;/h4&gt;

&lt;p&gt;Take any random value less then 0xFFFF (16 bit). It is only for packet identity.&lt;/p&gt;

&lt;h4&gt;
  
  
  Flags + Fragment:
&lt;/h4&gt;

&lt;p&gt;In bits 000 + 0000000000, you can leave it as it is but if you want to use it then,&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do not fragment packet :&lt;/strong&gt;&lt;br&gt;
Flag bit = 010 + 00000 00000000 = 01000000 00000000 = 4 0, combine them as they are 16 bit word = 0x40&lt;/p&gt;

&lt;h4&gt;
  
  
  Time To Live ( TTL ):
&lt;/h4&gt;

&lt;p&gt;Every time a router forwards the packet, it decrements the TTL field in the packet header, and if the value reaches zero, the packet is dropped.&lt;br&gt;
Value Ranges from 0–225, 0x00–0xFF as it is 8 bit.&lt;br&gt;
Example : 64 decimal = 0x40 Hex.&lt;/p&gt;

&lt;h4&gt;
  
  
  Protocol :
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;TCP = 06&lt;/li&gt;
&lt;li&gt;ICMP = 01
To know more Internet Protocols : &lt;a href="https://en.wikipedia.org/wiki/List_of_IP_protocol_numbers" rel="noopener noreferrer"&gt;GOTO&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Header Checksum :
&lt;/h4&gt;

&lt;p&gt;For the calculations, all necessary values are used in 16 bit words and added together. In case the value isn’t 16 bit long, it will be prepended with zeros. 0x6 = 0x0006 (16 bit).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“|” means concatenate the bits.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can see we have divided the IP Address in 16 bit word instead of 32 bit.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Checksum = (Version | IHL | Type of Service) + Total Length + Identification + (Flags | Fragment Offset) + (TTL | Protocol + Header Checksum (0x0000 in calculation) ) + Source Address (IP) + Destination Address (IP)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;*if value of Checksum is greater then 0xFFFF then there will be a carry, 0x12345 → 0x2345 + 0x0001 = 0x2346 , This is how we can compensate carryover.&lt;br&gt;
Total Checksum will be subtract 0x2346 from 0xFFF.&lt;br&gt;
Checksum = Checksum + carryover (if any)&lt;/p&gt;

&lt;p&gt;Total Checksum = 0xFFFF — ( checksum ), Negation with (0xFFFF)&lt;/p&gt;

&lt;h4&gt;
  
  
  Source &amp;amp; Destination IP :
&lt;/h4&gt;

&lt;p&gt;Convert IP address to Hex values.&lt;br&gt;
192.168.242.133&lt;br&gt;
192 = 0xc0.&lt;br&gt;
168 = 0xa8.&lt;br&gt;
242 = 0xf2.&lt;br&gt;
133 = 0x85.&lt;/p&gt;

&lt;h4&gt;
  
  
  TCP:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.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%2F57qqwr5lf117l394c36c.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F57qqwr5lf117l394c36c.jpg" alt="TCP"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  We need for TCP:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Source Port : 16 bit&lt;/li&gt;
&lt;li&gt;Destination Port : 16 bit&lt;/li&gt;
&lt;li&gt;Sequence Number : 32 bit&lt;/li&gt;
&lt;li&gt;Acknowledgement Number : 32 bit&lt;/li&gt;
&lt;li&gt;Data Offset : 4 bit&lt;/li&gt;
&lt;li&gt;Reserved : 3 bit&lt;/li&gt;
&lt;li&gt;Flags : 9 bit&lt;/li&gt;
&lt;li&gt;Checksum : 16 bit&lt;/li&gt;
&lt;li&gt;Urgent Pointer : 16 bit&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Source &amp;amp; Destination Port :
&lt;/h4&gt;

&lt;p&gt;Decimal port value to hex value,&lt;br&gt;
12336 = 0x3030&lt;br&gt;
80 = 0x50&lt;/p&gt;

&lt;h4&gt;
  
  
  Ack &amp;amp; Sequence Number:
&lt;/h4&gt;

&lt;p&gt;They are set to 0x0000 &amp;amp; 0x0000 initially.&lt;/p&gt;

&lt;h4&gt;
  
  
  Data Offset :
&lt;/h4&gt;

&lt;p&gt;Is the number of 32 bit word in TCP header, count the row = 5 in above figure, There are ‘5’ 32 bit words. 0x5 = Binary = 0101. (Data offset is 4 bit).&lt;/p&gt;

&lt;h4&gt;
  
  
  Flags:
&lt;/h4&gt;

&lt;p&gt;As we want to send a SYN request, the SYN bit will be set to 1 as in shown above.&lt;br&gt;
000000010 = 0x2&lt;/p&gt;

&lt;h4&gt;
  
  
  Window Size:
&lt;/h4&gt;

&lt;p&gt;Used for flow control, 2 bytes long, we chose a random value not too much large.&lt;br&gt;
Window size= bandwidth(Mbits connection) x delay(ms),&lt;br&gt;
For detail : GOTO&lt;/p&gt;

&lt;h4&gt;
  
  
  TCP Checksum:
&lt;/h4&gt;

&lt;p&gt;Checksum consists of values of the TCP Header itself and a Pseudo Header. For the calculations, all necessary values are used in 16 bit words and added together.&lt;br&gt;
In case the value isn’t 16 bit long, it will be prepended with zeros.&lt;/p&gt;

&lt;h4&gt;
  
  
  Pseudo Header:
&lt;/h4&gt;

&lt;p&gt;The TCP pseudo header is used to associate the TCP segment with the IP header. The TCP pseudo header is added to the beginning of the TCP segment only during the checksum calculation and is not sent as part of the TCP segment.&lt;/p&gt;

&lt;p&gt;Why? The use of the TCP pseudo header assures the receiver that a routing or fragmentation process did not improperly modify key fields in the IP header.&lt;br&gt;
In short it makes sure that TCP datagram (packet) has reached correct destination.&lt;/p&gt;

&lt;h4&gt;
  
  
  Calculation:
&lt;/h4&gt;

&lt;p&gt;Pseudo = Protocol + Source Address (IP) + Destination Address (IP) + TCP length (including the data part) in byte (no actual header field, has to be counted)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TCP Checksum:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;TCP header = Source Port + Destination Port + Sequence Number + Acknowledgement Number + (Data Offset | Reserved | Flags ) + Window Size + Checksum (set to 0x0000 in calculation) + Urgent Pointer&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
*if value of TCP header is greater then 0xFFFF then there will be a carry, 0x12345 → 0x2345 +0x0001 = 0x2346 , This how to compensate carryover.&lt;br&gt;
Total will be 0xFFF — 0x2346 =&lt;br&gt;
TCP Header = TCP header + carryover(if any).&lt;/p&gt;

&lt;p&gt;Total Checksum = 0xFFF — ( Pseudo + TCP header ) , Negation with (0xFFFF)&lt;/p&gt;

&lt;h4&gt;
  
  
  Urgent Pointers:
&lt;/h4&gt;

&lt;p&gt;If the URG flag is set, the urgent pointer points to the sequence number of the byte following the urgent data,&lt;br&gt;
As its name says Urgent it will point to urgent data/priority, Must be processed urgently.&lt;/p&gt;

&lt;h4&gt;
  
  
  Let’s see the final packet after filling the values:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.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%2F4mov59ngw4cncf888n90.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F4mov59ngw4cncf888n90.jpg" alt="TCP/IP Packet"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;After filling the values you have to update few values Total length and Protocol you want to use.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Some Updates in IP Header :
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Total Length: ( IP )&lt;/strong&gt;&lt;br&gt;
Total number of bytes in 32 bit words in the packet. Here number of 32 bit word (rows), above = 10 rows, and each row is of 4 byte.&lt;br&gt;
10 x 4 = 40 bytes = 0x0028. (Convert Decimal 40 to Hex)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Protocol:&lt;/strong&gt;&lt;br&gt;
Protocol = 06 for TCP&lt;/p&gt;

&lt;p&gt;Now, start Wireshark, and filter for source ip -&amp;gt; ip.addr=.&lt;/p&gt;

&lt;h4&gt;
  
  
  Run the script:
&lt;/h4&gt;

&lt;p&gt;Download the script [&lt;a href="https://github.com/4yub1k/tcp_ip" rel="noopener noreferrer"&gt;GOTO&lt;/a&gt;]&lt;br&gt;
&lt;code&gt;python3 tcp_ip.py -h&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;TCP/IP Crafting : GitHub &lt;a class="mentioned-user" href="https://dev.to/4yub1k"&gt;@4yub1k&lt;/a&gt; &lt;br&gt;
&lt;strong&gt;arguments:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  -h, --help        show this help message and exit&lt;/li&gt;
&lt;li&gt;  -s , --srcip      Source Ip address.&lt;/li&gt;
&lt;li&gt;  -sp , --srcport   Source port.&lt;/li&gt;
&lt;li&gt;  -d , --dstip      Destination Ip address.&lt;/li&gt;
&lt;li&gt;  -dp , --dstport   Destination port.&lt;/li&gt;
&lt;li&gt;  -t , --timeout    Wait for response.(Default=5 secs)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;code&gt;python3 tcp_ip.py -s=192.168.0.16 -sp=12333 -d=192.168.0.1 -dp=80 -t=2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Change values and run the script.&lt;/p&gt;

&lt;h4&gt;
  
  
  Wireshark:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fzo7k6ksoljis6anjkhvm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fzo7k6ksoljis6anjkhvm.png" alt="Wireshark"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Packet Sent:
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;IP:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fw33p431m1tfzyt3xbf2y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fw33p431m1tfzyt3xbf2y.png" alt="IP Bytes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TCP:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fwcrsa3ama2271j40mqq8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fwcrsa3ama2271j40mqq8.png" alt="TCP Bytes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Packet Received:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fcn63uddawn255fsfabir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fcn63uddawn255fsfabir.png" alt="Packet Received"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Output of Script:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.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%2F06tzaogk1z9oxagj4ze9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F06tzaogk1z9oxagj4ze9.png" alt="IP Checksum"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F8rqznra050yjeq5y0rdg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F8rqznra050yjeq5y0rdg.png" alt="TCP Checksum"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fx5ap3w5h55049ho59zz4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fx5ap3w5h55049ho59zz4.png" alt="Final Output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s it Use Wireshark and study the packet, with script.&lt;/p&gt;

&lt;p&gt;Yes, you can spoof the mac address and IP. The response will be sent to the source MAC/IP used. For more try it out 😂😎.&lt;/p&gt;

&lt;p&gt;To change MAC address just add them like this before packet. That’s it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Destination: 62:3a:35:6c:49:0a (62:3a:35:6c:49:0a)&lt;/li&gt;
&lt;li&gt;Source: VMware_f4:e7:ac (00:0c:29:f4:e7:ac)&lt;/li&gt;
&lt;li&gt;Type: IPv4 (0x0800)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fpvhvd8el4l72gfcucuwz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fpvhvd8el4l72gfcucuwz.png" alt="MAC/IP Spoof"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Notes (Quick Revision):
&lt;/h4&gt;

&lt;p&gt;TCP Header is HEX string.&lt;br&gt;
TCP Bytes is ByteArray of HEX string.&lt;/p&gt;

&lt;p&gt;This is how we can send these bytes (16 bit of word).&lt;br&gt;
(“ | ” ) is concatenation.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Packet = (Version | IHL | Type Of Service) + Total Length + Identification + (Flags | Fragment Offset) + (Time To Live | Protocol) + Header Checksum(IP) + Source Address+ Destination Address + Source Port + Destination Port + Sequence Number + Acknowledgement Number + (Data Offset | Flags) + Window Size + Checksum(TCP) + Urgent Pointer.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Packet = 4500 + 0028 + abcd + 0000 + 4006 + d7ab + c0a8 + f285 + 8efa + b52e + 3030 + 0050 + 0000 + 0000 + 0000 + 0000 + 5002 + 7110 + 16fb + 0000&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Final Packet in Bytes:
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;Packet = b'\x45\x00\x00\x28\xab\xcd\x00\x00\x40\x06\xd7\xab\xc0\xa8\xf2\x85\x8e\xfa\xb5\x2e\x30\x30\x00\x50\00\x00\x00\x00\x00\x00\x00\x00\x50\x02\x71\x10\x16\xfb\x00\x00'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;e-g They are \x(1 byte) \x(1 byte)……….. You have to send them exactly like this. \x45 = 1 Byte = 8 bits. (Here 4 = 4 bit, 5 = 4 bit). So, 45 = 4+4 = 8 bits.&lt;/p&gt;

&lt;p&gt;I hope you understood everything. 😎👍&lt;/p&gt;

</description>
      <category>security</category>
      <category>python</category>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>What is TCP/IP ? Introduction TCP/IP Packet.</title>
      <dc:creator>Salah Ud Din</dc:creator>
      <pubDate>Fri, 12 May 2023 19:38:35 +0000</pubDate>
      <link>https://dev.to/4yub1k/what-is-tcpip-explained-in-detail-34d3</link>
      <guid>https://dev.to/4yub1k/what-is-tcpip-explained-in-detail-34d3</guid>
      <description>&lt;p&gt;&lt;strong&gt;Transmission Control Protocol/Internet Protocol explanation.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/4yub1k"&gt;GitHub: Salah Ud Din - 4yub1k&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Discussed:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;OSI Model.&lt;/li&gt;
&lt;li&gt;Encapsulation.&lt;/li&gt;
&lt;li&gt;Internet Protocol (IP).&lt;/li&gt;
&lt;li&gt;Transmission Control Protocol (TCP).&lt;/li&gt;
&lt;li&gt;Duty of TCP.&lt;/li&gt;
&lt;li&gt;Connection Establishment.&lt;/li&gt;
&lt;li&gt;3-Way Handshake.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Open Systems Interconnection model (OSI model):
&lt;/h4&gt;

&lt;p&gt;The Open Systems Interconnection model (OSI model) is a conceptual model that characterize and standardize the communication functions of a telecommunication or computing system without regard to its underlying internal structure and technology.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--67tCkO5F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/snvr7a3pz4g4v4n053ke.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--67tCkO5F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/snvr7a3pz4g4v4n053ke.jpg" alt="Internet protocol suite" width="280" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--01hn7ZHz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6zurzbcht8ngybleitmu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--01hn7ZHz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6zurzbcht8ngybleitmu.jpg" alt="OSI model" width="505" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Encapsulation:
&lt;/h4&gt;

&lt;p&gt;When data is transmitted from one host to another, the data is handed downwards from the uppermost layer to the bottom layer of the sending host. At each level, the current layer adds its own header (or trailer) and hands it further downwards. This process is also called encapsulation.&lt;/p&gt;

&lt;p&gt;At the bottom layer the data is transmitted to the receiving host in bytes, which then does the same process in reverse. Handing the received transmission from the bottom to the top with each layer removing their header (or trailer).&lt;/p&gt;

&lt;h4&gt;
  
  
  Layer architecture:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PdqPSwmq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vofq0dr89o0h4ke1kk8j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PdqPSwmq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vofq0dr89o0h4ke1kk8j.png" alt="Layer architecture OSI Model" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Internet Protocol (IP):
&lt;/h4&gt;

&lt;p&gt;The Internet Protocol (IP) is the principal communication protocol. It delivers packets from one Host(IP) to other Host(IP).&lt;/p&gt;

&lt;p&gt;It is connectionless so packet loss/corruption may occur.&lt;/p&gt;

&lt;p&gt;Packets of connectionless protocols are also called datagrams. This falls in Internet/Network Layer.&lt;/p&gt;

&lt;h4&gt;
  
  
  Types:
&lt;/h4&gt;

&lt;p&gt;IP Version 4 (IPv4) -&amp;gt; 192.168. 10.150.&lt;br&gt;
IP Version 6 (IPv6) -&amp;gt; 3002:0bd6:0000:0000:0000:ee00:0033:6778.&lt;/p&gt;

&lt;h4&gt;
  
  
  Format of IP Header:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j-9WEmra--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8x9cv9nmuhwohh5ejjrs.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j-9WEmra--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8x9cv9nmuhwohh5ejjrs.jpg" alt="Format of IP Header" width="800" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Detailed Format of IP Header:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5S7rm211--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ipos5kwgb8o1ptqk6rnp.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5S7rm211--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ipos5kwgb8o1ptqk6rnp.jpg" alt="Detailed Format of IP Header" width="799" height="580"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Transmission Control Protocol (TCP):
&lt;/h4&gt;

&lt;p&gt;This protocol is responsible for many application which work on internet e-g WWW, email, File Transfer Protocol, Secure Shell, peer-to-peer file sharing, and streaming media.&lt;br&gt;
This Transport layer provide connectivity between HOST-HOST. It is reliable, ordered and error-checked protocol. Opposite to User Datagram Protocol (UDP).&lt;/p&gt;

&lt;h4&gt;
  
  
  Duty of TCP:
&lt;/h4&gt;

&lt;p&gt;(Why TCP ?)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Establishment/termination,&lt;/li&gt;
&lt;li&gt;Reliable transmission,&lt;/li&gt;
&lt;li&gt;Error detection,&lt;/li&gt;
&lt;li&gt;Flow/congestion control, and more of connection.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Format of TCP Header:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QN4JYMdW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uik3s7bvewt7on8555tn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QN4JYMdW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uik3s7bvewt7on8555tn.jpg" alt="Format of TCP Header" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Detailed Format of TCP Header:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YjXBwtaE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zvqnf56k34eyuc8v0dm5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YjXBwtaE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zvqnf56k34eyuc8v0dm5.jpg" alt="Detailed Format of TCP Heade" width="800" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Connection Establishment:
&lt;/h4&gt;

&lt;p&gt;TCP uses a three-way handshake in order to establish a connection. Let’s assume that host A (Client) wants to connect to host B (Server):&lt;/p&gt;

&lt;h4&gt;
  
  
  3-Way Handshake:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H6aYEEir--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/enylu2gpc5n2s4xyc96w.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H6aYEEir--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/enylu2gpc5n2s4xyc96w.jpg" alt="3-Way Handshake" width="478" height="223"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SYN: Client send a [SYN]  to Server with a random value as sequence number “x”.&lt;/p&gt;

&lt;p&gt;SYN-ACK: Server replies on this connection attempt by sending a [SYN ACK] . The sequence number “y” is randomly chosen by Server. The acknowledgement number is the received sequence number increased by one i.e. [PACK]=”x+1".&lt;/p&gt;

&lt;p&gt;ACK: Client send an [ACK] to Server. The sequence number [SEQ] is the previously received acknowledgement number [PACK]=” x+1". The new acknowledgement number [PACK] is the received sequence number increased by one i.e.[PACK]=”y+1".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qhH2ejdb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ondsbj5jwkzufdkgqj5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qhH2ejdb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ondsbj5jwkzufdkgqj5.jpg" alt="TCP/IP wireshark" width="797" height="38"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;FIN: To terminate the connection. See Flag in TCP.&lt;/p&gt;

&lt;p&gt;We’ll discuss TCP/IP crafting in next article. [Coming soon..]&lt;/p&gt;

</description>
      <category>python</category>
      <category>security</category>
      <category>wireshark</category>
    </item>
  </channel>
</rss>
