(Latest Revision: 
Thu Oct 31 01:32:34 PST 2002
) 
 
Notes On Chapter Eighteen 
-- IP: Internet Protocol Addresses
 
-  18.1 Introduction 
     
     -  Here we describe the protocol software that transforms a
	  heterogeneous set of computers into an internet -- one virtual
	  network with uniform a interface.  In this chapter, we start with
	  a discussion of the addressing scheme. 
      
 -  18.2 Addresses For The Virtual Internet 
     
     -  The Internet is built "on top of" whatever the network
	  implementation is at the lower levels.  TCP/IP is designed to be
	  adaptable to any underlying network implementation. 
      -  IP addressing must be a uniform standard -- across all member
	  nets -- independent of lower level addressing schemes.  
      -  Internet routers switch IP packets based on the IP address.
          
      
 -  18.3 The IP Addressing Scheme  
     
     -   IP addresses are 4-byte, 32-bit numbers.
	    
      -  Every IP packet contains a source IP address and a destination IP
	  address.  
      
 -  18.4 The IP Address Hierarchy  
      
     -   Some initial part of an IP address
	  identifies a particular network.  The rest of the address
	  identifies a particular host interface on that network. 
	  
      -  Two different host interfaces must never be assigned the same IP
	  number.  
      
 -  18.5 Classes Of IP Addresses  
     
     -  The Internet is comprised of a large number of networks, some
	  containing a large number of hosts, and some containing smaller
	  numbers of hosts. 
      -  There are three classes of IP address to accommodate different
          sized networks.  
	  
	  -   Class A addresess are for big
	       networks with many, many hosts.  
	       
	       
	       -  The first bit of a class A address is "0".  
	       
	        -  That means that the first "octet" is 127 or less.
		    
	       
	        -  In a class A address, the first octet is the network
		    address and the other 3 octets are used for host
		    addresses.  
		    
	        -  That means there can be at most 2 to the 7th (128) class A
		    networks and almost 2 to the 24th hosts in each network.
		    That's about 16 million!  
		    
	        -  Example 18.71.0.151 (strawb.mit.edu) is a class A
		    address.  
		    
	        
	       
	   -   Class B addresses are for medium sized
	       networks.   
	       
	       -  The first two bits of a class B address are "10".  
	        -  That means that the first "octet" is between 128 and 191
	            (inclusive).  
	        -  In a class B address, the first two octets are the
		    network address and the other 2 octets are used for host
		    addresses.  
	        -  That means there can be at most 2 to the 14th (16K) class
		    B networks and almost 2 to the 16th (64K) hosts per
		    network.  
	        -  Example: 130.17.70.165 (ishi.csustan.edu) is a class B
		    address.  
	        
	       
	   -   Class C addresses are for small
	       networks.   
	       
	       -  The first three bits of a class C address are "110".
		    
	        -  That means that the first "octet" is between 192 and
		    223 (inclusive).  
	        -  In a class C address, the first three octets are the
		    network address and the last octet is used for host
		    addresses.  
	        -  That means there can be at most 2 to the 21st (2Meg)
		    class C networks and almost 2 to the 8th (256) hosts
                    per network.
		    
	        
	   
      -   There is a class of IP addresses just for
	  multicasting.   
	  
	  -  A multicast address starts "1110" so the first octet is
	       between 224 and 239 (inclusive)  
	   
      -   Addresses that start "1111" are reserved.
	  They have first octet between 240 and 255 (inclusive). 
	  
      
 -  18.6 Computing The Class Of An Address  
     
     -  A router can (very quickly) determine the class of an address by
	  looking at the first few bits.  
      
 -  18.7 Dotted Decimal Notation  
      
     -   Humans usually write IP numbers in "dotted
	  decimal" notation like "130.17.1.71".  
      -  Each decimal part stands for the value of one of the octets.
	  
      -  Note that the decimal parts have to be in the range 0..255
	  (inclusive).  
      
 
 -  18.8 Classes And Dotted Decimal Notation  
     
     -  As explained in section 18.5 of these notes, the class of an
	  address determines the possible range of values of the first
	  octet or dotted decimal part of the address.  
      
 -  18.9 Division Of The Address Space  
     
     -  As shown in section 18.5 of these notes, the class of an address
	  determines line of division between the network and host parts of
	  the address.  This in turn determines how many numbers exist for
	  class A, B, and C networks. (128, 16384, and 2,097,152).
	  
      
 -  18.10 Authority For Addresses 
     
     -  The   Internet Assigned Numbers
	  Authority (IANA) is the central authority that ensures
	  that IP network numbers are assigned uniquely in the Internet.
	  
      -  IANA delegates authority to ISP's and various groups to assign
	  numbers.  
      -  The owners of a private internet can assign whatever numbers they
	  like.  (However it is wise to do so in a manner that will allow
	  the private internet to connect to the (public) Internet in the
	  future.) 
      -  RFC 1597 has guidelines for numbering in private internets.
          
      
 -  18.11 A Classful Addressing Example 
     
     -  One chooses a class A, B, or C network address based on the
	  number of hosts that will eventually exist in the network.
	  
      -  Within a network the prefix of the IP address of each host is the
	  same.  
      -  The suffix of each host in the network is different from that of
	  all the other hosts. 
      -  Choosing a network class is problematic because the only choices
	  give capacity for ~255, ~64,000, or ~16,000,000 hosts!  
      
 -  18.12 Subnet and Classless Addressing  
     
     -  In classful addressing, prefix that denotes the network part of
          the address must have a length of one, two, or three octets --
	  i.e. eight, sixteen, or twenty-four bits. 
      -  The idea of subnet and classless addressing is to get more
	  flexibility by allowing network prefixes to have other lengths.
	  
      
 -  18.13 Address Masks  
     
     -  There is no big trick to making classless addressing work, but
	  one does need to know where the boundary is between the prefix
	  and the suffix.  If you know the address is classful, then you
	  can tell where the boundary is by looking at the first few bits
	  of the address.  (There is a predetermined rule.) 
	  
      -  With classless addressing, no "rule" tells you where the boundary
	  is.  The information is usually conveyed by using a 32-bit
	  network mask.  In the mask the bits corresponding to the prefix
	  are all ones and the other bits are zeros.  
      -  If D and (A,M) are respectively 32-bit destination address,
	  network address, and the appropriate network mask for address D,
	  then A==(D&M) if and only if D is a host in network A.  
      -  Routers use the idea above to figure out which network to route
	  packets to.  When they get a match on (D&M) with a network
	  address in the routing table, they know the packet with address D
	  must be delivered to network A.  The other information in the
	  routing table in the row containing A will tell the software
	  where to send the packet for its next hop.  
      
 -  18.14 (Classless Inter-Domain Routing) CIDR Notation  
     
     -  An "address" of this form: 128.10.43.134/20 denotes that the first
	  20 bits are the network prefix. 
      
 -  18.15 A CIDR Address Block Example 
     
     -  128.211.0.16/28 is an address with a 28-bit network prefix.  The
          address is: 
128.211.0. 0001 0000
          (It must be understood that the first three octets are written in
	  dotted-decimal notation and the last octet is expanded out in
	  binary.) The 28-bit network prefix is: 
128.211.0. 0001
      -  128.211.0.32/28 is another address with a 28-bit network prefix.
	  The address is:
128.211.0. 0010 0000
          (Note that the two addresses have different prefixes.  Therefore
	  it is clear that the two addresses can (and must) be assigned to
	  different networks.)  
      -  Since the network prefixes leave room for only four bits of host
	  suffix, there can be at most 16 hosts on either network.
	  (Actually, the all-ones suffix and the all-zeros suffix are
	  reserved.) 
      -  An ISP which has been given the class B network address
	  128.211.0.0 can use the CIDR scheme to break that address up into
	  addresses for many different networks of different sizes, by
	  making appropriate choices for the size and value of the address
	  prefix.
      
 -  18.16 CIDR Host Addresses 
     
 -  18.17 Special IP Addresses  
     
     -  A few addresses are used for special purposes.  These addresses
	  are "reserved" and cannot be assigned as a host address in the
	  normal way.    
      -  18.17.1 Network Address  
	  
	  -  A network  itself  can be referred to by the address
	       that begins with the network prefix and ends with all
	       zero's. 
	       
	   -  For example, 18 is the network part of the class A addresses
	       used in a certain network, and 18.0.0.0 may be used as the
	       address of this network. 
	       
	   -  Another example: 130.17 is the network part of a set of
	       class B addresses and 130.17.0.0 may be used to denote that
	       network. 
	   
      -  18.17.2 Directed Broadcast Address 
	  
	  -  The address that consists of "all ones" appended to the
	       network part of an address has a special meaning too.  It is
	       an address used to send a packet to all hosts on a given
	       network. 
	  
	   -  For example if the network part of the address is 130.17
	       then the address 130.17.255.255 is the address to use to
	       send a packet to every host on the 130.17 network. 
	   -  If a host outside the 130.17 network sends a packet
	       addressed to 130.17.255.255 it will travel as a single
	       packet across the Internet.  When it arrives inside the
	       130.17 network, network hardware and software will see that
	       a copy is transmitted to every host, if that network is
	       designed to support such broadcasts. 
	   -  Directed broadcast is sometimes misused intentionally or
	       unintentionally, so routers and firewalls may "filter out"
	       some or all direct broadcast packets.  (For example read
	       about 
 
smurf attacks.)
 
	   
      -  18.17.3 Limited Broadcast Address 
	  
	  -  The address consisting of all-ones (255.255.255.255) is used
	       in some special circumstances to send a broadcast addressed
	       to all hosts directly connected on the LAN.  
	   -  A booting host that does not yet know it's network's IP
	       number may use a limited broadcast to ask for information.
	       
	   
      -  18.17.4 This Computer Address 
	  
	  -  An IP address of all zero's (0.0.0.0) means "me." 
	   -  A booting host will use this address as its source address
	       when trying to discover information such as its actual IP
	       address.  (A diskless machine may have to do this, or home
	       machine that receives its IP address from an ISP server.)
	       
	   
      -  18.17.5 Loopback Address 
	  
	  -  A loopback address is a special address that a program can
	       use to communicate with another program running on the same
	       host.  
	   -  When a program uses a loopback address, the packets don't
	       get put out on the network.  They just go down the protocol
	       stack, right back up again, and then to the program assigned
	       to the destination port number.  
	   -  A loopback address is convenient for use when testing
	       network software.  The interaction between the client and
	       server, or other communicating parties can be tested on one
	       host, without requiring actual use of the network.  This is
	       expedient and it can also help isolate software-related
	       faults from network-related problems.  
	   -  Normal communication between different processes on a host
	       often uses a loopback address.  This has at least two
	       advantages:  
               
	       -  a program can use the same method to communicate with a
		    program on the local host that it uses to communicate
		    with a program on a remote host -- TCP/IP networking.
		    
	        -  By using the loopback address it can avoid the overhead
		    of actual use of the network.  This saves network
		    bandwidth and it may save in other ways such as
		    allowing the host to use a larger packet size for the
		    loopback address.  
	        
	   -  Any IP address starting with 127 is a loopback address.
	       127.0.0.1 is by far the most commonly used loopback address.
	       
	   -  Interestingly, the loopback address is "class A."  Therefore
	       there are about 16 million possible loopback addresses.
	       Does that seem excessive?  
	   
      
 -  18.18  Summary Of Special IP Addresses 
     
     
     -  0.0.0.0 -- "this computer"  
      -  130.17.0.0 -- network address  
      -  130.17.255.255 -- directed broadcast address  
      -  255.255.255.255 -- limited broadcast address (all ones)  
      -  127.0.0.1 -- loopback address  
     
      
 -  18.19 The Berkeley Broadcast Address Form  
     
     -  Unfortunately there was an error in the 4.2 version of the
	  Berkeley Standard Distribution (BSD) version of Unix.  
      -  That software incorrectly used a network address (e.g.
	  130.17.0.0) for doing directed broadcast.  
      -  The 4.2 BSD software was adopted so widely that other systems had
	  to adapt to the incorrect use of the "Berkely broadcast."  It
	  became a sort of "rogue standard."  
      -  You may see a system that uses (or tolerates) "Berkely broadcast"
	  someday, or maybe we have gotten past that.  
      
 -  18.20 Routers And The IP Addressing Principle  
     
     -  This "technicality" is sometimes important to remember:  An IP
	  address is not really assigned to a "host."  An IP address is
	  assigned to the connection between a host and the Internet.
	  
	  
      -   A router that connects two different
	  networks will have at least two IP addresses.  
      -  Usually the IP addresses of a router will all have different
	  network prefixes.  
      -   For example, on the "inside" of our campus
	  gateway, the IP address is 130.17.1.3.  On the other side, the
	  address is 137.145.203.165.  
      
 -  18.21 Multi-Homed Hosts 
     
     -  An ordinary host may be connected to more than one network as a
	  convenience.  The host may not do routing for other hosts.  Such
	  a host is said to be  multi-homed.  
      
 -  18.22 Summary