Internet Addressing
  1. The Internet needs a system to address individual hosts. IP host addresses are part of the Internet abstraction and determined by software.
  2. In our discussion, we will start with IP version 4 addresses, and cover version 6 at the end.
  3. IP4 Addresses.
    1. IP addresses are simply 32-bit numbers.
    2. But it is conventional to write them as four decimal values separated by dots, the values of each byte.
      Binary NumberDotted Decimal Notation
      10000001 00110100 00000110 00000000129.52.6.0
      11000000 00000101 00110000 00000011192.5.48.3
      00001010 00000010 00000000 0010010110.2.0.37
      10000000 00001010 00000010 00000011128.10.2.3
      10000000 10010001 11111111 00010100128.145.255.20
  4. Addresses are hierarchical, having a network part and a host part.
    1. Routers use the network part to address other routers.
    2. The 32-bit address is divided into network and host part.
    3. All network addresses differ.
    4. Hosts within a network differ.
    5. Different addresses are divided in different places.
    6. Sizes of the network and host parts vary, but always total 32.
  5. Where you divide them has evolved.
    1. Original design: Address classes.
      ClassPrefix
      Bits
      RangeMax NetsSuffix
      Bits
      Max Hosts
      A70-1271282416777216
      B14128-191163841665536
      C21192-22420971528256
    2. Organizations are assigned a class of addresses based on their size.
      1. Network numbers are given by their prefix with the host number zero.
      2. An on-line organization is given a specific prefix of class A, B or C, and then assigns host numbers as they like. If you are given class B net 140.45.0.0, you may assign your hosts 140.45.0.1 through 140.45.255.254. (All one and all zero host numbers are not used.)
      3. When a packet bound for 140.45.66.208 reaches router X, it knows from the first two bits that the destination network is 140.45.0.0, where a host numbered 140.45.66.208 must reside.
      4. It will send the packet through line b.
    3. Classful addressing wastes a lot of addresses.
      1. The scheme was designed before the invention of the PC, and before smart phones.
      2. Computers were large and expensive, and and a company wouldn't have all that many.
      3. And many companies will have no need of a computer network at all.
      4. Seemed like plenty of addresses at the time.
    4. To use addresses more efficiently, we now give networks with explicit sizes.
      1. The network number is still given as 32 bits, including the network number prefix and a host number of zero.
      2. The prefix size is given as a mask, a 32-bit number having 1s in the prefix part and zeros in the host part.
      3. For instance, a network with a 18-bit prefix might be given as
        Network NumberNetwork Mask
        01100101 11010011 01000000 0000000011111111 11111111 11000000 00000000
        or in decimal 101.211.64.0 / 255.255.192.0.
      4. The network number is class A, but we ignore that and use the mask, which has ten ones.
      5. Since the ones are always at the left, this is usually expressed in a shorter form: 101.211.64.0 / 10, where we just give the size of the network number instead of the mask.
      6. This called Classless Inter-Domain Routing (CIDR).
    5. This odd arrangement is intended to allow routers to quickly answer the question, “does this address belong to this network?”
      1. Combine the address with the mask using the bit-wise and operator.
      2. The ones in the mask retain their associated bit which is part of the network number.
      3. The zeros in the mask clear their associated bit which is part of the host number.
      4. If the result is the network number, it's a match. Otherwise, not.
      5. Example: Network 101.211.64.0 / 10
        1. Destination address 101.211.74.38:
          01100101 11010011 01001010 00100110
          11111111 11111111 11000000 00000000
          01100101 11010011 01000000 00000000
          The destination belongs to the network.
        2. Destination address 210.45.75.200
          11010010 00101101 01001011 11001000
          11111111 11111111 11000000 00000000
          11010010 00101101 01000000 00000000
          Not even close
        3. Destination address 101.211.250.10:
          01100101 11010011 11111010 00001010
          11111111 11111111 11000000 00000000
          01100101 11010011 11000000 00000000
          Not a match.
    6. Organizations are assigned a class of addresses based on their size.
      1. When a packet bound for 140.70.66.208 reaches router X, it tests it against all the relevant receivers, and finds that 140.70.66.208 does match 140.64.0.0/10.
      2. It will send the packet through line b.
    7. Routers need routing tables to know where to send things.
      1. Router must know, for any network, where to send the packet. For router X above, it might look like this:
        NetworkMaskLine
        101.12.0.0255.255.0.0a
        140.64.0.0255.192.0.0b
        199.56.8.0255.255.255.0b
        201.10.6.0255.255.254.0c
      2. Or more likely,
        NetworkMaskLine
        101.12.0.0255.255.0.0a
        201.10.6.0255.255.254.0c
        defaultb
      3. A default route shortens the table.
      4. If an address matches multiple entries in the routing table, the one with the longest prefix is used.
      5. Where these come from, and some other wrinkles we'll cover later.
    8. Can be used to subdivide networks
      1. The ISP perhaps retains its old class B network 130.25.0.0.
      2. This can be divided by giving smaller CIDR networks to customers.
      3. Large customers may subdivide again.
    9. A few special networks and addresses
      1. During network setup, a computer may use the address 0.0.0.0 to refer to itself.
      2. During operation, any address in the network 127.0.0.0/8 refers to the local computer. Packets sent to such an address are delivered back to the sender.
      3. The address 255.255.255.255 is the “limited broadcast,”. It allows messages to be sent to part of the local network, limited by local policy.
      4. An address with a host number of all ones is a broadcast to the indicated subnet. For instance, 220.191.255.255 is sent to all of the network 220.128.0.0/10.
      5. All broadcasts may be limited by local policy for efficiency or security reasons.
    10. Addresses are assigned to network interfaces, so a computer may have more than one at the same time if it has multiple interfaces.
      1. Routers, connected to multiple networks.
      2. High-availability: in case one net goes down.
      3. Performance: more wires, more packets.
      4. Many consumer laptops have both wireless and wired interfaces. Usually both are not activated at once, but it's quite possible. Each will have it's own IP address.
  6. IP6 addresses.
    1. IP6 addresses are 128 bits long, with the following format:
      1. Routing to a network is done on the 64-bit prefix. Network numbers are 64 bits max.
      2. The lower 64 bits designates a host on the network.
      3. The size of the global prefix size is given with the address in CIDR notation, but not reduced to a mask.
      4. Given in hex, in groups of 4 digits separated by colons: 69DC:8864:FFFF:FFFF:0000:1280:80C0A:FFFF
      5. Leading zeros can be omitted from groups.
      6. IP6 addresses usually contain large runs of zeros, which are abbreviated by a double colon:
        FF0C:0000:0000:0000:0000:0000:000A:00B1 can be written FF0C::A:B1
      7. You can only use the :: once, and it stands for enough zeros to fill up 128 bits. Using it more than once would be ambiguous.
    2. Parts
      1. An organization is assigned a global prefix, with a length, as a network number.
      2. The balance of the subnet field is for routing inside the organization's network.
      3. The interface indicates a specific computer.
        1. Originally, computed from the MAC address.
        2. Now assigned a random number to avoid tracking concerns.
        3. Number is assigned to the interface at boot time, or even at OS installation.
    3. Special networks and addresses, not assigned to an organization:
      1. The loopback address is ::1.
      2. FE80::/10 is the link local, which refers to a host on the same subnet.
      3. Usually, FE80::/64 is treated as link local, since it's hard to know what that extra 54 prefix bits should mean.
    4. Address classes.
      1. Unicast: Delivered to the single destination having the address.
      2. Anycast: Delivered to one of some number of hosts having the address.
        1. There is not difference in format; it's just a matter of how the address is routed.
        2. The same thing is often done in IP4, but it violates the IP4 standard. IETF wanted to bless it into legality in 6.
      3. Multicast, sent to all computers having that address.
        1. Another special network, ff00::/8.
        2. These exist in IP4 as well, but use beyond the local net is rare in both schemes.
  7. Current systems use something called Network Address Translation (NAT), which allows reuse of addresses. We will study this later.