User Tools

Site Tools


linux:basic-ip-subnetting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

linux:basic-ip-subnetting [2019/01/21 11:20] (current)
seanburns created
Line 1: Line 1:
 +<​markdown>​
 +# Some basic IP subnetting
 +## Date: Tue Oct 10 2018
  
 +Here are some example IP addresses:
 +
 +**IP addresses:​**
 +
 +- 192.168.1.6: ​ Desktop 1
 +- 10.160.38.75:​ Desktop 2
 +
 +**Broadcast addresses:​**
 +
 +- 192.168.1.255:​ Desktop 1
 +- 10.160.38.255:​ Desktop 2
 +
 +**Netmask addresses:​**
 +
 +- 255.255.255.0:​ Desktop 1
 +- 255.255.255.0:​ Desktop 2
 +
 +An IP address is 32 bits (8 x 4), or four bytes, in size. In human readable
 +context, it's usually expressed in the following notation style:
 +
 +**192.168.1.6**
 +
 +Where each bit is represented by either a 1 or a 0. E.g., the above address in
 +binary is:
 +
 +**11000000.10101000.00000001.00000110**
 +
 +- 11000000 = 192
 +- 10101000 = 168
 +- 00000001 = 1
 +- 00000110 = 6
 +
 +When doing IP math, one easy way to do it is to simply remember that each bit
 +in each of the above bytes is a placeholder for the following values:
 +
 +**128 64 32 16 8 4 2 1**
 +
 +Alternatively,​ from low to high:
 +
 +| base2 |        |
 +|-------|--------|
 +| 2^0   | 1      |
 +| 2^1   | 2      |
 +| 2^2   | 4      |
 +| 2^3   | 8      |
 +| 2^4   | 16     |
 +| 2^5   | 32     |
 +| 2^6   | 64     |
 +| 2^7   | 128    |
 +
 +In binary, 192 is equal to 11000000. It's helpful to work backword. For IP
 +addresses, all octets are 255 or less and therefore do not exceed 8 bits or
 +places:
 +
 +```
 +1 * 2^7 = 128
 +1 * 2^6 =  64 (128 + 64 = 192)
 +```
 +STOP: There are no values left, and so the rest are zeroes.
 +
 +So: 11000000
 +
 +```
 +(0 * 2^0) + (0 * 2^1) + (0 * 2^2) + (0 * 2^3) + (0 * 2^4) + (0 * 2^5) +
 +(1 * 2^6) + (1 * 2^7)
 +```
 +
 +Another way: to convert to binary, simply subtract the numbers from each value.
 +As long as there is something remaining or the placeholder equals the remainder
 +of the previous subtraction,​ then the bit equals 1. So:
 +
 +- 192 - 128 = 64 -- therefore the first bit is equal to 1.
 +- Now take the leftover and subtract it:
 +- 64 - 64 = 0 -- therefore the second bit is equal to 1.
 +
 +Since there is nothing remaining, the rest of the bits equal 0.
 +
 +## Subnetting
 +
 +### 192.168.1.6 : Desktop 1
 +
 +```
 +11000000.10101000.00000001.00000110 IP              192.168.1.6
 +11111111.11111111.11111111.00000000 Mask            255.255.255.0
 +-----------------------------------
 +11000000.10101000.00000001.00000000 Network Address 192.168.1.0
 +```
 +
 +Note the mask has 24 ones followed by 8 zeroes. That 24 is used as CIDR
 +notation, so:
 +
 +192.168.1.6/​24
 +
 +## 10.160.38.75 : Desktop 3
 +
 +```
 +00001010.10100000.00100110.01001011 IP               ​10.160.38.75
 +11111111.11111111.11111111.00000000 Mask            255.255.255.0
 +-----------------------------------
 +00001010.10100000.00100110.00000000 Network Address ​  ​10.163.38.0
 +```
 +
 +For Desktop 1, we have the following:
 +
 +- Netmask/​Mask:​ 255.255.255.0
 +- Network ID: 192.168.1.0
 +- Start Range: 192.168.1.1
 +- End Range: 192.168.1.254
 +- Broadcast: 192.168.1.255
 +
 +For Desktop 2, we have the following
 +
 +- Netmask/​Mask:​ 255.255.255.0
 +- Network ID: 10.163.38.0
 +- Start Range: 10.163.38.1
 +- End Range: 10.163.38.254
 +- Broadcast: 10.163.38.255
 +
 +
 +# Homework example:
 +
 +```
 +10101100 00010000 00000001 00100111 IP          172.16.1.62
 +11111111 11111111 11111111 00000000 Mask        255.255.255.0
 +-----------------------------------
 +10101100 00010000 00000001 00000000 Network ID  172.16.1.0
 +```
 +
 +- Netmask/​Mask :    255.255.255.0
 +- Network ID   : ​   172.16.1.0
 +- Start Range  :    172.16.1.1
 +- End Range    :    172.16.1.254
 +- Broadcast ​   :    172.16.1.255
 +</​markdown>​
linux/basic-ip-subnetting.txt ยท Last modified: 2019/01/21 11:20 by seanburns