Ipv4
Every node in an ipv4 network is assigned a 32bit address, unique to that network.
Networks can be divided into subnets. Two nodes that have been assigned ip-addresses
on 2x different subnets of the same network cannot communicate directly with each other.
They much first pass through a router.
Documentation
microsoft subnet docs https://support.microsoft.com/en-us/help/164015/understanding-tcp-ip-addressing-and-subnetting-basics
IP addresses
IP Addresses are made up of 4x binary numbers in the range of (0-255) (32x bits). They are divided into a prefix, and the remaining of the 32bits form the address itself.
192.168.1.100/24 = 11000000.10101000.00000001.1100100 # with 24bit prefix | | | | +------------------------+ +-----+ (24bits of netmask) (8bits of addr) 192.168.1.100/16 = 11000000.10101000.00000001.1100100 # with 16bit prefix | | | | +---------------+ +--------------+ (16bits of netmask) (16bits of addr)Reserved IP Address Ranges
127.0.0.1 # loopback address 224.0.0.0 - 239.255.255.255 # reserved for multicast (address bound to group of addresses)Non-Routable IP Address Ranges
These are routable within interior gateway protocols, but not exterior gateway protocols.
10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
Subnets
CIDR and decimal notation
Subnets are bitmasks. The 1s in the address determine which parts of the address
identify the network, and the remainder identifies the recipient.The first and last address on each subnet are reserved.
- the first is the network address
- the last is the broadcast address
There are 3x notations for netmasks:
192.168.1.1/24 # CIDR notation 255.255.255.0 # bitmask/netmask class A # (deprecated) class A/B/C IP addresses# CIDR netmask # binary num_addrs num_hosts /31 255.255.255.254 11111111.11111111.11111111.11111110 /30 255.255.255.252 11111111.11111111.11111111.11111100 4 2 /29 255.255.255.248 11111111.11111111.11111111.11111000 8 6 /28 255.255.255.240 11111111.11111111.11111111.11110000 16 14 /27 255.255.255.224 11111111.11111111.11111111.11100000 32 30 /26 255.255.255.192 11111111.11111111.11111111.11000000 64 62 /25 255.255.255.128 11111111.11111111.11111111.10000000 128 126 /24 255.255.255.0 11111111.11111111.11111111.00000000 256 254 /23 255.255.254.0 11111111.11111111.11111110.00000000 512 510 /22 255.255.252.0 11111111.11111111.11111100.00000000 1024 1022 /21 255.255.248.0 11111111.11111111.11111000.00000000 2048 2046 /20 255.255.240.0 11111111.11111111.11110000.00000000 4096 4094 /19 255.255.224.0 11111111.11111111.11100000.00000000 8192 8190 /18 255.255.192.0 11111111.11111111.11000000.00000000 16384 16382 /17 255.255.128.0 11111111.11111111.10000000.00000000 32768 32766 /16 255.255.0.0 11111111.11111111.00000000.00000000 65536 65534IP class A, B, C
Before subnets existed, there were 3 classes of IP ranges
class A, B, and C.