|  | 11.2 | Network-to-Network Communications
| 11.2.1 | Methods for assigning an IP address

After you have determined the addressing scheme for a network, you must choose the method for assigning addresses to hosts. There are essentially two methods for assigning IP addresses - static addressing and dynamic addressing. Regardless of which addressing scheme you use, no two interfaces can have the same IP address.

Static Addressing
If you assign IP addresses statically, you must go to each individual device and configure it with an IP address. This method requires you to keep very meticulous records, because problems can occur on the network if you use duplicate IP addresses. Some operating systems, such as Windows 95 and Windows NT, send an ARP request to check for a duplicate IP address when they attempt to initialize TCP/IP. If they discover a duplicate, the operating systems will not initialize TCP/IP and will generate an error message. Record keeping is important too, because not all operating systems identify duplicate IP addresses.

Dynamic Addressing
There are a few different methods that you can use to assign IP addresses dynamically. Examples of these are:

- Reverse Address Resolution Protocol (RARP)
  Reverse address resolution protocol (RARP) binds MAC addresses to IP addresses. This binding allows some network devices to encapsulate data before sending them out on the network. A network device such as a diskless workstation might know its MAC address, but not its IP address. Devices using RARP require that a RARP server be present on the network to answer RARP requests.

> Let's look at an example where a source device wants to send data to another device. In our example the source knows its own MAC address, but is unable to locate its own IP address in its ARP table. In order for the destination device to retrieve the data, pass it to higher layers of the OSI model, and respond to the originating device, the source must include both its MAC address and IP address. Therefore, the source initiates a process called a RARP request, which helps it detect its own IP address. The device builds a RARP request packet and sends it out on the network. To ensure that all devices see the RARP request on the network, it uses a broadcast IP address.

> RARP uses the same packet format as ARP. But in a RARP request, the MAC headers, IP headers, and "operation code" are different from an ARP request. The RARP packet format contains places for MAC addresses of both destination and source. The source IP address field is empty. The broadcast goes to all devices on the network; therefore the destination IP address will be set to all binary 1s. Workstations running RARP have codes in ROM that direct them to start the RARP process, and locate the RARP server.

- BOOTstrap Protocol (BOOTP)
  A device uses BOOTstrap protocol (BOOTP) when it starts up, to obtain an IP address. BOOTP uses UDP to carry messages; the UDP message is encapsulated in an IP datagram. A computer uses BOOTP to send a broadcast IP datagram (using a destination IP address of all 1s - 255.255.255.255). A BOOTP server receives the broadcast and then sends a broadcast. The client receives a datagram and checks the MAC address. If it finds its own MAC address in the destination address field, then it takes the IP address in that datagram. Like RARP, BOOTP operates in a client-server environment, and only requires a single packet exchange. However, unlike RARP, which only sends back a 4 octet IP address, BOOTP datagrams can include the IP address, the address of a router (default gateway), the address of a server, and a vendor-specific field. One of the problems with BOOTP is that it was not designed to provide dynamic address assignment. With BOOTP you create a configuration file that specifies the parameters for each device.

- Dynamic Host Configuration Protocol (DHCP)
  Dynamic host configuration protocol (DHCP) has been proposed as a successor to BOOTP. Unlike BOOTP, DHCP allows a host to obtain an IP address quickly and dynamically. All that is required using DHCP is a defined range of IP addresses on a DHCP server. As hosts come online they contact the DHCP server and request an address. The DHCP server chooses an address and allocates it to that host. With DHCP, the entire computer’s configuration can be obtained in one message (e.g. along with the IP address, the server can also send a subnet mask).