Internet Protocol

Network - IP Addressing and Subnetting


IP Address

  • Layer 3 property
  • Can be set automatically or statically
  • Network and Host portion
  • 4 bytes in IPv4 - 32 bits

Network vs Host

  • a.b.c.d/x (a.b.c.d are integers) x is the network bits and remains are host
  • Example 192.168.254.0/24
  • The first 24 bits (3 bytes) are network the rest 8 are for host
  • This means we can have 2^24 (16,777,216) networks and each network has 2^8 (255) hosts
  • Also called a subnet

Subnet Mask

  • 192.168.254.0/24 is also called a subnet
  • The subnet has a mask 255.255.255.0
  • Subnet mask is used to determine whether an IP is in the same subnet

Default Gateway

  • Most networks consist of hosts and a Default Gateway
  • Host A can talk to B directly if both are in the same subnet
  • Otherwise A sends it to someone who might know, the gateway
  • The Gateway has an IP Address and each host should know its gateway