IP Addressing and Routing Exercises
Ejercicio 14: Find the block if one of the addresses is 190.87.140.202/29. Solution: The number of addresses is 2^(32-29) = 8. The first address is 190.87.140.200/29, the last address is 190.87.140.207/29.
Ejercicio 15: An organization is granted the block 130.34.12.64/26. The organization needs to have four subnets. What are the subnet addresses and the range of addresses for each subnet? Solution: The suffix length is 6. This means the total number of addresses in the block is 64 (2^6). If we create four subnets, each subnet will have 16 addresses. Let us first find the subnet prefix (subnet mask). We need 4 subnets, which means we need to add two more 1s to the site prefix. The subnet prefix is then /28.
- Subnet 1: 130.34.12.64/28 to 130.34.12.79/28
- Subnet 2 : 130.34.12.80/28 to 130.34.12.95/28
- Subnet 3: 130.34.12.96/28 to 130.34.12.111/28
- Subnet 4: 130.34.12.112/28 to 130.34.12.127/28
Ejercicio 16: An organization is granted a block of addresses with the beginning address 14.24.74.0/24. There are 2^(32−24)= 256 addresses in this block. The organization needs to have 11 subnets as shown below:
- two subnets, each with 64 addresses.
- two subnets, each with 32 addresses.
- three subnets, each with 16 addresses.
- four subnets, each with 4 addresses.
Design the subnets: The first 128 addresses are used for the first two subnets, each with 64 addresses. The mask for each network is /26. The subnet address for each subnet is given in the figure. Use the next 64 addresses for the next two subnets, each with 32 addresses. The mask for each network is /27. The subnet address for each subnet is given in the figure. Use the next 48 addresses for the next three subnets, each with 16 addresses. The mask for each network is /28. The subnet address for each subnet is given in the figure. Use the last 16 addresses for the last four subnets, each with 4 addresses. The mask for each network is /30. The subnet address for each subnet is given in the figure.
Loopback address: ::1/128
Compatible address:
Mapped address:
Unique local unicast address:
Link local address:
Multicast address:
Global unicast address:
Mapping for EUI-64:
Mapping for Ethernet MAC:
Proceso host origen:
Services Provided at the Source Computer
The network layer receives several pieces of information from the upper layer: Data, Length of data, Logical destination address, Protocol ID (the identifier of the protocol using the network layer), Service type. The network layer processes these pieces of information to create a set of fragmented datagrams and the next-hop MAC address and delivered them to the data link layer.
Ejercicio 27: Figure 6.8 shows an imaginary part of the Internet. Show the routing tables for router R1.
Ejercicio 28: Router R1 in Figure 6.8 receives a packet with destination address 192.16.7.14. Show how the packet is forwarded.
Solución: la red de destino es clase C. Extraemos la dirección de red con la máscara por defecto de C, el resultado es 192.16.7.0. Se busca la tabla para la clase C. La dirección de red se encuentra en la primera línea. La próxima dirección de salto 111.15.17.32 y la intergaz m0 se pasan al protocolo ARP.
Ejercicio 29: Router R1 in Figure 6.8 receives a packet with destination address 167.24.160.5. Show how the packet is forwarded. Solución: La clase es B, extraemos la dirección de red con la máscara por defecto de B, el resultado es 167.24.0.0. Se busca la tabla de clase B, no se encuentra coincidencia de dirección, el paquete necesita ser direccionado al router por defecto, la próxima dirección de salto 111.30.31.18 y la interfaz m0 se pasan al protocolo ARP.
Figure 6.11 shows a router connected to four subnets. Note several points. First, the site address is 145.14.0.0/16 (a class B address). Every packet with destination address in the range 145.14.0.0 to 145.14.255.255 is delivered to the interface m4 and distributed to the final destination subnet by the router. Second, we have used the address x.y.z.t/n for the interface m4 because we do not know to which network this router is connected. Third, the table has a default entry for packets that are to be sent out of the site. The router is configured to apply the mask /18 to any destination address.
Ejercicio 30: The router in Figure 6.11 receives a packet with destination address 145.14.32.78. Show how the packet is forwarded. Solution: The mask is /18. After applying the mask, the subnet address is 145.14.0.0. The packet is delivered to ARP with the next-hop address 145.14.32.78 and the outgoing interface m0.
Ejercicio 31: A host in network 145.14.0.0 in Figure 6.11 has a packet to send to the host with address 7.22.67.91. Show how the packet is routed. Solution: The router receives the packet and applies the mask (/18). The network address is 7.22.64.0. The table is searched and the address is not found. The router uses the address of the default router (not shown in figure) and sends the packet to that router.
Ejercicio 32: Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 180.70.65.140. Solution: The router performs the following steps:
- The first mask (/26) is applied to the destination address. The result is 180.70.65.128, which does not match the corresponding network address.
- The second mask (/25) is applied to the destination address. The result is 180.70.65.128, which matches the corresponding network address. The next-hop address (the destination address of the packet in this case) and the interface number m0 are passed to ARP for further processing.
Ejercicio 33: Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 201.4.22.35. Solution: The router performs the following steps:
- The first mask (/26) is applied to the destination address. The result is 201.4.22.0, which does not match the corresponding network address (row 1).
- The second mask (/25) is applied to the destination address. The result is 201.4.22.0, which does not match the corresponding network address (row 2).
- The third mask (/24) is applied to the destination address. The result is 201.4.22.0, which matches the corresponding network address.
Ejercicio 34: Show the forwarding process if a packet arrives at R1 in Figure 6.13 with the destination address 18.24.32.78. Solution: This time all masks are applied to the destination address, but no matching network address is found. When it reaches the end of the table, the module gives the next-hop address 180.70.65.200 and interface number m2 to ARP (see Chapter 8). This is probably an outgoing package that needs to be sent, via the default router, to someplace else in the Internet.
Ejercicio 36: As an Exercise of hierarchical routing, let us consider Figure 6.17. A regional ISP is granted 16384 addresses starting from 120.14.64.0. The regional ISP has decided to divide this block into four subblocks, each with 4096 addresses. Three of these subblocks are assigned to three local ISPs, the second subblock is reserved for future use. Note that the mask for each block is /20 because the original block with mask /18 is divided into 4 blocks. The first local ISP has divided its assigned subblock into 8 smaller blocks and assigned each to a small ISP. Each small ISP provides services to 128 households (H001 to H128), each using four addresses. Note that the mask for each small ISP is now /23 because the block is further divided into 8 blocks. Each household has a mask of /30, because a household has only 4 addresses (2^(32−30) is 4). The second local ISP has divided its block into 4 blocks and has assigned the addresses to 4 large organizations (LOrg01 to LOrg04). Note that each large organization has 1024 addresses and the mask is /22. The third local ISP has divided its block into 16 blocks and assigned each block to a small organization (SOrg01 to SOrg15). Each small organization has 256 addresses and the mask is /24. There is a sense of hierarchy in this configuration. All routers in the Internet send a packet with destination address 120.14.64.0 to 120.14.127.255 to the regional ISP. The regional ISP sends every packet with destination address 120.14.64.0 to 120.14.79.255 to Local ISP1. Local ISP1 sends every packet with destination address 120.14.64.0 to 120.14.64.3 to H001.
ARP: asocia una dirección lógica con su dirección física.
Ejercicio 37: A host with IP address 130.23.43.20 and physical address B2:34:55:10:22:10 has a packet to send to another host with IP address 130.23.43.25 and physical address A4:6E:F4:59:83:AB (which is unknown to the first host). The two hosts are on the same Ethernet network. Show the ARP request and reply packets encapsulated in Ethernet frames.
Ejercicio 38 continuación: Fifteen seconds later, the ARP input module receives an ARP packet with target protocol (IP) address 188.11.8.71. The module checks the table and finds this address. It changes the state of the entry to RESOLVED and sets the time-out value to 900. The module then adds the target hardware address (E34573242ACA) to the entry. Now it accesses queue 18 and sends all the packets in this queue, one by one, to the data link layer. The new cache table is shown in Table 7.3
Twenty-five seconds later, the cache-control module updates every entry. The time-out values for the first three resolved entries are decremented by 60. The time-out value for the last resolved entry is decremented by 25. The state of the next-to-the last entry is changed to FREE because the time-out is zero. For each of the three pending entries, the value of the attempts.
Ejercicio 38 continuación: Fifteen seconds later, the ARP input module receives an ARP packet with target protocol (IP) address 188.11.8.71. The module checks the table and finds this address. It changes the state of the entry to RESOLVED and sets the time-out value to 900. The module then adds the target hardware address (E34573242ACA) to the entry. Now it accesses queue 18 and sends all the packets in this queue, one by one, to the data link layer. The new cache table is shown in Table 7.3
Twenty-five seconds later, the cache-control module updates every entry. The time-out values for the first three resolved entries are decremented by 60. The time-out value for the last resolved entry is decremented by 25. The state of the next-to-the last entry is changed to FREE because the time-out is zero. For each of the three pending entries, the value of the attempts.
Parameter-problem: A parameter-problem message can be created by a router or the destination host.
Redirection message: A host usually starts with a small routing table that is gradually augmented and updated. One of the tools to accomplish this is the redirection message. A redirection message is sent from a router to a host on the same local network.
Echo: An echo-request message can be sent by a host or router. An echo-reply message is sent by the host or router which receives an echo-request message. Echo-request and echo-reply messages can be used by network managers to check the operation of the IP protocol. Echo-request and echo-reply messages can test the reachability of a host. This is usually done by invoking the ping command.
Time-stamp: Timestamp-request and timestampreply messages can be used to calculate the round-trip time between a source and a destination machine even if their clocks are not synchronized. The timestamp-request and timestampreply messages can be used to synchronize two clocks in two machines if the exact one-way time duration is known.
Mask request:
Router solicitation:
Router advertisement:
Ejercicio 40: An IP packet has arrived with the first 8 bits as shown: 0100 0010 The receiver discards the packet. Why? There is an error in this packet. The 4 left-most bits (0100) show the version, which is correct. The next 4 bits (0010) show the header length, which means (2 × 4 = 8), which is wrong. The minimum number of bytes in the header must be 20. The packet has been corrupted in transmission.
Ejercicio 41: In an IP packet, the value of HLEN is 1000 in binary. How many bytes of options are being carried by this packet? The HLEN value is 8, which means the total number of bytes in the header is 8 × 4 or 32 bytes. The first 20 bytes are the main header, the next 12 bytes are the options.
Ejercicio 42: In an IP packet, the value of HLEN is 5 base 16 and the value of the total length field is 0028 base 16. How many bytes of data are being carried by this packet? Solution: The HLEN value is 5, which means the total number of bytes in the header is 5 × 4 or 20 bytes (no options). The total length is 40 bytes, which means the packet is carrying 20 bytes of data (40-20).
Ejercicio 43: An IP packet has arrived with the first few hexadecimal digits as shown below: 4 5 00 0028 00010000 01 02………. How many hops can this packet travel before being dropped? The data belong to what upper layer protocol? To find the time-to-live field, we should skip 8 bytes (16 hexadecimal digits). The time-to-live field is the ninth byte, which is 01. This means the packet can travel only one hop. The protocol field is the next byte (02), which means that the upper layer protocol is IGMP.
Ejercicio 44: A packet has arrived with an M bit value of 0. Is this the first fragment, the last fragment, or a middle fragment? Do we know if the packet was fragmented? If the M bit is 0, it means that there are no more fragments; the fragment is the last one. However, we cannot say if the original packet was fragmented or not. A nonfragmented packet is considered the last fragment.
Ejercicio 45: A packet has arrived with an M bit value of 1. Is this the first fragment, the last fragment, or a middle fragment? Do we know if the packet was fragmented? If the M bit is 1, it means that there is at least one more fragment. This fragment can be the first one or a middle one, but not the last one. We don’t know if it is the first one or a middle one; we need more information (the value of the fragmentation offset). However, we can definitely say the original packet has been fragmented because the M bit value is 1.
Ejercicio 46: A packet has arrived with an M bit value of 1 and a fragmentation offset value of zero. Is this the first fragment, the last fragment, or a middle fragment? Because the M bit is 1, it is either the first fragment or a middle one. Because the offset value is 0, it is the first fragment.
Ejercicio 47: A packet has arrived in which the offset value is 100. What is the number of the first byte? Do we know the number of the last byte? To find the number of the first byte, we multiply the offset value by 8. This means that the first byte number is 800. We cannot determine the number of the last byte unless we know the length of the data.
Ejercicio 48: A packet has arrived in which the offset value is 100, the value of HLEN is 5 and the value of the total length field is 100. What is the number of the first byte and the last byte? The first byte number is 100 × 8 = 800. The total length is 100 bytes and the header length is 20 bytes (5 × 4), which means that there are 80 bytes in this datagram. If the first byte number is 800, the last byte number must be 879.
Ejercicio 49: Which of the six options must be copied to each fragment? We look at the first (left-most) bit of the code for each option.
- No operation: Code is 00000001; no copy.
- End of option: Code is 00000000; no copy.
- Record route: Code is 00000111; no copy.
- Strict source route: Code is 10001001; copied.
- Loose source route: Code is 10000011; copied.
- Timestamp: Code is 01000100; no copy.
Ejercicio 50: Which of the six options are used for datagram control and which are used for debugging and management? Solution: We look at the second and third (left-most) bits of the code.
- No operation: Code is 00000001; control.
- End of option: Code is 00000000; control.
- Record route: Code is 00000111; control.
- Strict source route: Code is 10001001; control.
- Loose source route: Code is 10000011; control.
- Timestamp: Code is 01000100; debugging.
Ejercicio 51: Assume that, in a Stop-and-Wait system, the bandwidth of the line is 1 Mbps, and 1 bit takes 20 milliseconds to make a round trip. What is the bandwidth-delay product? If the system data packets are 1,000 bits in length, what is the utilization percentage of the link? Solution The bandwidth-delay product is (1 × 106) × (20 × 10−3) = 20,000 bits. The system can send 20,000 bits during the time it takes for the data to go from the sender to the receiver and the acknowledgment to come back. However, the system sends only 1,000 bits. We can say that the link utilization is only 1,000/20,000, or 5 percent. For this reason, for a link with a high bandwidth or long delay, the use of Stop-and-Wait wastes the capacity of the link.
Ejercicio 52: What is the utilization percentage of the link in exercise 13.5 if we have a protocol that can send up to 15 packets before stopping and worrying about the acknowledgments? Solution The bandwidth-delay product is still 20,000 bits. The system can send up to 15 packets or 15,000 bits during a round trip. This means the utilization is 15,000/20,000, or 75 percent. Of course, if there are damaged packets, the utilization percentage is much less because packets have to be resent.
Traceroute:
El número de la primera columna es el número de salto, posteriormente viene el nombre y la dirección IP del nodo por el que pasa, los tres tiempos siguientes son el tiempo de respuesta para los paquetes enviados (un asterisco indica que no se obtuvo respuesta).
Estas herramientas (traceroute y tracert) son órdenes ejecutables en una consola en modo texto.
Tracert utiliza el campo Time To Live (TTL) de la cabecera IP. Este campo sirve para que un paquete no permanezca en la red de forma indefinida (por ejemplo, debido a la existencia en la red de un bucle cerrado en la ruta). El campo TTL es un número entero que es decrementado por cada nodo por el que pasa el paquete. De esta forma, cuando el campo TTL llega al valor 0 ya no se reenviará más, sino que el nodo que lo esté manejando en ese momento lo descartará. Lo que hace tracert es mandar paquetes a la red de forma que el primer paquete lleve un valor TTL=1, el segundo un TTL=2, etc. De esta forma, el primer paquete será eliminado por el primer nodo al que llegue (ya que éste nodo decrementará el valor TTL, llegando a cero). Cuando un nodo elimina un paquete, envía al emisor un mensaje de control especial indicando una incidencia. Tracert usa esta respuesta para averiguar la dirección IP del nodo que desechó el paquete, que será el primer nodo de la red. La segunda vez que se manda un paquete, el TTL vale 2, por lo que pasará el primer nodo y llegará al segundo, donde será descartado, devolviendo de nuevo un mensaje de control. Esto se hace de forma sucesiva hasta que el paquete llega a su destino.
Permite conocer las rutas entre un origen y un destino. Se basa en mensajes genéricos ICMP (no específicos como en ping), y básicamente explota dos errores:
El tiempo de vida agotado: El router, si el valor del campo TTL (tiempo de vida restante) es cero, elimina el paquete, pero lo notifica al originador del mismo mediante un mensaje ICMP.
Puerto inalcanzable: cuando una estación recibe un datagrama UDP o segmento TCP destinado a un puerto que la máquina no escucha (espera sin recibir respuesta), ésta lo notifica con un mensaje de error.
Así traceroute lo que hace es enviar paquetes al destino con TTL secuencialmente ascendentes, de modo que cada router enviará un mensaje de tiempo de vida agotado. Al llegar al destino nos dará el mensaje de puerto inalcanzable, porque traceroute dirige expresamente el paquete a un puerto no usado.
Ping:
Como programa, ping es una utilidad diagnóstica1 en redes de computadoras que comprueba el estado de la comunicación del host local con uno o varios equipos remotos de una red aIP por medio del envío de paquetes ICMP de solicitud y de respuesta.2 Mediante esta utilidad puede diagnosticarse el estado, velocidad y calidad de una red determinada.3
Ejecutando Ping de solicitud, el Host local envía un mensaje ICMP, incrustado en un paquete IP. El mensaje ICMP de solicitud incluye, además del tipo de mensaje y el código del mismo, un número identificador y una secuencia de números, de 32 bits, que deberán coincidir con el mensaje ICMP de respuesta; además de un espacio opcional para datos.
Muchas veces se utiliza para medir la latencia o tiempo que tardan en comunicarse dos puntos remotos, y por ello, se utiliza el término PING para referirse al lag o latencia de la conexión en los juegos en red.
Existe otro tipo, Ping ATM, que se utiliza en las redes ATM, y en este caso, las tramas que se transmiten son ATM (nivel 2 del modelo OSI). Este tipo de paquetes se envían para probar si los enlaces ATM están correctamente definidos.
ICMP libramiento fiable: por ejemplo, cada router que reenvía un datagrama IP tiene que disminuir el campo de tiempo de vida (TTL) de la cabecera IP en una unidad; si el TTL llega a 0, un mensaje ICMP “Tiempo de Vida se ha excedido en transmitirse” es enviado a la fuente del datagrama. Cada mensaje ICMP es encapsulado directamente en un solo datagrama IP, y por tanto no garantiza la entrega del ICMP. Aunque los mensajes ICMP son contenidos dentro de datagramas estándar IP, los mensajes ICMP se procesan como un caso especial del procesamiento normal de IP, algo así como el procesamiento de un sub-protocolo de IP. En muchos casos es necesario inspeccionar el contenido del mensaje ICMP y entregar el mensaje apropiado de error a la aplicación que generó el paquete IP original, aquel que solicitó el envío del mensaje ICMP. Debido a que el protocolo IP no es fiable puede darse el caso de que un mensaje ICMP se pierda o se dañe. Si esto llega a ocurrir no se creará un nuevo mensaje ICMP sino que el primero se descartará sin más.
Información redundante router: TTL, direcciones.
Paquete IP:
Checksum:
Go-Back-N: In the Go-Back-N Protocol, the sequence numbers are modulo 2^m, where m is the size of the sequence number field in bits. In the Go-Back-N protocol, the acknowledgment number is cumulative and defines the sequence number of the next packet expected to arrive. The send window is an abstract concept defining an imaginary box of maximum size = 2^m − 1 with three variables. The send window can slide one or more slots when an error-free ACK with ackNo between Sf and Sn (in modular arithmetic) arrives. The receive window is an abstract concept defining an imaginary box of size 1 with one single variable Rn. The window slides when a correct packet has arrived; sliding occurs one slot at a time. In the Go-Back-N protocol, the size of the send window must be less than 2^m; the size of the receive window is always 1.
Selective-repeat: In the Selective-Repeat protocol, an acknowledgment number defines the sequence number of the error-free packet received. In Selective-Repeat, the size of the sender and receiver window can be at most one-half of 2^m. Ventana emisor y receptor = 2^(m-1)