[Network week2] IP Address, Classful Addressing, Subnetting, CIDR, DHCP, NAT

Hailey·2020년 9월 21일
1

Computer Science

목록 보기
4/9

IP Address

  • Concept of IP adress
  • Classful and Classless
  • Subnet and Supernet

IP Address Assignment

  • The IP address space is managed by the Internet Assigned Numbers Authority (IANA) globally
  • 5 regional Internet registries (RIR) are ARIN, LACNIC, RIPENCC, AFRINIC and APNIC
  • Responsible for assignment to end users and local Internet service providers

Numbers

  • The number of IP addresses in version 4
    = Approximately 4.5 billion ( 2^32 )
  • Subset of these have been distributed by IANA to the RIRs in blocks of approximately 16.8 million address each (*/8)
  • Several new technologies have been adopted to mitigate an address shortage
    : Classless Inter-Domain Routing (CIDR) in 1993
    : Network address translation (NAT) in 1998
    : A new version of the Internet Protocol, IPv6, in 1998
    = Can support 3.4 x 10 ^ 38 adresses
    = The only available long-term solution to IPv4 address exhaustion

Address Depletion

  • IANA exhausted its IPv4 free pool on 3 January 2011
  • IANA issued the LAST /8 address blocks equally to the five RIRs
  • On 15 April 2011, APNIC reached the last /8
  • RIPE depleted on 14 Sep.2012
  • LACNIC depleted on Sep 2014
  • ARIN is expected to exhaust in May 2015

Global Address

  • Needs to be a way of identifying all the hosts (Global Uniqueness)
  • Ethernet address are globally unique
    : Flat structure
    : Theoretically hierarchical
  • IP addresses are hierarchical
    : Made up of several parts
  • Hierarchical Addressing
    : It is unique
    : It has hierarchy reading from bottom up or top down
    : Quick to search

Area Routing Hierarchy

  • A fixed-length AREA portion and an intra-area portion
    : For instance, 8 bits for the area and 24 bits for the intra-area address
  • If a router sees a packet not in its own area
    : It does a lookup on the "area" portion and forwards packets on
  • If a router sees a packet in its own area
    : Just believer it toe destination
  • Usually hard to determine right size of "area" field
    : Fixed length simply does not work

Address Structures in IP

  • Topological Addressing
    : Different from Ethernet addressing
    : MAC address is location-independent
    : Depends on its location in network topology
  • Can be aggregated in the routing table

Internet (IP) Address

  • IP adress is a 32-bit binary address
    : Unique and Universal
    : 2^32 = 4,294,967,296
  • Notation
  1. Binary
    10000000 00001011 00000011 00011111
  2. Dotted-decimal
    128.11.3.31

Classful Addressing

  • In real deployment
  • Five classes: Class A, B, C, D, and E
  • A, B and C for unicast and D for multicast

Net id and Host id

  • 2-layer hierarchical
    : Networks and hosts
  • Not applicable for class D and E

Network Address

  • Hosts belonged to one network has the same network address
    : Hosts in SKKU has the same network address
  • Representation
    : NetID with all hostID bytes zeros
  • The first address in the block
  • Cannot be assigned to host

Blocks in Class

  • How many hosts can be assigned in class A?
    = 2^24 = 16 X 10^6, 16 million hosts
  • Millions of class A addresses are wasted
  • Many class addresses are wasted
  • In contrast, the number of addresses class C is smaller than needs
  • Sample Internet (4 network)

Hierarchy in addressing

  • Network address is used by routers in the rest of Internet to route packets destined for network
  • To reach host on Internet, we must first reach the network and then host
    : 2-level hierarchy

Question

  • How does a router find a network address?
    : Network address can be found by applying the default mask to any address in the block
  • What is mask?
    : A bit expression to represent the number of bits for network address

Example

  • A router outside the organization receives a packet with destination address 190.240.7.91. Show how it finds the network address to route the packet
  • The router follows three steps:
  1. The router looks at the first byte of the address to find the class. It is class B.
  2. The default mask for class B is 255.255.0.0. The router ANDs this mask with the address to get 190.240.0.0.
  3. The router looks in its routing table to find out how to route this packet to this destination

Subnetting

  • One network divided into several subnetworks
    : SKKU has two campuses and two subnetworks in Seoul and in Suwon
  • Outside knows network address
    : Subnetwork address is recognized inside
    : Three levels of hierarchy (Network, Subnet, Host)

Question

  • How does a router find a subnetwork address?
    : Subnet mask
    : Routers outside use a default mask
    : Routers inside use a subnet mask
  • The number of subnets is determined by the number of extra 1s.
    : If the number of extra 1s is n, the number of subnets is 2^n

Example

  • A router inside the organization receives the same packet with destination address 190.240.33.91
  • Show how it finds the subnetwork address to route the packet
  • The router follows three steps:
  1. The router must know subnet mask
    ex. Assume it is /19
  2. The router applies the mask to the address 190.240.33.91
    : The subnet address is 190.240.32.0.
  3. The router looks in its routing table to fine how to route the packet to this destination
  • How does a router find a subnet mask?
    : Network administrator must specify

< CIDR >

Allocation Problem

  • Exhastion of the class B network address space
    : Not 2^32 addresses but the number of network classes
  • Lack of a network class of size which is appropriate for mid-sizes organizaiton
    : Class C, with maximum 254 hosts, too small
    : While class B, with maximum 65534 hosts, too large
  • Allocate blck of class C instead
    : We still need more network classes
    : Issue multiple block class C addresses by spliting class B address into multiple class addresses
    : How many class C addresses we have in the classful address?
    : How many class C addresses in the single class B address?

HOW TO SOLVE

  • Topologically allocate IP address assignment
  • Divide the world into 8 regions allocate multiple class C blocks

CIDR

  • New class C address assignment becomes meaningless becasue it introduces problem of a large routing table
    : By default, a routing table contains an entry for every network
  • Technique called Classless Interdomain Routing is introduced
    : CIDR or Supernet
  • Key concept is to allocate multiple classes of addresses in the way that allow summarization into a smaller number of routing table
    : Route aggregation
  • CIDR is based on route aggregation
    : For instance, 16 class C addresses can be summarized to a single routing entry

Subnetting VS Supernetting

  • Subnetting
    : A network address block is divided into several subnetwork blocks
  • Supernetting
    : Combine several class C blocks into a larger block
    : Attractive to organizations that need more than 256 addresses

Supernetting

  • An organization is allocated a block of class C address in 2^n with a bitwise contiguous address space
    : Achieved by using bits which belongs to the network address as hosts bits
    : Alter the default class C subnet mask such that some bit change from 1 to 0

  • Supernetting example
    : 4 class C networks appear to network outside as a single network
    11111111 11111111 111111111 00000000 (Default class C mask)
    11111111 11111111 111111100 00000000 (255.255.252.0)

Supernetting sample

  • An organization with 4 class C
  • After Supernetting
  • Changed from 4 networks to a single network with 1,022 hosts

Classless Addressing

  • Variable length of network address instead of fixed 8, 16, 24
  • The total number of 1000 hosts
    : 22 bit of network address is sufficient
    : 255.255.252.0 => 256 X 2^2 = 1024
  • ISP granted class B blocks can subdivide block of address to sell
    : The number of blocks needs to be a power of 2
  • How to specify variable network address?
    : Use subnet mask
  • Given the first address and subnet mask
    : 255.255.255.192 (mask) and 203.255.252.128 (first)
    => 203.255.252.128/26 (CIDR notation)

Example

  • A classless address is given as 167.199.170.82/27
  • The first address can be found by keeping the first 27 bits and changing the rest of bits to 0s.
  • In classful address this address is belonged to class B
  • The number of addresses in the network is 2^(32-27) = 2^5 = 32
    : Address
    167.199.170.82/27
    10100111 11000111 10101010 01010010
    : First Address
    167.199.170.64/27
    10100111 11000111 10101010 01000000
    : Last Address
    167.199.170.95/27
    10100111 11000111 10101010 01011111

Example2

  • An organization is granted a block of addresses with the beginning address 14.24.74.0/24
  • The organization needs to have 3 subblocks of addresses to use its three subnets
    : One subblock of 10 addresses
    : One subblock of 60 addresses, and
    : One subblock of 120 addresses

The first address is 14.24.74.0/24, the last address is 14.24.74.255/24 and 254 addresses

(14.24.74.192/28 *)

Special Addresses

  • This-host address
    : 0.0.0.0/32
    : Send an IP datagram but not knowing its own address to use as source

  • Limited-broadcast address
    : 255.255.255.255/32
    : A router or a host needs to send a packet to all host in a network
    : Packets cannot travel outside network

  • Private address
    : 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
    and 169.254.0.0/16

  • Loopback
    : 127.0.0.0/8
    : Packets with one of these addresses in this block as destination never leaves the host

  • Multicast
    : 224.0.0.0/4 is reserved for multicast address

Solutions to Depletion
1. Long term solution is IPv6
2. CIDR(Classress Interdomain Routing) is a possible short term solution
3. DHCP and NAT are another short term solutions

DHCP

  • Temporary, on demand, IP addresses assignments to hosts
    : A traveler in the hotel
    : ISP with 1000 granted address to service 4000 customers
  • Done automatically using Dynamic Host Configuration Protocol
    : Application-layer program
    : A client-server paradigm
    : Plug-and-play protocol
  • DHCP assumes that not more than 1/4 customers use the Internet at the same time

NAT

  • Network Address Translation
  • 4000 hosts in company want to access the Internet simultaneously
    : Use 4000 address from the private block addresses for internal communication
    : 1000 addresses for global communication
  • NAT implements a mapping between private and global addresses
    : 172.16.3.1/24 to 200.24.5.8 and vice versa
    : A router function

Address Translation

  • Outgoing packets
    : The NAT router replaces SRC address with the global NAT address
  • Incoming packets
    : The NAT router replaces DST address with private address

Translation Table

  • 172.18.3.1 to 25.8.2.10 (DST)
  • Straightforward to translate SRC for outgoing packets
  • How does the NAT know DST for incoming packets?
    : Translation table
  • 3 situations depending on the number of global IP addresses
    : Single global IP address ( One private-network host to access a given external host)
    : Pool of global IP addresses
    : Both IP addresses and port addresses

Pool of IP address

  • In case of four global IP addresses
  • 4 private-network hosts can communicate with the same external host at the same time
    : one-to-many is okay
    : No more than 4 connection made to the same destination
  • No private-network host can access 2 external hosts at the same time
    : Many-to-one is NOT okay

IP addresses and Pool addresses

  • Using TCP/UDP port number
    : Ephemeral port address must be unique in host
  • Many-to-many relationship
  • 5-column translation table
  • For incoming packet
    : 25.8.3.2 and 1401 defines private-network host
profile
Business & Software 💗🌎

0개의 댓글