1.3 IPv4 Subnetting - Paiet/Tech-Journal-for-Everything GitHub Wiki

1.3 IPv4 Subnetting

Class A - 255.0.0.0     -   1 - 126
Class B - 255.255.0.0   - 128 - 191
Class C - 255.255.255.0 - 192 - 223

Host A: 192.168.0.222
Host B: 192.168.1.57
Host C: 192.168.0.33
Host D: 192.168.1.100
Mask: 255.255.255.0

NetworkID.HostID

209.251.159.133
209.151.159.77
255.255.255.0

CIDR - Classless Inter-Domain Routing

72.10.35.44
255.0.0.0     - 11111111.00000000.00000000.00000000
255.255.0.0   - 11111111.11111111.00000000.00000000
255.255.255.0 - 11111111.11111111.11111111.00000000
255.255.x.0        11111111.11111111.11110000.00000000

11111111 - 255
11111110 - 254
11111100 - 252
11111000 - 248
11110000 - 240
11100000 - 224
11000000 - 192
10000000 - 128
00000000 - 0

10000000.00000000.00000000.00000000 - 128.0.0.0
11000000.00000000.00000000.00000000 - 192.0.0.0
11100000.00000000.00000000.00000000 - 224.0.0.0
11110000.00000000.00000000.00000000 - 240.0.0.0
11111000.00000000.00000000.00000000 - 248.0.0.0
11111100.00000000.00000000.00000000 - 252.0.0.0
11111110.00000000.00000000.00000000 - 254.0.0.0
11111111.00000000.00000000.00000000 - 255.0.0.0        - Class A
11111111.10000000.00000000.00000000 - 255.128.0.0
11111111.11000000.00000000.00000000 - 255.192.0.0
11111111.11100000.00000000.00000000 - 255.224.0.0
11111111.11110000.00000000.00000000 - 255.240.0.0
11111111.11111000.00000000.00000000 - 255.248.0.0
11111111.11111100.00000000.00000000 - 255.252.0.0
11111111.11111110.00000000.00000000 - 255.254.0.0
11111111.11111111.00000000.00000000 - 255.255.0.0      - Class B
11111111.11111111.10000000.00000000 - 255.255.128.0
11111111.11111111.11000000.00000000 - 255.255.192.0
11111111.11111111.11100000.00000000 - 255.255.224.0
11111111.11111111.11110000.00000000 - 255.255.240.0
11111111.11111111.11111000.00000000 - 255.255.248.0
11111111.11111111.11111100.00000000 - 255.255.252.0
11111111.11111111.11111110.00000000 - 255.255.254.0
11111111.11111111.11111111.00000000 - 255.255.255.0    - Class C
11111111.11111111.11111111.10000000 - 255.255.255.128
11111111.11111111.11111111.11000000 - 255.255.255.192
11111111.11111111.11111111.11100000 - 255.255.255.224
11111111.11111111.11111111.11110000 - 255.255.255.240
11111111.11111111.11111111.11111000 - 255.255.255.248
11111111.11111111.11111111.11111100 - 255.255.255.252
11111111.11111111.11111111.11111110 - 255.255.255.254

128 - 1     128+64+32+16 = 128+64=192+32=224+16=240
 64 - 1     8+4+2+1 = 12+2=14+1=15  255-15=240
 32 - 1
 16 - 1
  8 - 0
  4 - 0
  2 - 0
  1 - 0

VLSM - Variable Length Subnet Mask

Subnetting
    Subnetting - Dividing a network up to make multiple smaller networks
    Supernetting - Combining networks to make a single larger network

192.168.0.55
192.186.0.47
255.255.255.0

Converting all octets:
                                       |
192.168.53.111 - 11000000.10101000.0011|0101.01111000
192.168.47.8   - 11000000.10101000.0010|1111.00001000
255.255.240.0  - 11111111.11111111.1111|0000.00000000
                                       |
Converting the "Action Octet"
                        |
192.168.111.240  111 - 0|0110101
192.168.200.11   200 - 1|1001000
255.255.128.0    128 - 1|0000000
                        |

Converting as few bits as possible:
                         |
192.168.217.44   217 - 11|
192.168.63.9      63 - 00|
255.255.192.0    192 - 11|000000
                         |

128 - 0    168 - 128 = 40 - 32 = 8 - 8 = 0
 64 - 1
 32 - 1
 16 - 1
  8 - 1
  4 - 0
  2 - 0
  1 - 0

Subnet Shorthand Notation

255.255.255.0 - 11111111.11111111.11111111.00000000

/24

192.168.0.100/24

/0  - All Networks
/8  - Class A - 255.0.0.0
/16 - Class B - 255.255.0.0
/24 - Class C - 255.255.255.0
/32 - A single machine

Class A - 10.0.0.0/8
Class B - 172.16.0.0/16
Class C - 192.168.0.0/24
192.168.53.111
192.168.47.8
255.255.255.0

192.168.53.111
192.168.47.8
255.255.0.0

                                       |
192.168.53.111 - 11000000.10101000.0011|0101.01111000
192.168.47.8   - 11000000.10101000.0010|1111.00001000
255.255.240.0  - 11111111.11111111.1111|0000.00000000
                                       |

Network Contains Three Types of IPs:
*    Subnet Reference - Very first IP. Identifies the subnet
*    Host IP - Everything between the subnet IP and the broadcast IP
*    Broadcast - Very last IP. Used to communicate with all hosts

Class A (/8)
    10.0.0.0/8
    255.0.0.0
    IP Range
        Subnet:       10.0.0.0
        First Usable: 10.0.0.1
        Last Usable:  10.255.255.254
        Broadcast:    10.255.255.255
Class B (/16)
    172.16.0.0/16
    255.255.0.0
    IP Range
        Subnet:       172.16.0.0
        First Usable: 172.16.0.1
        Last Usable:  172.16.255.254
        Broadcast:    172.16.255.255
Class C (/24)
    192.168.0.0/24
    255.255.255.0
    IP Range
        Subnet:       192.168.0.0
        First Usable: 192.168.0.1
        Last Usable:  192.168.0.254
        Broadcast:    192.168.0.255
Class ? (/?)
    192.168.47.8
    255.255.240.0

                                         |
192.168.47.8:  11000000.10101000.00101111|.00001000  192.168.47.8
Subnet:        11000000.10101000.00101111|.00000000  192.168.47.0
First Usable:  11000000.10101000.00101111|.00000001  192.168.47.1
Last Usable:   11000000.10101000.00101111|.11111110  192.168.47.254
Broadcast:     11000000.10101000.00101111|.11111111  192.168.47.255
255.255.255.0: 11111111.11111111.11111111|.00000000  255.255.255.0
                                         |
                                     |
192.168.47.8:  11000000.10101000.0010|1111.00001000  192.168.47.8
Subnet:        11000000.10101000.0010|0000.00000000  192.168.32.0
First Usable:  11000000.10101000.0010|0000.00000001  192.168.32.1
Last Usable:   11000000.10101000.0010|1111.11111110  192.168.47.254
Broadcast:     11000000.10101000.0010|1111.11111111  192.168.47.255
255.255.240.0: 11111111.11111111.1111|0000.00000000  255.255.240.0
                                     |

128 - 0
 64 - 1     32 + 8 + 4 + 2 + 1 = 47
 32 - 1     80 - 64 = 16 - 16 = 0
 16 - 1     80 = 01010000
  8 - 1     64 + 32 + 16 + 8 + 4 + 2 + 1 = 127
  4 - 1
  2 - 1
  1 - 1

80 Computers
80 = 1010000 = 80
?? = 0000000 = 0
?? = 1111111 = 127

192.168.47.0/24

                                         |
192.168.47.0:  11000000.10101000.00101111|.00000000  192.168.47.0
Subnet:        11000000.10101000.00101111|.00000000  192.168.47.0
First Usable:  11000000.10101000.00101111|.00000001  192.168.47.1
Last Usable:   11000000.10101000.00101111|.11111110  192.168.47.254
Broadcast:     11000000.10101000.00101111|.11111111  192.168.47.255
255.255.255.0: 11111111.11111111.11111111|.00000000  255.255.255.0
                                         |

Divide 192.168.47.0/24 in half
Create 192.168.47.0/25

192.168.47.0/25

                                           |
192.168.47.0:  11000000.10101000.00101111.0|0000000  192.168.47.0
Subnet:        11000000.10101000.00101111.0|0000000  192.168.47.0
First Usable:  11000000.10101000.00101111.0|0000001  192.168.47.1
Last Usable:   11000000.10101000.00101111.0|1111110  192.168.47.126
Broadcast:     11000000.10101000.00101111.0|1111111  192.168.47.127
255.255.255.?: 11111111.11111111.11111111.1|0000000  255.255.255.128
                                           |
                                           |
192.168.47.?:  11000000.10101000.00101111.1|0000000  192.168.47.128
Subnet:        11000000.10101000.00101111.1|0000000  192.168.47.128
First Usable:  11000000.10101000.00101111.1|0000001  192.168.47.129
Last Usable:   11000000.10101000.00101111.1|1111110  192.168.47.254
Broadcast:     11000000.10101000.00101111.1|1111111  192.168.47.255
255.255.255.?: 11111111.11111111.11111111.1|0000000  255.255.255.128
                                           |

Binary Bits

B
    0
    1

BB
    00
    01
    10
    11

BBB
    000
    001
    010
    011
    100
    101
    110
    111

Double the size of 192.168.47.0/24
Create 192.168.47.0/23

192.168.47.0/24

                                        |
192.168.47.0:  11000000.10101000.0010111|1.00000000  192.168.47.0
Subnet:        11000000.10101000.0010111|0.00000000  192.168.46.0
First Usable:  11000000.10101000.0010111|0.00000001  192.168.46.1
Weird IP #1:   11000000.10101000.0010111|0.11111111  192.168.46.255
Weird IP #2:   11000000.10101000.0010111|1.00000000  192.168.47.0
Last Usable:   11000000.10101000.0010111|1.11111110  192.168.47.254
Broadcast:     11000000.10101000.0010111|1.11111111  192.168.47.255
255.255.255.0: 11111111.11111111.1111111|0.00000000  255.255.254.0
                                        |

192.168.46.255
192.168.47.0

Which of the following are not valid IPs for use on a host:

192.168.0.0/24
192.168.0.53/24
192.168.0.272/24
192.168.1.0/23