Ping: Testing Connectivity to Remote Host (4.3.2.3)

Ping can also be used to test the ability of a local host to communicate across an internetwork. The local host can ping an operational IPv4 host of a remote network because the router forwards the Echo Request, as shown in Figure 4-69.

A figure shows the Echo request of F0 Interface.

Figure 4-69 The Router Forwards the Echo Request out the F0 Interface

When the remote host responds, the router forwards the Echo Reply back to the local host, as shown in Figure 4-70.

A figure shows the Echo request of F1 Interface.

Figure 4-70 The Router Forwards the Echo Reply out the F1 Interface

If this ping is successful, the operation of a large piece of the internetwork can be verified. A successful ping across the internetwork confirms communication on the local network. It also confirms the operation of the router serving as the gateway, and the operation of all other routers that might be in the path between the local network and the network of the remote host.

Additionally, the functionality of the remote host can be verified. If the remote host could not communicate outside of its local network, it would not have responded.

Note

For security reasons, many network administrators limit or prohibit the entry of ICMP messages into the corporate network; therefore, the lack of a ping response could be due to security restrictions.

Traceroute: Testing the Path (4.3.2.4)

Ping is used to test connectivity between two hosts but does not provide information about the details of devices between the hosts. Traceroute (tracert) is a utility that generates a list of hops that were successfully reached along the path. This list can provide important verification and troubleshooting information. If the data reaches the destination, then the trace lists the interface of every router in the path between the hosts. If the data fails at some hop along the way, the address of the last router that responded to the trace can provide an indication of where the problem is, or where security restrictions are found.

Round-Trip Time (RTT)

Using traceroute provides round-trip time for each hop along the path and indicates if a hop fails to respond. The round-trip time is the time a packet takes to reach the remote host and for the response from the host to return. An asterisk (*) is used to indicate a lost or unacknowledged packet.

This information can be used to locate a problematic router in the path. If the display shows high response times or data losses from a particular hop, this is an indication that the resources of the router or its connections may be overloaded.

IPv4 TTL and IPv6 Hop Limit

Traceroute makes use of a function of the TTL field in IPv4 and the Hop Limit field in IPv6 in the Layer 3 headers, along with the ICMP time exceeded message.

Figures 4-71 through 4-78 demonstrate how traceroute takes advantage of TTL.

A figure shows the Traceroute of a single hop.

Figure 4-71 Traceroute with One Hop

A figure shows an instance where the I C M P time is exceeded.

Figure 4-72 Time Exceeded Replay from First Hop

A figure shows a traceroute with two hops.

Figure 4-73 Traceroute with Two Hops

A figure shows the time exceeded replay from the second hop.

Figure 4-74 Time Exceeded Replay from Second Hop

A figure shows the three hops traceroute.

Figure 4-75 Traceroute with Three Hops

A figure shows the time exceeded replay from the third hop.

Figure 4-76 Time Exceeded Replay from Third Hop

A figure shows the traceroute of four hops.

Figure 4-77 Traceroute with Four Hops

A figure shows the destination of the traceroute.

Figure 4-78 Traceroute Reaches Destination

The first sequence of messages sent from traceroute will have a TTL field value of 1 (Figure 4-71). This causes the TTL to time out the IPv4 packet at the first router. This router then responds with an ICMPv4 message (Figure 4-72). Traceroute now has the address of the first hop.

Traceroute then progressively increments the TTL field (2, 3, 4...) for each sequence of messages (Figures 4-73 through 4-76). This provides the trace with the address of each hop as the packets timeout further down the path. The TTL field continues to be increased until the destination is reached, or it is incremented to a predefined maximum.

After the final destination is reached, the host responds with either an ICMP port unreachable message or an ICMP echo reply message instead of the ICMP time exceeded message (Figures 4-77 and 4-78).

ICMP Packet Format (4.3.2.5)

ICMP is encapsulated directly into IP packets. In this sense, it is almost like a transport layer protocol, because it is encapsulated into a packet; however, it is considered to be a Layer 3 protocol. ICMP acts as a data payload within the IP packet. It has a special Header Data field, as shown in Figure 4-79.

A figure shows the datagram fields of IPv4.

Figure 4-79 IPv4 Datagram

ICMP uses message codes to differentiate between different types of ICMP messages. These are some common message codes:

  • 0: Echo reply (response to a ping)

  • 3: Destination Unreachable

  • 5: Redirect (use another route to your destination)

  • 8: Echo request (for ping)

  • 11: Time Exceeded (TTL became 0)

As you will see later in the course, a cybersecurity analyst knows that the optional ICMP Payload field can be used in an attack vector to exfiltrate data.

Address Resolution Protocol (4.4)

In this section, you will learn how the Address Resolution Protocol enables communication on a network.

MAC and IP (4.4.1)

In this topic, you will learn the roles of the MAC address and the IP address.

Destination on the Same Network (4.4.1.1)

There are two primary addresses assigned to a device on an Ethernet LAN:

  • Physical address (the MAC address): This is used for Ethernet NIC to Ethernet NIC communications on the same network.

  • Logical address (the IP address): This is used to send the packet from the original source to the final destination.

IP addresses are used to identify the address of the original source device and the final destination device. The destination IP address may be on the same IP network as the source or may be on a remote network.

Note

Most applications use DNS (Domain Name System) to determine the IP address when given a domain name such as www.cisco.com. DNS is discussed in a later chapter.

Layer 2 or physical addresses, like Ethernet MAC addresses, have a different purpose. These addresses are used to deliver the data link frame with the encapsulated IP packet from one NIC to another NIC on the same network. If the destination IP address is on the same network, the destination MAC address will be that of the destination device.

Figure 4-80 shows the Ethernet MAC addresses and IP address for PC A sending an IP packet to the file server on the same network.

A figure shows the communication between the MAC address and IP address.

Figure 4-80 Communicating on a Local Network

The Layer 2 Ethernet frame contains:

  • Destination MAC address: This is the MAC address of the file server’s Ethernet NIC.

  • Source MAC address: This is the MAC address of PC A’s Ethernet NIC.

The Layer 3 IP packet contains:

  • Source IP address: This is the IP address of the original source, PC A.

  • Destination IP address: This is the IP address of the final destination, the file server.

Destination on a Remote Network (4.4.1.2)

When the destination IP address is on a remote network, the destination MAC address will be the address of the host’s default gateway, which is the router’s NIC, as shown in Figure 4-81.

A figure shows the communication to a remote network.

Figure 4-81 Communicating to a Remote Network

Using a postal analogy, this would be similar to a person taking a letter to their local post office. All they need to do is take the letter to the post office and then it becomes the responsibility of the post office to forward the letter on towards its final destination.

Figure 4-81 shows the Ethernet MAC addresses and IPv4 addresses for PC A sending an IP packet to a file server on a remote network. Routers examine the destination IPv4 address to determine the best path to forward the IPv4 packet. This is similar to how the postal service forwards mail based on the address of the recipient.

When the router receives the Ethernet frame, it de-encapsulates the Layer 2 information. Using the destination IP address, it determines the next-hop device, and then encapsulates the IP packet in a new data link frame for the outgoing interface. Along each link in a path, an IP packet is encapsulated in a frame specific to the particular data link technology associated with that link, such as Ethernet. If the next-hop device is the final destination, the destination MAC address will be that of the device’s Ethernet NIC.

How are the IPv4 addresses of the IPv4 packets in a data flow associated with the MAC addresses on each link along the path to the destination? This is done through a process called Address Resolution Protocol (ARP).

ARP (4.4.2)

In this topic, you will learn the purpose of ARP.

Introduction to ARP (4.4.2.1)

Recall that every device with an IP address on an Ethernet network also has an Ethernet MAC address. When a device sends an Ethernet frame, it contains these two addresses:

  • Destination MAC address: The MAC address of the Ethernet NIC, which will be either the MAC address of the final destination device or the MAC address of the router.

  • Source MAC address: The MAC address of the sender’s Ethernet NIC.

To determine the destination MAC address, the device uses ARP, as shown in Figure 4-82. ARP resolves IPv4 addresses to MAC addresses, and maintains a table of mappings.

A figure shows the MAC address for H4.

Figure 4-82 H1 Needs the MAC Address for H4

ARP Functions (4.4.2.2)

When a packet is sent to the data link layer to be encapsulated into an Ethernet frame, the device refers to a table in its memory to find the MAC address that is mapped to the IPv4 address. This table is called the ARP table or the ARP cache. The ARP table is stored in the RAM of the device.

The sending device will search its ARP table for a destination IPv4 address and a corresponding MAC address. If the packet’s destination IPv4 address is on the same network as the source IPv4 address, the device will search the ARP table for the destination IPv4 address. If the destination IPv4 address is on a different network than the source IPv4 address, the device will search the ARP table for the IPv4 address of the default gateway.

In both cases, the search is for an IPv4 address and a corresponding MAC address for the device.

Each entry, or row, of the ARP table binds an IPv4 address with a MAC address. We call the relationship between the two values a map. It simply means that you can locate an IPv4 address in the table and discover the corresponding MAC address. The ARP table temporarily saves (caches) the mapping for the devices on the LAN.

If the device locates the IPv4 address, its corresponding MAC address is used as the destination MAC address in the frame. If no entry is found, then the device sends an ARP request, as shown in Figure 4-83.

A figure represents the A R P Request process.

Figure 4-83 H1 Sends an ARP Request

The destination sends an ARP reply, as shown in Figure 4-84.

A figure represents the A R P reply process.

Figure 4-84 H4 Sends an ARP Reply

Image Video 4.4.2.3: ARP Operation – ARP Request

Refer to the online course to view this video.

Image Video 4.4.2.4: ARP Operation – ARP Reply

Refer to the online course to view this video.

Image Video 4.4.2.5: ARP Role in Remote Communication

Refer to the online course to view this video.

Removing Entries from an ARP Table (4.4.2.6)

For each device, an ARP cache timer removes ARP entries that have not been used for a specified period of time. The times differ depending on the device’s operating system. For example, some Windows operating systems store ARP cache entries for 2 minutes, as shown in Figure 4-85.

A figure shows the removal of MAC-to-IP Address Mappings.

Figure 4-85 Removing MAC-to-IP Address Mappings

Commands may also be used to manually remove all or some of the entries in the ARP table. After an entry has been removed, the process for sending an ARP request and receiving an ARP reply must occur again to enter the map in the ARP table.

ARP Tables on Networking Devices (4.4.2.7)

Network hosts and routers keep ARP tables. ARP information is held in memory on these devices in what is commonly called the ARP cache. The table entries are held for a period of time until they “age out” and are automatically removed from the ARP cache. This ensures the accuracy of the mappings. Holding ARP tables in memory helps to improve network efficiency by decreasing ARP traffic.

The ARP table on a Windows PC can be displayed using the arp -a command, as shown in Example 4-3.

Example 4-3 Host ARP Table

C:\> arp -a

Interface: 192.168.1.67 --- 0xb
  Internet Address       Physical Address      Type
  192.168.1.254          64-0f-29-0d-36-91     dynamic
  192.168.1.255          ff-ff-ff-ff-ff-ff     static
  224.0.0.22             01-00-5e-00-00-16     static
  224.0.0.251            01-00-5e-00-00-fb     static
  224.0.0.252            01-00-5e-00-00-fc     static
  255.255.255.255        ff-ff-ff-ff-ff-ff     static

Interface: 10.82.253.91 --- 0x10
  Internet Address       Physical Address      Type
  10.82.253.92           64-0f-29-0d-36-91     dynamic
  224.0.0.22             01-00-5e-00-00-16     static
  224.0.0.251            01-00-5e-00-00-fb     static
  224.0.0.252            01-00-5e-00-00-fc     static
  255.255.255.255        ff-ff-ff-ff-ff-ff     static
C:\>

Image Lab 4.4.2.8: Using Wireshark to Examine Ethernet Frames

In this lab, you will complete the following objectives:

  • Part 1: Examine the Header Fields in an Ethernet II Frame

  • Part 2: Use Wireshark to Capture and Analyze Ethernet Frames

ARP Issues (4.4.3)

In this topic, you will learn how ARP requests impact network and host performance.

ARP Broadcasts (4.4.3.1)

As a broadcast frame, an ARP request is received and processed by every device on the local network. On a typical business network, these broadcasts would probably have minimal impact on network performance. However, if a large number of devices were to be powered up and all start accessing network services at the same time, there could briefly be some reduction in performance, as shown in Figure 4-86. After the devices send out the initial ARP broadcasts and have learned the necessary MAC addresses, any impact on the network will be minimized.

A figure shows the ARP broadcasts and Security process.

Figure 4-86 ARP Broadcasts and Security

ARP Spoofing (4.4.3.2)

In some cases, the use of ARP can lead to a potential security risk known as ARP spoofing or ARP poisoning. This is a technique used by an attacker to reply to an ARP request for an IPv4 address belonging to another device, such as the default gateway, as shown in Figure 4-87. The attacker sends an ARP reply with its own MAC address. The receiver of the ARP reply will add the wrong MAC address to its ARP table and send these packets to the attacker.

A figure shows the Spoofing process.

Figure 4-87 All Devices Powered On at the Same Time

ARP vulnerabilities will be discussed in more detail later in the course.

The Transport Layer (4.5)

In this section, you will learn how transport layer protocols support network functionality.

Transport Layer Characteristics (4.5.1)

In this topic, you will learn how transport layer protocols support network communication.

Transport Layer Protocol Role in Network Communication (4.5.1.1)

The transport layer is responsible for establishing a temporary communication session between two applications and delivering data between them. An application generates data that is sent from an application on a source host to an application on a destination host. This is without regard to the destination host type, the type of media over which the data must travel, the path taken by the data, the congestion on a link, or the size of the network. As shown in Figure 4-88, the transport layer is the link between the application layer and the lower layers that are responsible for network transmission.

A figure shows the transport layer serving as a link.

Figure 4-88 Enabling Applications on Devices to Communicate

Tracking Individual Conversations

At the transport layer, each set of data flowing between a source application and a destination application is known as a conversation (Figure 4-89). A host may have multiple applications that are communicating across the network simultaneously. Each of these applications communicates with one or more applications on one or more remote hosts. It is the responsibility of the transport layer to maintain and track these multiple conversations.

A figure shows the individual Conversions of tracks.

Figure 4-89 Transport Tracks Individual Conversations

Segmenting Data and Reassembling Segments

Data must be prepared to be sent across the media in manageable pieces. Most networks have a limitation on the amount of data that can be included in a single packet. Transport layer protocols have services that segment the application data into blocks that are an appropriate size. This service includes the encapsulation required on each piece of data. A header, used for reassembly, is added to each block of data. This header is used to track the data stream.

At the destination, the transport layer must be able to reconstruct the pieces of data into a complete data stream that is useful to the application layer. The protocols at the transport layer describe how the transport layer header information is used to reassemble the data pieces into streams to be passed to the application layer.

Identifying the Applications

To pass data streams to the proper applications, the transport layer must identify the target application. To accomplish this, the transport layer assigns each application an identifier called a port number. Each software process that needs to access the network is assigned a port number unique to that host.

Transport Layer Mechanisms (4.5.1.2)

Sending some types of data (for example, a streaming video) across a network, as one complete communication stream, can consume all of the available bandwidth. This will then prevent other communications from occurring at the same time. It would also make error recovery and retransmission of damaged data difficult.

Figure 4-90 shows that segmenting the data into smaller chunks enables many different communications, from many different users, to be interleaved (multiplexed) on the same network.

A figure shows the Services of Transport Layers.

Figure 4-90 Transport Layer Services

To identify each segment of data, the transport layer adds a header containing binary data organized into several fields. It is the values in these fields that enable various transport layer protocols to perform different functions in managing data communication.

The transport layer is also responsible for managing reliability requirements of a conversation. Different applications have different transport reliability requirements.

IP is concerned only with the structure, addressing, and routing of packets. IP does not specify how the delivery or transportation of the packets takes place. Transport protocols specify how to transfer messages between hosts. TCP/IP provides two transport layer protocols, Transmission Control Protocol (TCP) and User Datagram Protocol (UDP), as shown in Figure 4-91. IP uses these transport protocols to enable hosts to communicate and transfer data.

A figure shows the Protocols of Two transport layers.

Figure 4-91 Two Transport Layer Protocols

TCP is considered a reliable, full-featured transport layer protocol, which ensures that all of the data arrives at the destination. However, this requires additional fields in the TCP header, which increases the size of the packet and also increases delay. In contrast, UDP is a simpler transport layer protocol that does not provide for reliability. It therefore has fewer fields and is faster than TCP.

TCP Local and Remote Ports (4.5.1.3)

The transport layer must be able to separate and manage multiple communications with different transport requirement needs. Users expect to be able to simultaneously receive and send email and instant messages, view websites, and conduct a VoIP phone call. Each of these applications is sending and receiving data over the network at the same time, despite different reliability requirements. Additionally, data from the phone call is not directed to the web browser, and text from an instant message does not appear in an email.

TCP and UDP manage these multiple simultaneous conversations by using header fields that can uniquely identify these applications. These unique identifiers are the port numbers.

The source port number is associated with the originating application on the local host, as shown in Figure 4-92. The destination port number is associated with the destination application on the remote host.

A figure shows Port Number samples.

Figure 4-92 Port Number Examples

Source Port

The source port number is dynamically generated by the sending device to identify a conversation between two devices. This process allows multiple conversations to occur simultaneously. It is common for a device to send multiple HTTP service requests to a web server at the same time. Each separate HTTP conversation is tracked based on the source ports.

Destination Port

The client places a destination port number in the segment to tell the destination server what service is being requested, as shown in Figure 4-93.

A figure shows the requirements of the destination service request.

Figure 4-93 Mapping Application Protocols to Port Numbers

For example, when a client specifies port 80 in the destination port, the server that receives the message knows that web services are being requested. A server can offer more than one service simultaneously such as web services on port 80 at the same time that it offers File Transfer Protocol (FTP) connection establishment on port 21.

Socket Pairs (4.5.1.4)

The source and destination ports are placed within the segment, as shown in Figure 4-94.

A figure shows the source and Destination socket pairs.

Figure 4-94 Tracking Socket Pairs Between Source and Destination

The segments are then encapsulated within an IP packet. The IP packet contains the IP address of the source and destination. The combination of the source IP address and source port number, or the destination IP address and destination port number, is known as a socket. The socket is used to identify the server and service being requested by the client. A client socket might look like this, with 1099 representing the source port number: 192.168.1.5:1099

The socket on a web server might be: 192.168.1.7:80

Together, these two sockets combine to form a socket pair: 192.168.1.5:1099, 192.168.1.7:80

Sockets enable multiple processes, running on a client, to distinguish themselves from each other, and multiple connections to a server process to be distinguished from each other.

The source port number acts as a return address for the requesting application. The transport layer keeps track of this port and the application that initiated the request so that when a response is returned, it can be forwarded to the correct application.

TCP vs. UDP (4.5.1.5)

For some applications, segments must arrive in a very specific sequence to be processed successfully. With other applications, all data must be fully received before any is considered useful. In both of these instances, TCP is used as the transport protocol. Application developers must choose which transport protocol type is appropriate based on the requirements of the applications.

For example, applications such as databases, web browsers, and email clients require that all data that is sent arrives at the destination in its original condition. Any missing data could cause a corrupt communication that is either incomplete or unreadable. These applications are designed to use TCP.

TCP transport is analogous to sending packages that are tracked from source to destination. If a shipping order is broken up into several packages, a customer can check online to see the order of the delivery.

With TCP, there are three basic operations of reliability:

  • Numbering and tracking data segments transmitted to a specific host from a specific application

  • Acknowledging received data

  • Retransmitting any unacknowledged data after a certain period of time

Figures 4-95 through 4-98 demonstrate how TCP segments and acknowledgments are transmitted between sender and receiver.

A figure shows the transmission of data using T C P application.

Figure 4-95 Sending Data Using a TCP Application: FTP

A figure shows the transmission of T C P segments and acknowledgment between the sender and receiver.

Figure 4-96 Acknowledging Receipt of TCP Application Data

A figure shows the transmission of more data using T C P application.

Figure 4-97 Sending More Data Using TCP

A figure shows the transmission of more data using T C P application.

Figure 4-98 No Segments Received at Destination

In other cases, an application can tolerate some data loss during transmission over the network, but delays in transmission are unacceptable. UDP is the better choice for these applications because less network overhead is required. There is a trade-off between the value of reliability and the burden it places on network resources. Adding overhead to ensure reliability for some applications could reduce the usefulness of the application and can even be detrimental. In such cases, UDP is a better transport protocol. UDP is preferable for applications such as streaming live audio, live video, and Voice over IP (VoIP). Acknowledgments and retransmission would slow down delivery.

For example, if one or two segments of a live video stream fail to arrive, it creates a momentary disruption in the stream. This may appear as distortion in the image or sound, but may not be noticeable to the user. If the destination device had to account for lost data, the stream could be delayed while waiting for retransmissions, therefore causing the image or sound to be greatly degraded. In this case, it is better to render the best media possible with the segments received, and forego reliability.

UDP provides the basic functions for delivering data segments between the appropriate applications, with very little overhead and data checking. UDP is known as a best-effort delivery protocol. In the context of networking, best-effort delivery is referred to as “unreliable” because there is no acknowledgment that the data is received at the destination. With UDP, there are no transport layer processes that inform the sender of a successful delivery.

UDP is similar to placing a regular, non-registered, letter in the mail. The sender of the letter is not aware of the availability of the receiver to receive the letter. Nor is the post office responsible for tracking the letter or informing the sender if the letter does not arrive at the final destination.

Figures 4-99 and 4-100 demonstrate how UDP segments are transmitted from sender to receiver.

A figure shows the process of sending data using a UDP Application.

Figure 4-99 Sending Data Using a UDP Application: TFTP

A figure shows the case where no acknowledgments are sent to the client by the destination.

Figure 4-100 No Acknowledgments Sent by Destination

Figure 4-101 provides an overview and comparison of the features of TCP and UDP.

A figure shows the comparison of U D P and T C P.

Figure 4-101 Comparing UDP and TCP

Note

Applications that stream stored audio and video use TCP. For example, if your network suddenly cannot support the bandwidth needed to watch an on-demand movie, the application pauses the playback. During the pause, you might see a “buffering...” message while TCP works to re-establish the stream. When all the segments are in order and a minimum level of bandwidth is restored, your TCP session resumes and the movie continues to play.

TCP and UDP Headers (4.5.1.6)

TCP is a stateful protocol. A stateful protocol is a protocol that keeps track of the state of the communication session. To track the state of a session, TCP records which information it has sent and which information has been acknowledged. The stateful session begins with the session establishment and ends when closed with the session termination.

As shown in Figure 4-102, each TCP segment has 20 bytes of overhead in the header encapsulating the application layer data:

  • Source Port (16 bits) and Destination Port (16 bits): These are used to identify the application.

  • Sequence Number (32 bits): This is used for data reassembly purposes.

  • Acknowledgment Number (32 bits): This indicates the data that has been received.

  • Header Length (4 bits): This is known as “data offset.” It indicates the length of the TCP segment header.

A figure represents the T C P Segment headers.

Figure 4-102 TCP Segment Headers

  • Reserved (6 bits): This field is reserved for the future.

  • Control Bits (6 bits): This includes bit codes, or flags, which indicate the purpose and function of the TCP segment.

  • Window (16 bits): This indicates the number of bytes that can be accepted at one time.

  • Checksum (16 bits): This is used for error checking of the segment header and data.

  • Urgent (16 bits): This indicates if data is urgent.

There are 6 control bits:

  • URG: This indicates that the segment should be classified as urgent.

  • ACK: This indicates that the Acknowledgment Number field is significant. All segments in an established connection will have this bit set.

  • PSH: This is the push function. It indicates that the segment should not be buffered but should be sent immediately to the receiving application.

  • RST: This indicates that an unexpected condition has occurred and that the connection should be reset.

  • SYN: This is used to initiate a connection. This should only be set in the initial segments in the connection establishment phase of data communication.

  • FIN: This signals that no more data will be transferred and that the connection should be terminated.

UDP is a stateless protocol, meaning neither the client nor the server is obligated to keep track of the state of the communication session. If reliability is required when using UDP as the transport protocol, it must be handled by the application.

One of the most important requirements for delivering live video and voice over the network is that the data continues to flow quickly. Live video and voice applications can tolerate some data loss with minimal or no noticeable effect, and are perfectly suited to UDP.

The pieces of communication in UDP are called datagrams, as shown in Figure 4-103. These datagrams are sent as best-effort by the transport layer protocol. UDP has a low overhead of 8 bytes.

A figure represents the U D P segment headers.

Figure 4-103 UDP Segment Headers

Image Activity 4.5.1.7: Compare TCP and UDP Characteristics

Refer to the online course to complete this Activity.

Transport Layer Operation (4.5.2)

In this topic, you will learn how transport layer protocols operate.

TCP Port Allocation (4.5.2.1)

Each application process running on a server is configured to use a port number, either by default or manually, by a system administrator. An individual server cannot have two services assigned to the same port number within the same transport layer services.

For example, a server running a web server application and a file transfer application cannot have both configured to use the same port (for example, TCP port 80). An active server application assigned to a specific port is considered to be open. This means that the transport layer running on the server accepts and processes segments addressed to that port. Any incoming client request addressed to the correct socket is accepted, and the data is passed to the server application. There can be many ports open simultaneously on a server, one for each active server application.

When establishing a connection with a server, the transport layer on the client establishes a source port to keep track of data sent from the server. Just as a server can have many ports open for server processes, clients can have many ports open for connections to multiple sockets. Local source ports are randomly allocated from a range of numbers that is usually from 49152 to 65535. Segments sent to the client from a server will use the client port number as the destination port for data from the socket.

Refer to Figures 4-104 through 4-108 to see the typical allocation of source and destination ports in TCP client-server operations.

A figure shows the clients sending T C P requests.

Figure 4-104 Clients Sending TCP Requests

A figure shows the request destination ports.

Figure 4-105 Request Destination Ports

A figure shows the request source ports.

Figure 4-106 Request Source Ports

A figure shows the destination port response.

Figure 4-107 Response Destination Ports

A figure shows the source port response.

Figure 4-108 Response Source Ports

A TCP Session Part I: Connection Establishment and Termination (4.5.2.2)

In some cultures, when two persons meet, they often greet each other by shaking hands. The act of shaking hands is understood by both parties as a signal for a friendly greeting. Connections on the network are similar. In TCP connections, the host client establishes the connection with the server.

Connection Establishment

Hosts track each data segment within a session and exchange information about what data is received using the information in the TCP header. TCP is a full-duplex protocol, where each connection represents two one-way communication streams or sessions. To establish the connection, the hosts perform a three-way handshake. Control bits in the TCP header indicate the progress and status of the connection.

The three-way handshake accomplishes three things:

  • It establishes that the destination device is present on the network.

  • It verifies that the destination device has an active service and is accepting requests on the destination port number that the initiating client intends to use.

  • It informs the destination device that the source client intends to establish a communication session on that port number.

A TCP connection is established in three steps, as shown in Figure 4-109:

A figure shows the steps involved in T C P connection.

Figure 4-109 TCP Connection Establishment and Termination

  1. The initiating client requests a client-to-server communication session with the server.

  2. The server acknowledges the client-to-server communication session and requests a server-to-client communication session.

  3. The initiating client acknowledges the server-to-client communication session.

Connection Termination

After the communication is completed, the sessions are closed, and the connection is terminated. The connection and session mechanisms enable TCP’s reliability function.

To close a connection, the Finish (FIN) control flag must be set in the segment header. To end each one-way TCP session, a two-way handshake, consisting of a FIN segment and an Acknowledgment (ACK) segment, is used. Therefore, to terminate a single conversation supported by TCP, four exchanges are needed to end both sessions, as shown in Figure 4-110.

A figure shows the Connection termination of T C P.

Figure 4-110 TCP Session Termination (FIN)

Note

In this explanation, the terms client and server are used as a reference for simplicity, but the termination process can be initiated by any two hosts that have an open session:

  1. When the client has no more data to send in the stream, it sends a segment with the FIN flag set.

  2. The server sends an ACK to acknowledge the receipt of the FIN to terminate the session from client to server.

  3. The server sends a FIN to the client to terminate the server-to-client session.

  4. The client responds with an ACK to acknowledge the FIN from the server.

When all segments have been acknowledged, the session is closed.

The 6 bits in the Control Bits field (Figure 4-111) of the TCP segment header are also known as flags. A flag is a bit that is set to “on” or “off.” For our purposes, four flags are important: SYN, ACK, FIN, and RST. The RST flag is used to reset a connection when an error or timeout occurs.

A figure represents the fields of the Control bits.

Figure 4-111 The Control Bits Field

Image Video Demonstration 4.5.2.3: TCP 3-Way Handshake

Refer to the online course to view this video.

Image Lab 4.5.2.4: Using Wireshark to Observe the TCP 3-Way Handshake

In this lab, you will complete the following objectives:

  • Part 1: Prepare the Hosts to Capture the Traffic

  • Part 2: Analyze the Packets Using Wireshark

  • Part 3: View the Packets Using tcpdump

Image Activity 4.5.2.5: TCP Connection and Termination Process

Refer to the online course to complete this Activity.

A TCP Session Part II: Data Transfer (4.5.2.6)

TCP Ordered Delivery

TCP segments may arrive at their destination out of order. For the original message to be understood by the recipient, the data in these segments is reassembled into the original order. Sequence numbers are assigned in the header of each packet to achieve this goal. The sequence number represents the first data byte of the TCP segment.

During session setup, an initial sequence number (ISN) is set. This ISN represents the starting value of the bytes for this session that is transmitted to the receiving application. As data is transmitted during the session, the sequence number is incremented by the number of bytes that have been transmitted. This data byte tracking enables each segment to be uniquely identified and acknowledged. Missing segments can then be identified.

Note

The ISN does not begin at 1 but instead is a random number. This is to prevent certain types of malicious attacks. For simplicity, we will use an ISN of 1 for the examples in this chapter.

Segment sequence numbers indicate how to reassemble and reorder received segments, as shown in Figure 4-112.

A figure shows the reordered T C P segments.

Figure 4-112 TCP Segments Are Reordered at the Destination

The receiving TCP process places the data from a segment into a receiving buffer. Segments are placed in the proper sequence order and passed to the application layer when reassembled. Any segments that arrive with sequence numbers that are out of order are held for later processing. Then, when the segments with the missing bytes arrive, these segments are processed in order.

Flow Control

TCP also provides mechanisms for flow control, which is the amount of data that the destination can receive and process reliably. Flow control helps maintain the reliability of TCP transmission by adjusting the rate of data flow between source and destination for a given session. To accomplish this, the TCP header includes a 16-bit field called the window.

Figure 4-113 shows an example of window size and acknowledgments.

The figure shows a T C P Window Size Example.

Figure 4-113 TCP Window Size Example

The window size is the number of bytes that the destination device of a TCP session can accept and process at one time. In this example, PC B’s initial window size for the TCP session is 10,000 bytes. Starting with the first byte, byte number 1, the last byte PC A can send without receiving an acknowledgment is byte 10,000. This is known as PC A’s send window. The window size is included in every TCP segment so the destination can modify the window size at any time depending on buffer availability.

Note

In Figure 4-113, the source is transmitting 1460 bytes of data within each TCP segment. This is known as the MSS (Maximum Segment Size).

The initial window size is agreed upon when the TCP session is established during the three-way handshake. The source device must limit the number of bytes sent to the destination device based on the destination’s window size. Only after the source device receives an acknowledgment that the bytes have been received can it continue sending more data for the session. Typically, the destination will not wait for all the bytes for its window size to be received before replying with an acknowledgment. As the bytes are received and processed, the destination will send acknowledgments to inform the source that it can continue to send additional bytes.

The process of the destination sending acknowledgments as it processes bytes received and the continual adjustment of the source’s send window is known as sliding windows.

If the availability of the destination’s buffer space decreases, it may reduce its window size and inform the source to reduce the number of bytes it should send without receiving an acknowledgment.

A useful discussion of TCP sequence and acknowledgment numbers can be found here.

Image Video Demonstration 4.5.2.7: Sequence Numbers and Acknowledgments

Refer to the online course to view this video.

Image Video Demonstration 4.5.2.8: Data Loss and Retransmission

Refer to the online course to view this video.

A UDP Session (4.5.2.9)

Like segments with TCP, when UDP datagrams are sent to a destination, they often take different paths and arrive in the wrong order. UDP does not track sequence numbers the way TCP does. UDP has no way to reorder the datagrams into their transmission order.

Therefore, UDP simply reassembles the data in the order that it was received and forwards it to the application, as shown in Figure 4-114. If the data sequence is important to the application, the application must identify the proper sequence and determine how the data should be processed.

The figure shows the UDP Unreliable connections.

Figure 4-114 UDP Is Connectionless and Unreliable

Like TCP-based applications, UDP-based server applications are assigned well-known or registered port numbers, as shown in Figure 4-115.

A figure shows the listening of requests.

Figure 4-115 UDP Server Listening for Requests

When these applications or processes are running on a server, they accept the data matched with the assigned port number. When UDP receives a datagram destined for one of these ports, it forwards the application data to the appropriate application based on its port number.

Note

The Remote Authentication Dial-in User Service (RADIUS) server shown in Figure 4-115 provides authentication, authorization, and accounting services to manage user access.

As with TCP, client-server communication is initiated by a client application that requests data from a server process. The UDP client process dynamically selects a port number from the range of port numbers and uses this as the source port for the conversation. The destination port is usually the well-known or registered port number assigned to the server process.

After a client has selected the source and destination ports, the same pair of ports is used in the header of all datagrams used in the transaction. For the data returning to the client from the server, the source and destination port numbers in the datagram header are reversed.

Image Lab 4.5.2.10: Exploring Nmap

Port scanning is usually part of a reconnaissance attack. There are a variety of port scanning methods that can be used. We will explore how to use the Nmap utility. Nmap is a powerful network utility that is used for network discovery and security auditing.

Network Services (4.6)

In this section, you will learn how network services enable network functionality.

DHCP (4.6.1)

In this topic, you will learn how DHCP services enable network functionality.

DHCP Overview (4.6.1.1)

The Dynamic Host Configuration Protocol (DHCP) for IPv4 service automates the assignment of IPv4 addresses, subnet masks, gateways, and other IPv4 networking parameters. This is referred to as dynamic addressing. The alternative to dynamic addressing is static addressing. When using static addressing, the network administrator manually enters IP address information on hosts. DHCPv6 (DHCP for IPv6) provides similar services for IPv6 clients.

When an IPv4, DHCP-configured device boots up or connects to the network, the client broadcasts a DHCP discover (DHCPDISCOVER) message to identify any available DHCP servers on the network. A DHCP server replies with a DHCP offer (DHCPOFFER) message, which offers a lease to the client, as shown in Figure 4-116.

A figure shows the Dynamic Host Configuration Protocol (DHCP).

Figure 4-116 Dynamic Host Configuration Protocol (DHCP)

The offer message contains the IPv4 address and subnet mask to be assigned, the IPv4 address of the DNS server, and the IPv4 address of the default gateway. The lease offer also includes the duration of the lease.

The client may receive multiple DHCPOFFER messages if there is more than one DHCP server on the local network. Therefore, it must choose between them, and sends a DHCP request (DHCPREQUEST) message that identifies the explicit server and lease offer that the client is accepting. A client may also choose to request an address that it had previously been allocated by the server.

Assuming that the IPv4 address requested by the client, or offered by the server, is still available, the server returns a DHCP acknowledgment (DHCPACK) message that acknowledges to the client that the lease has been finalized. If the offer is no longer valid, then the selected server responds with a DHCP negative acknowledgment (DHCPNAK) message. If a DHCPNAK message is returned, then the selection process must begin again with a new DHCPDISCOVER message being transmitted. After the client has the lease, it must be renewed prior to the lease expiration through another DHCPREQUEST message. Figures 4-117 and 4-118 illustrate the steps in DHCPv4 operation.

The figure shows the lease Origination of DHCPv4.

Figure 4-117 DHCPv4 Operation: Lease Origination

A figure shows the Lease renewal of DHCPv4 Operation.

Figure 4-118 DHCPv4 Operation: Lease Renewal

The DHCP server ensures that all IP addresses are unique (the same IP address cannot be assigned to two different network devices simultaneously). Most Internet providers use DHCP to allocate addresses to their customers.

DHCPv6 has similar set of messages to those used for DHCP for IPv4. The DHCPv6 messages are SOLICIT, ADVERTISE, INFORMATION REQUEST, and REPLY.

DHCPv4 Message Format (4.6.1.2)

The DHCPv4 message format is used for all DHCPv4 transactions. DHCPv4 messages are encapsulated within the UDP transport protocol. DHCPv4 messages sent from the client use UDP source port 68 and destination port 67. DHCPv4 messages sent from the server to the client use UDP source port 67 and destination port 68.

Figure 4-119 shows the format of a DHCPv4 message with the following fields:

A figure shows DHCPv4 header fields.

Figure 4-119 DHCPv4 Header Fields

  • Operation (OP) Code: Specifies the general type of message. A value of 1 indicates a request message; a value of 2 is a reply message.

  • Hardware Type: Identifies the type of hardware used in the network. For example, 1 is Ethernet, 15 is Frame Relay, and 20 is a serial line. These are the same codes used in ARP messages.

  • Hardware Address Length: Specifies the length of the address.

  • Hops: Controls the forwarding of messages. Set to 0 by a client before transmitting a request.

  • Transaction Identifier: Used by the client to match the request with replies received from DHCPv4 servers.

  • Seconds: Identifies the number of seconds elapsed since a client began attempting to acquire or renew a lease. Used by DHCPv4 servers to prioritize replies when multiple client requests are outstanding.

  • Flags: Used by a client that does not know its IPv4 address when it sends a request. Only one of the 16 bits is used, which is the broadcast flag. A value of 1 in this field tells the DHCPv4 server or relay agent receiving the request that the reply should be sent as a broadcast.

  • Client IP Address: Used by a client during lease renewal when the address of the client is valid and usable, not during the process of acquiring an address. The client puts its own IPv4 address in this field if and only if it has a valid IPv4 address while in the bound state; otherwise, it sets the field to 0.

  • Your IP Address: Used by the server to assign an IPv4 address to the client.

  • Server IP Address: Used by the server to identify the address of the server that the client should use for the next step in the bootstrap process, which may or may not be the server sending this reply. The sending server always includes its own IPv4 address in a special field called the Server Identifier DHCPv4 option.

  • Gateway IP Address: Routes DHCPv4 messages when DHCPv4 relay agents are involved. The gateway address facilitates communications of DHCPv4 requests and replies between the client and a server that are on different subnets or networks.

  • Client Hardware Address: Specifies the physical layer of the client.

  • Server Name: Used by the server sending a DHCPOFFER or DHCPACK message. The server may optionally put its name in this field. This can be a simple text nickname or a DNS domain name, such as dhcpserver.netacad.net.

  • Boot Filename: Optionally used by a client to request a particular type of boot file in a DHCPDISCOVER message. Used by a server in a DHCPOFFER to fully specify a boot file directory and filename.

  • DHCP Options: Holds DHCP options, including several parameters required for basic DHCP operation. This field is variable in length. Both client and server may use this field.

DNS (4.6.2)

In this topic, you will learn how DNS services enable network functionality.

DNS Overview (4.6.2.1)

The web servers that we so often connect to using names like www.cisco.com are actually reached by assigning IP addresses to packets. On the Internet, these domain names are much easier for people to remember than 198.133.219.25, which is the actual numeric IP address for this server. If Cisco decides to change the numeric address of www.cisco.com, it is transparent to the user because the domain name remains the same. The new address is simply linked to the existing domain name and connectivity is maintained.

The Domain Name System (DNS) was developed to provide a reliable means of managing and providing domain names and their associated IP addresses. DNS consists of a global hierarchy of distributed servers that contain databases of name to IP address mappings. The client computer in Figure 4-120 will send a request to the DNS server to get the IP address for www.cisco.com.

A figure shows the DNS resolution of IP Addresses.

Figure 4-120 DNS Resolves Names to IP Addresses

A recent analysis of network security threats discovered that over 90% of the malicious software that is used to attack networks uses the DNS system to carry out attack campaigns. A cybersecurity analyst should have a thorough understanding of the DNS system and the ways in which malicious DNS traffic can be detected through protocol analysis and the inspection of DNS monitoring information.

The DNS Domain Hierarchy (4.6.2.2)

The DNS consists of a hierarchy of generic top-level domains (gTLDs) which consist of .com, .net, .org, .gov, .edu, and numerous country-level domains, such as .br (Brazil), .es (Spain), .uk (United Kingdom), etc. At the next level of the DNS hierarchy are second-level domains. These are represented by a domain name that is followed by a top-level domain. Subdomains are found at the next level of the DNS hierarchy and represent some division of the second-level domain. Finally, a fourth level can represent a host in a subdomain. Each element of a domain specification is sometimes called a label. The labels move from the top of the hierarchy downward from right to left. A dot (“.”) at the end of a domain name represents the root server at the top of the hierarchy. Figure 4-121 illustrates this DNS domain hierarchy.

A figure shows the Hierarchy of DNS Domain.

Figure 4-121 DNS Domain Hierarchy

The DNS Lookup Process (4.6.2.3)

To understand DNS, cybersecurity analysts should be familiar with the following terms:

  • Resolver: A DNS client that sends DNS messages to obtain information about the requested domain name space.

  • Recursion: The action taken when a DNS server is asked to query on behalf of a DNS resolver.

  • Authoritative server: A DNS server that responds to query messages with information stored in Resource Records (RRs) for a domain name space stored on the server.

  • Recursive resolver: A DNS server that recursively queries for the information asked in the DNS query.

  • FQDN: A fully qualified domain name is the absolute name of a device within the distributed DNS database.

  • RR: A resource record is a format used in DNS messages that is composed of the following fields: NAME, TYPE, CLASS, TTL, RDLENGTH, and RDATA.

  • DNS Zone: A database that contains information about the domain name space stored on an authoritative server.

When attempting to resolve a name to an IP address, a user host, known in the system as a resolver, will first check its local DNS cache. If the mapping is not found there, a query will be issued to the DNS server or servers that are configured in the network addressing properties for the resolver. These servers may be present at an enterprise or ISP. If the mapping is not found there, the DNS server will query other higher-level DNS servers that are authoritative for the top-level domain in order to find the mapping. These are known as recursive queries.

Because of the potential burden on authoritative top-level domain servers, some DNS servers in the hierarchy maintain caches of all DNS records that they have resolved for a period of time. These caching DNS servers can resolve recursive queries without forwarding the queries to higher-level servers. If a server requires data for a zone, it will request a transfer of that data from an authoritative server for that zone. The process of transferring blocks of DNS data between servers is known as a zone transfer.

Figures 4-122 through 4-127 display the steps involved in DNS resolution.

A figure shows a sample for DNS lookup process.

Figure 4-122 Example of the DNS Lookup Process

A figure shows the first step of Resolving DNS address.

Figure 4-123 Resolving DNS Addresses: Step 1

A figure shows the second step of Resolving DNS address.

Figure 4-124 Resolving DNS Addresses: Step 2

A figure shows the third step of Resolving DNS address.

Figure 4-125 Resolving DNS Addresses: Step 3

A figure shows the fourth step of Resolving DNS address. The DNS server is connected to a Client through a network, and sends the "DNS query response, 198.133.219.25” points toward the left.

Figure 4-126 Resolving DNS Addresses: Step 4

A figure shows the fifth step of Resolving DNS address. The DNS server on the left is connected to a Client through a network. The client sends a message to the network using the DNS server address: 198. 133.219. 25.

Figure 4-127 Resolving DNS Addresses: Step 5

DNS Message Format (4.6.2.4)

DNS uses UDP port 53 for DNS queries and responses. DNS queries originate at a client and responses are issued from DNS servers. If a DNS response exceeds 512 bytes, TCP port 53 is used to handle the message. It includes the format for queries, responses, and data. The DNS protocol communications use a single format called a message. This message format, shown in Figure 4-128, is used for all types of client queries and server responses, error messages, and the transfer of resource record information between servers.

A figure shows the DNA headers.

Figure 4-128 DNS Headers

The DNS server stores different types of RRs used to resolve names. These records contain the name, address, and type of record. Here is a list of some of these record types:

  • A: An end device IPv4 address

  • NS: An authoritative name server

  • AAAA: An end device IPv6 address (pronounced quad-A)

  • MX: A mail exchange record

When a client makes a query, the server’s DNS process first looks at its own records to resolve the name. If it is unable to resolve the name using its stored records, it contacts other servers to resolve the name. After a match is found and returned to the original requesting server, the server temporarily stores the numbered address in the event that the same name is requested again.

The DNS Client service on Windows PCs also stores previously resolved names in memory. The ipconfig /displaydns command displays all of the cached DNS entries.

Dynamic DNS (4.6.2.5)

DNS requires registrars to accept and distribute DNS mappings from organizations that wish to register domain name and IP address mappings. After the initial mapping has been created, a process which can take 24 hours or more, changes to the IP address that is mapped to the domain name can be made by contacting the registrar or using an online form to the make the change. However, because of the time it takes for this process to occur and the new mapping to be distributed in DNS, the change can take hours before the new mapping is available to resolvers. In situations in which an ISP is using DHCP to provide addresses to a domain, it is possible that the address that is mapped to the domain could expire and a new address be granted by the ISP. This would result in a disruption of connectivity to the domain through DNS. A new approach was necessary to allow organizations to make fast changes to the IP address that is mapped to a domain.

Dynamic DNS (DDNS) allows a user or organization to register an IP address with a domain name as in DNS. However, when the IP address of the mapping changes, the new mapping can be propagated through the DNS almost instantaneously. For this to occur, a user obtains a subdomain from a DDNS provider. That subdomain is mapped to the IP address of the user’s server, or home router connection to the Internet. Client software runs on either the router or a host PC that detects a change in the Internet IP address of the user. When a change is detected, the DDNS provider is immediately informed of the change and the mapping between the user’s subdomain and the Internet IP address is immediately updated, as shown in Figure 4-129.

A figure shows a sample for DDNS.

Figure 4-129 Example of Dynamic DNS Process

DDNS does not use a true DNS entry for a user’s IP address. Instead, it acts as an intermediary. The DDNS provider’s domain is registered with the DNS, but the subdomain is mapped to a totally different IP address. The DDNS provider service supplies that IP address to the resolver’s second level DNS server. That DNS server, either at the organization or ISP, provides the DDNS IP address to the resolver.

The WHOIS Protocol (4.6.2.6)

WHOIS is a TCP-based protocol that is used to identify the owners of Internet domains through the DNS system. When an Internet domain is registered and mapped to an IP address for the DNS system, the registrant must supply information regarding who is registering the domain. The WHOIS application uses a query, in the form of an FQDN. The query is issued through a WHOIS service or application. The official ownership registration record is returned to the user by the WHOIS service. This can be useful for identifying the destinations that have been accessed by hosts on a network. WHOIS has limitations, and hackers have ways of hiding their identities. However, WHOIS is a starting point for identifying potentially dangerous Internet locations that may have been reached through the network. An Internet-based WHOIS service is maintained by ICANN and can be reached at https://whois.icann.org/, as shown in Figure 4-130. Other WHOIS services are maintained by Regional Internet Registries such as RIPE and APNIC.

A figure shows a screenshot of the ICANN WHOIS website in a web browser.

Figure 4-130 The ICANN WHOIS Website

Image Lab 4.6.2.7: Using Wireshark to Examine a UDP DNS Capture

In this lab, you will communicate with a DNS server by sending a DNS query using the UDP transport protocol. You will use Wireshark to examine the DNS query and response exchanges with the same server.

NAT (4.6.3)

In this topic, you will learn how NAT services enable network functionality.

NAT Overview (4.6.3.1)

There are not enough public IPv4 addresses to assign a unique address to each device connected to the Internet. Networks are commonly implemented using private IPv4 addresses, as defined in RFC 1918. Table 4-5 shows the range of addresses included in RFC 1918. It is very likely that the computer that you use to view this course is assigned a private address.

Table 4-5 Private IPv4 Addresses

Class

RFC 1918 Internal Address Range

CIDR Prefix

A

10.0.0.0 to 10.255.255.255

10.0.0.0/8

B

172.16.0.0 to 172.31.255.255

172.16.0.0/12

C

192.168.0.0 to 192.168.255.255

192.168.0.0/16

These private addresses are used within an organization or site to allow devices to communicate locally. However, because these addresses do not identify any single company or organization, private IPv4 addresses cannot be routed over the Internet. To allow a device with a private IPv4 address to access devices and resources outside of the local network, the private address must first be translated to a public address, as shown in Figure 4-131.

A figure shows the translation between Private and Public IPv4 addresses.

Figure 4-131 Translating Between Private and Public IPv4 Addresses

NAT-Enabled Routers (4.6.3.2)

NAT-enabled routers can be configured with one or more valid public IPv4 addresses. These public addresses are known as the NAT pool. When an internal device sends traffic out of the network, the NAT-enabled router translates the internal IPv4 address of the device to a public address from the NAT pool. To outside devices, all traffic entering and exiting the network appears to have a public IPv4 address from the provided pool of addresses.

A NAT router typically operates at the border of a stub network. A stub network is a network that has a single connection to its neighboring network, one way in and one way out of the network. In the example in Figure 4-132, R2 is a border router. As seen from the ISP, R2 forms a stub network.

A figure shows the NAT Border.

Figure 4-132 NAT Border

When a device inside the stub network wants to communicate with a device outside of its network, the packet is forwarded to the border router. The border router performs the NAT process, translating the internal private address of the device to a public, outside, routable address.

Note

The connection to the ISP may use a private address or a public address that is shared among customers. For the purposes of this chapter, a public address is shown.

Port Address Translation (4.6.3.3)

NAT can be implemented as one-to-one static mappings of private addresses to public addresses, or many internal addresses can be mapped to a single public address. This is known as Port Address Translation (PAT). PAT is quite commonly used in home networks when an ISP provides a single public IP address to the home router. In most homes, multiple devices will require Internet access. PAT allows all of the network devices within the home network to share the single IP address that is provided by the ISP. In larger networks, PAT can be used to map many internal addresses to several public addresses as well.

With PAT, multiple addresses can be mapped to one or to a few addresses, because each private address is also tracked by a port number. When a device initiates a TCP/IP session, it generates a TCP or UDP source port value or a specially assigned query ID for ICMP, to uniquely identify the session. When the NAT router receives a packet from the client, it uses its source port number to uniquely identify the specific NAT translation. The PAT process also validates that the incoming packets were requested, thus adding a degree of security to the session.

Figure 4-133 illustrates the PAT process. PAT adds unique source port numbers to the inside global address to distinguish between translations.

A figure shows the PAT Process.

Figure 4-133 PAT Process

As R2 processes each packet, it uses a port number (1331 and 1555, in this example) to identify the device from which the packet originated. The source address (SA) is the inside local address with the TCP/IP assigned port number added. The destination address (DA) is the outside local address with the service port number added. In this example, the service port is 80, which is HTTP.

For the source address, R2 translates the private address (known as an inside local address) to an outside global public address with the port number added. The destination address is not changed, but is now referred to as the outside global IPv4 address. When the web server replies, the path is reversed.

NAT/PAT can complicate cyber-operations because it can hide addressing information in the log files created by network security and monitoring devices.

File Transfer and Sharing Services (4.6.4)

In this topic, you will learn how file transfer services enable network functionality.

FTP and TFTP (4.6.4.1)

FTP and TFTP are two commonly used file transfer protocols.

File Transfer Protocol (FTP)

FTP is another commonly used application layer protocol. FTP was developed to allow for data transfers between a client and a server. An FTP client is an application that runs on a computer that is used to push and pull data from an FTP server.

As Figure 4-134 illustrates, to successfully transfer data, FTP requires two connections between the client and the server, one for commands and replies, the other for the actual file transfer:

A figure shows the FTP Process.

Figure 4-134 FTP Process

  1. The client establishes the first connection to the server for control traffic using TCP port 21, consisting of client commands and server replies.

  2. The client establishes the second connection to the server for the actual data transfer using TCP port 20. This connection is created every time there is data to be transferred.

The data transfer can happen in either direction. The client can download (pull) data from the server, or the client can upload (push) data to the server.

FTP was not designed to be a secure application layer protocol. For this reason, SSH File Transfer Protocol, which is a secure form of FTP that uses the Secure Shell protocol to provide a secure channel, is the preferred file transfer implementation.

Trivial File Transfer Protocol (TFTP)

TFTP is a simplified file transfer protocol that uses the well-known UDP port number 69. It lacks many of the features of FTP, such as the file management operations of listing, deleting, or renaming files. Because of its simplicity, TFTP has a very low network overhead and is popular for non-critical file transfer applications. It is fundamentally insecure, however, because it has no login or access control features. For this reason, TFTP needs to implemented carefully, and only when absolutely necessary.

SMB (4.6.4.2)

The Server Message Block (SMB) is a client/server file sharing protocol that describes the structure of shared network resources, such as directories, files, printers, and serial ports, as shown in Figure 4-135. It is a request-response protocol. All SMB messages share a common format. This format uses a fixed-sized header, followed by a variable-sized parameter and data component.

A figure shows the SMB Protocol.

Figure 4-135 SMB Protocol

SMB messages can start, authenticate, and terminate sessions, control file and printer access, and allow an application to send or receive messages to or from another device.

SMB file sharing and print services have become the mainstay of Microsoft networking, as shown in Figure 4-136.

A figure shows the SMB File sharing. Two PCs are connected through a network. A set of files from one PC is copied to the other and the action is labeled "Copy File."

Figure 4-136 SMB File Sharing

Image Lab 4.6.4.3: Using Wireshark to Examine TCP and UDP Captures

In this lab, you will complete the following objectives:

  • Identify TCP header fields and operation using a Wireshark FTP session capture

  • Identify UDP header fields and operation using a Wireshark TFTP session capture

Email (4.6.5)

In this topic, you will learn how email services enable network functionality.

Email Overview (4.6.5.1)

Email is an essential network application. To run on a computer or other end device, it requires several applications and services, as shown in Figure 4-137. Email is a store-and-forward method of sending, storing, and retrieving electronic messages across a network. Email messages are stored in databases on mail servers.

The figure shows a sample for an Email process.

Figure 4-137 Example of the Email Process

Email clients communicate with mail servers to send and receive email. Mail servers communicate with other mail servers to transport messages from one domain to another. An email client does not communicate directly with another email client when sending email. Instead, both clients rely on the mail server to transport messages.

Email supports three separate protocols for operation: Simple Mail Transfer Protocol (SMTP), Post Office Protocol version 3 (POP3), and Internet Message Access Protocol (IMAP). The application layer process that sends mail uses SMTP. A client retrieves email, however, using one of the two application layer protocols: POP3 or IMAP.

SMTP (4.6.5.2)

SMTP message formats require a message header and a message body. While the message body can contain any amount of text, the message header must have a properly formatted recipient email address and a sender address.

When a client sends email, the client SMTP process connects with a server SMTP process on well-known port 25. After the connection is made, the client attempts to send the email to the server across the connection. When the server receives the message, it either places the message in a local account, if the recipient is local, or forwards the message to another mail server for delivery, as shown in Figure 4-138.

A figure shows the SMTP Process.

Figure 4-138 SMTP Process

The destination email server may not be online or may be busy when email messages are sent. Therefore, SMTP spools messages to be sent at a later time. Periodically, the server checks the queue for messages and attempts to send them again. If the message is still not delivered after a predetermined expiration time, it is returned to the sender as undeliverable.

POP3 (4.6.5.3)

POP3 is used by an application to retrieve mail from a mail server. With POP3, mail is downloaded from the server to the client and then deleted on the server, as shown in Figure 4-139.

A figure shows the POP3 Process.

Figure 4-139 POP3 Process

The server starts the POP3 service by passively listening on TCP port 110 for client connection requests. When a client wants to make use of the service, it sends a request to establish a TCP connection with the server. When the connection is established, the POP3 server sends a greeting. The client and POP3 server then exchange commands and responses until the connection is closed or aborted.

With POP3, email messages are downloaded to the client and removed from the server, so there is no centralized location where email messages are kept. Because POP3 does not store messages, it is undesirable for a small business that needs a centralized backup solution.

IMAP (4.6.5.4)

IMAP is another protocol that describes a method to retrieve email messages, as shown in Figure 4-140.

A figure shows an IMAP Process.

Figure 4-140 IMAP Process

Unlike POP3, when the user connects to an IMAP-capable server, copies of the messages are downloaded to the client application. The original messages are kept on the server until manually deleted. Users view copies of the messages in their email client software.

Users can create a file hierarchy on the server to organize and store mail. That file structure is duplicated on the email client as well. When a user decides to delete a message, the server synchronizes that action and deletes the message from the server.

HTTP (4.6.6)

In this topic, you will learn how HTTP services enable network functionality.

HTTP Overview (4.6.6.1)

To better understand how the web browser and web server interact, we can examine how a web page is opened in a browser. For this example, use the URL http://www.cisco.com, as shown in Figure 4-141.

A figure shows a sample topology for HTTP. A client connects to an HTTP server through a Network using the URL: "http://www.cisco.com."

Figure 4-141 HTTP Example Topology

First, the browser interprets the three parts of the URL:

  • http (the protocol or scheme)

  • www.cisco.com (the server name)

  • index.html (the default home page is requested)

Note

Web servers typically display the home page, index.html, as the default page if no other page is specified. You do not need to enter the full path including the /index.html. If fact, you can simply enter cisco.com. Regardless of whether you enter cisco.com, www.cisco.com, or www.cisco.com/index.html, the web server will display the same home page, index.html.

As shown in Figure 4-142, the browser then checks with a name server to convert www.cisco.com into a numeric IP address, which it uses to connect to the server.

A figure shows the Step 1 of HTTP Process.

Figure 4-142 HTTP Process: Step 1

Using HTTP requirements, the browser sends a GET request to the server and asks for the index.html file. The server, as shown in Figure 4-143, sends the HTML code for this web page to the browser.

A figure shows the Step 2 of HTTP Process.

Figure 4-143 HTTP Process: Step 2

Finally, as shown in Figure 4-144, the browser deciphers the HTML code and formats the page for the browser window.

A figure shows the Step 3 of HTTP Process. A nHTTP server is connected to a Client system through a network. The Client System now has access to the Web Page.

Figure 4-144 HTTP Process: Step 3

The HTTP URL (4.6.6.2)

An HTTP URL can also specify the port on the server that should handle the HTTP methods. In addition, it can specify a query string and fragment. The query string typically contains information that is not handled by the HTTP server process itself, but is instead handled by another process that is running on the server. Query strings are preceded by a “?” character and typically consist of a series of name and value pairs. A fragment is preceded by a “#” character. It refers to a subordinate part of the resource that is requested in the URL. For example, a fragment could refer to a named anchor in an HTML document. The URL will access the document and then move to the part of the document specified by the fragment if a matching named anchor link exists in the document. An HTTP URL that includes these parts is shown in Figure 4-145.

A figure shows the parts of a URL.

Figure 4-145 Parts of a URL

The HTTP Protocol (4.6.6.3)

HTTP is a request/response protocol that uses TCP port 80, although other ports can be used. When a client, typically a web browser, sends a request to a web server, it will use one of five methods that are specified by the HTTP protocol:

  • GET: A client request for data. A client (web browser) sends the GET message to the web server to request HTML pages, as shown in Figure 4-146.

    A figure illustrates the process of HTTP using GET.

    Figure 4-146 HTTP Using GET

  • POST: Submits data to be processed by a resource.

  • PUT: Uploads resources or content to the web server such as an image.

  • DELETE: Deletes the resource specified.

  • OPTIONS: Returns the HTTP methods that the server supports.

  • CONNECT: Requests that an HTTP proxy server forward the HTTP TCP session to the desired destination.

Although HTTP is remarkably flexible, it is not a secure protocol. The request messages send information to the server in plaintext that can be intercepted and read. The server responses, typically HTML pages, are also unencrypted.

Securing HTTP

For secure communication across the Internet, the HTTP Secure (HTTPS) protocol is used. HTTPS uses TCP port 443. HTTPS uses authentication and encryption to secure data as it travels between the client and server. HTTPS uses the same client request–server response process as HTTP, but the data stream is encrypted with Secure Sockets Layer (SSL), or Transport Layer Security (TLS), before being transported across the network. Although SSL is the predecessor to TLS, both protocols are often referred to as SSL.

Much confidential information, such as passwords, credit card information, and medical information, is transmitted over the Internet using HTTPS.

HTTP Status Codes (4.6.6.4)

The HTTP server responses are identified with various status codes that inform the host application of the outcome of client requests to the server. The codes are organized into five groups. The codes are numeric, with the first number in the code indicating the type of message. The five status code groups are:

  • 1xx: Informational

  • 2xx: Success

  • 3xx: Redirection

  • 4xx: Client Error

  • 5xx: Server Error

An explanation of some common status codes is shown in Table 4-6.

Table 4-6 Some Common HTTP Status Codes

Code

Status

Meaning

1xx - Informational

100

Continue

The client should continue with request. Server has verified that the request can be fulfilled.

2xx - Success

200

OK

The request completed successfully.

202

Accepted

The request has been accepted for processing, but processing is not completed.

4xx - Client Error

403

Forbidden

The request is understood by the server, but the resource will not be fulfilled, possibly because the requester is not authorized to view the resource.

404

Not Found

The server cannot find the requested resource.

Image Lab 4.6.6.5: Using Wireshark to Examine HTTP and HTTPS Traffic

In this lab, you will complete the following objectives:

  • Capture and view HTTP traffic

  • Capture and view HTTPS traffic

Summary (4.7)

In this chapter, you learned the basic operation of network protocols and services. Networks come in all sizes, from small, home office networks to the Internet. Protocols are the rules for how traffic is sent across networks. Networking engineers use two models to understand and communicate the operation of protocols: the OSI model and the TCP/IP model. Regardless of the model used, the process of encapsulation describes how data is formatted for transmission across the network so that the destination can receive and de-encapsulate the data.

Ethernet operates at Layer 2 of the OSI model. Ethernet is responsible for encapsulating the upper layer data in a frame, which includes source and destination MAC addresses. MAC addresses are used on the LAN to locate either the destination or the default gateway.

IP operates at Layer 3 of the OSI model. IP comes in two versions: IPv4 and IPv6. Although IPv4 is being replaced by IPv6, IPv4 is still prevalent on today’s networks. IPv4 uses a 32-bit address space represented in dotted-decimal format, such as 192.168.1.1. IPv6 uses a 128-bit address space represented in hexadecimal format. In IPv6, you can omit leading zeros in each hextet and omit one “all zeros” segment, such as 2001:0DB8:0000:1111:0000:0000:0000:0200 represented as 2001:DB8:0:1111::200.

ICMP is used primarily for testing end-to-end connectivity from source to destination. ICMP for IPv4 is different than ICMP for IPv6. ICMP for IPv6 includes router and neighbor solicitations, router and neighbor advertisements, and duplicate address detection. The ping and traceroute utilities both use a feature of ICMP. Ping is used to test connectivity between two hosts but does not provide information about the details of devices between the hosts. Traceroute (tracert) is a utility that generates a list of hops that were successfully reached along the path.

ARP operates between Layer 2 and Layer 3, mapping MAC addresses to IP addresses. Before a host can send traffic to a remote network, it must know the MAC address for the default gateway. The host already knows the IP address for the default gateway. For example, a host with an IP address 192.168.1.10 might have a default gateway configured of 192.168.1.1. The host uses an ARP request to ask “Who is 192.168.1.1?” The default gateway will reply with its own MAC address. At that point, the host has mapped the IP address to the default gateway’s MAC address and can now construct the frame to send data to a remote network.

The transport layer is responsible for separating the data from the application layer into segments that can be sent down to the network layer. TCP is the transport layer protocol used when all the data must arrive at the destination in the correct order. UDP is the transport layer protocol used when the application can tolerate some data loss during transmission.

At the application layer, there are several important network services that the cybersecurity analysts should be aware of:

  • DHCP: This automates the assignment of IPv4 addresses, subnet masks, gateways, and other IPv4 networking parameters.

  • DNS: This provides a reliable means of managing and providing domain names and their associated IP addresses.

  • NAT: This translates between private and public IPv4 addresses.

  • File Transfer: Applications such as FTP, TFTP, and SMB can be used to transfer files from one host to another.

  • Email: This requires several applications and services including POP3, IMAP, and SMTP.

  • HTTP: This protocol is used to send and receive web pages.

Practice

The following activities provide practice with the topics introduced in this chapter. The Labs are available in the companion CCNA Cybersecurity Operations Lab Manual (ISBN: 9781587134388).

Image Labs

Lab 4.1.1.7: Tracing a Route

Lab 4.1.2.10: Introduction to Wireshark

Lab 4.4.2.8: Using Wireshark to Examine Ethernet Frames

Lab 4.5.2.4: Using Wireshark to Observe the TCP 3-Way Handshake

Lab 4.5.2.10: Exploring Nmap

Lab 4.6.2.7: Using Wireshark to Examine a UDP DNS Capture

Lab 4.6.4.3: Using Wireshark to Examine TCP and UDP Captures

Lab 4.6.6.5: Using Wireshark to Examine HTTP and HTTPS Traffic

Check Your Understanding

Complete all the review questions listed here to test your understanding of the topics and concepts in this chapter. The appendix “Answers to ‘Check Your Understanding’ Questions” lists the answers.

1. Which message does an IPv4 host use to reply when it receives a DHCPOFFER message from a DHCP server?

  1. DHCPACK

  2. DHCPREQUEST

  3. DHCPDISCOVER

  4. DHCPOFFER

2. What OSI layer is responsible for establishing a temporary communication session between two applications and ensuring that transmitted data can be reassembled in proper sequence?

  1. Session

  2. Transport

  3. Network

  4. Data link

3. PC1 and PC3 are on different networks separated by a router, RT1. PC1 issues an ARP request because it needs to send a packet to PC3. In this scenario, what will happen next?

  1. RT1 will forward the ARP request to PC3.

  2. RT1 will drop the ARP request.

  3. RT1 will send an ARP reply with its own MAC address.

  4. RT1 will send an ARP reply with the PC3 MAC address.

4. What addresses are mapped by ARP?

  1. Destination IPv4 address to the source MAC address

  2. Destination IPv4 address to the destination hostname

  3. Destination MAC address to the source IPv4 address

  4. Destination MAC address to a destination IPv4 address

5. Which statement is true about FTP?

  1. The client can download data from or upload data to the server.

  2. The client can choose if FTP is going to establish one or two connections with the server.

  3. FTP is a peer-to-peer application.

  4. FTP does not provide reliability during data transmission.

6. Which two OSI model layers have the same functionality as two layers of the TCP/IP model? (Choose two.)

  1. Session

  2. Transport

  3. Network

  4. Data link

  5. Physical

7. Which statement is true about the TCP/IP and OSI models?

  1. The TCP/IP transport layer and OSI Layer 4 provide similar services and functions.

  2. The TCP/IP network access layer has similar functions to the OSI network layer.

  3. The OSI Layer 7 and the TCP/IP application layer provide identical functions.

  4. The first three OSI layers describe general services that are also provided by the TCP/IP Internet layer.

8. What is the most compressed representation of the IPv6 address 2001:0000:0000:abcd:0000:0000:0000:0001?

  1. 2001::abcd::1

  2. 2001:0:abcd::1

  3. 2001::abcd:0:1

  4. 2001:0:0:abcd::1

  5. 2001:0000:abcd::1

9. What three application layer protocols are part of the TCP/IP protocol suite? (Choose three.)

  1. ARP

  2. DHCP

  3. DNS

  4. FTP

  5. NAT

  6. PPP

10. If the default gateway is configured incorrectly on the host, what is the impact on communications?

  1. The host is unable to communicate on the local network.

  2. There is no impact on communications.

  3. The host can communicate with other hosts on remote networks, but is unable to communicate with hosts on the local network.

  4. The host can communicate with other hosts on the local network, but is unable to communicate with hosts on remote networks.

11. Which message delivery option is used when all devices need to receive the same message simultaneously?

  1. Duplex

  2. Unicast

  3. Multicast

  4. Broadcast

CCNA Cybersecurity Operations Companion Guide
titlepage.xhtml
part0000.html
part0001.html
part0002.html
part0003.html
part0004.html
part0005.html
part0006.html
part0007.html
part0008.html
part0009.html
part0010.html
part0011_split_000.html
part0011_split_001.html
part0012.html
part0013.html
part0014.html
part0015.html
part0016.html
part0017.html
part0018.html
part0019.html
part0020.html
part0021.html
part0022.html
part0023_split_000.html
part0023_split_001.html
part0023_split_002.html
part0024.html
part0025.html
part0026_split_000.html
part0026_split_001.html
part0026_split_002.html
part0026_split_003.html
part0026_split_004.html
part0026_split_005.html
part0026_split_006.html
part0026_split_007.html
part0026_split_008.html
part0026_split_009.html
part0026_split_010.html
part0026_split_011.html
part0026_split_012.html
part0026_split_013.html
part0026_split_014.html
part0027_split_000.html
part0027_split_001.html
part0027_split_002.html
part0027_split_003.html
part0027_split_004.html
part0027_split_005.html
part0027_split_006.html
part0027_split_007.html
part0027_split_008.html
part0027_split_009.html
part0027_split_010.html
part0027_split_011.html
part0027_split_012.html
part0027_split_013.html
part0027_split_014.html
part0027_split_015.html
part0027_split_016.html
part0027_split_017.html
part0027_split_018.html
part0027_split_019.html
part0027_split_020.html
part0027_split_021.html
part0027_split_022.html
part0027_split_023.html
part0027_split_024.html
part0027_split_025.html
part0027_split_026.html
part0027_split_027.html
part0027_split_028.html
part0027_split_029.html
part0027_split_030.html
part0027_split_031.html
part0027_split_032.html
part0027_split_033.html
part0027_split_034.html
part0027_split_035.html
part0027_split_036.html
part0027_split_037.html
part0027_split_038.html
part0027_split_039.html
part0027_split_040.html
part0027_split_041.html
part0027_split_042.html
part0028_split_000.html
part0028_split_001.html
part0028_split_002.html
part0028_split_003.html
part0028_split_004.html
part0029_split_000.html
part0029_split_001.html
part0030_split_000.html
part0030_split_001.html
part0030_split_002.html
part0030_split_003.html
part0030_split_004.html
part0030_split_005.html
part0030_split_006.html
part0030_split_007.html
part0030_split_008.html
part0031_split_000.html
part0031_split_001.html
part0031_split_002.html