Switching, Addressing and Packet DeliveryIntroductionData communication requires more than a physical path between two devices. A network must decide how communication resources are shared, how messages are divided, how devices are identified, and how each unit of data reaches its destination. These functions are provided by switching, addressing, forwarding, and routing. Switching determines how data moves through an interconnected network. In circuit switching, a dedicated path is reserved for the duration of a session. In message switching, an entire message is stored and forwarded from one intermediate node to another. In packet switching, a message is divided into smaller packets that are forwarded independently or according to an established logical path. Addressing identifies interfaces, networks, and applications. Forwarding is the local action taken by a router when it selects the next hop for a packet. Routing is the broader process of learning, calculating, and maintaining paths through a network. Together, these mechanisms support end-to-end delivery across local networks and the Internet. Learning ObjectivesAfter studying this chapter, a student should be able to: - Compare circuit, message, and packet switching.
- Distinguish datagram and virtual-circuit packet networks.
- Explain the roles of MAC addresses, IP addresses, and port numbers.
- Calculate basic IPv4 subnet ranges and usable host addresses.
- Describe packet forwarding, routing tables, and longest-prefix matching.
- Explain how routers support end-to-end delivery.
- Evaluate practical, security, performance, and governance issues in packet-switched networks.
1. Switching as a Network-Organization FunctionA communication network contains links, switching devices, and end systems. If every device had a direct link to every other device, communication would be simple but economically and physically impractical. Switching allows many users to share a smaller number of transmission links. A switch or router receives data, examines relevant control information, and determines an outgoing interface. The exact operation depends on the network layer and switching technique. A Layer 2 Ethernet switch normally uses a MAC address table, whereas an IP router uses a routing table and the destination IP address. The principal switching techniques are summarized below. | Technique | Unit handled | Resource behavior | Main advantage | Main limitation |
|---|
| Circuit switching | Continuous bit stream or call | Dedicated path and capacity | Predictable delay after setup | Capacity is wasted during silence or idle periods | | Message switching | Entire message | Store-and-forward per message | No dedicated path required | Large storage and high delay | | Packet switching | Small packet | Shared links; statistical multiplexing | Efficient for bursty traffic | Variable delay, loss, and reordering |
1.1 Circuit SwitchingCircuit switching establishes a dedicated end-to-end circuit before data transfer begins. Traditional telephone networks used this approach. The establishment phase reserves resources on each link, the data-transfer phase carries the conversation, and a release phase removes the reservation. A circuit may be divided into time slots, as in time-division multiplexing, or frequency bands, as in frequency-division multiplexing. Once established, the circuit offers relatively stable bandwidth and delay. This property is useful for traffic requiring predictable performance. Its major weakness is inefficient utilization for bursty digital applications. A user may reserve capacity while transmitting nothing. Circuit setup also creates additional delay before the first data can be sent, and a failure on the reserved path can interrupt the session. 1.2 Message SwitchingMessage switching treats an entire message as one unit. Each intermediate node receives the complete message, stores it, determines the next link, and then forwards it. This is called store-and-forward operation. Message switching does not require a dedicated circuit. It can therefore share links efficiently, but every intermediate node must have enough storage for potentially large messages. A long message can occupy a link for an extended time and can cause substantial delay for smaller messages waiting behind it. Modern general-purpose internetworks usually prefer packet switching because packets reduce these disadvantages. 1.3 Packet SwitchingPacket switching divides a message into packets. Each packet contains a payload and a header. The header may include source and destination addresses, sequence information, a lifetime value, and error-detection information. Packets from many applications are interleaved on a link through statistical multiplexing. Unlike fixed reservation, statistical multiplexing allocates capacity when packets actually exist. This is efficient for web browsing, email, file transfer, and other bursty applications. Packet switching introduces queueing. When packets arrive faster than a link can transmit them, they wait in a buffer. If the buffer fills, packets may be discarded. Consequently, packet-switched networks commonly provide best-effort delivery: the network attempts delivery but does not promise that every packet will arrive, arrive once, or arrive in order. Reliability, when required, is often supplied by higher-layer protocols such as TCP or by the application itself. 2. Datagram and Virtual-Circuit ApproachesPacket-switched networks can be organized as datagram networks or virtual-circuit networks. 2.1 Datagram NetworksIn a datagram network, each packet is treated independently. A router examines the destination address and selects a next hop using its current forwarding information. Packets belonging to the same application flow may take different paths. The Internet Protocol is fundamentally datagram-oriented. This design supports resilience: if a link or router fails, routing protocols may calculate an alternative path. It also avoids the need to establish state for every communication session in every intermediate device. However, datagram delivery can produce variable delay, packet loss, duplication, and out-of-order arrival. Applications that need reliability, sequencing, or congestion control must obtain those services elsewhere. 2.2 Virtual-Circuit NetworksA virtual circuit is a logical path established before data packets are sent. The network assigns an identifier to the connection, and intermediate switches maintain state describing the next hop for that identifier. Packets normally follow the same logical route and may carry a short virtual-circuit label rather than a complete destination address. Virtual circuits can provide more predictable ordering and support traffic-management commitments. They can also reduce per-packet address-processing overhead. Their disadvantages include connection-establishment delay, state maintenance in network devices, and the need to repair or re-establish circuits after failures. A virtual circuit is not necessarily a physical wire. It is a logical association implemented over shared physical links. Technologies such as frame relay, Asynchronous Transfer Mode, and Multiprotocol Label Switching use concepts related to logical labels and paths, although their architectures and service models differ. | Property | Datagram | Virtual circuit |
|---|
| Setup | Usually absent | Required | | Path | May differ per packet | Normally established logically | | Router state | General forwarding information | Per-circuit state plus forwarding information | | Failure response | Alternative routing can be automatic | Circuit may require repair or re-establishment | | Ordering | Not inherently guaranteed | More naturally supported | | Example orientation | IP | Label-switched or connection-oriented networks |
3. Addressing at Different LayersA packet may pass through several kinds of identifiers. Confusing these identifiers is a common source of networking errors. 3.1 MAC AddressesA Media Access Control address identifies a network interface on a local data-link network. Ethernet frames use MAC addresses for delivery across one local link or broadcast domain. A switch learns which MAC address is reachable through each port and forwards frames accordingly. MAC addresses are local-delivery identifiers. A router normally removes the incoming data-link frame and creates a new frame for the next link. Thus, the source and destination MAC addresses usually change at every routed hop, while the source and destination IP addresses generally remain end-to-end identifiers. 3.2 IP AddressesAn IP address identifies an interface in an internetwork and contains a network-prefix component and a host or interface component. The prefix indicates the network to which the interface belongs; the remaining bits identify an interface within that prefix. IPv4 addresses are 32 bits long and are conventionally written as four decimal octets, such as 192.0.2.25. IPv6 addresses are 128 bits long and are written in hexadecimal groups, such as 2001:db8:1::25. The blocks 192.0.2.0/24 and 2001:db8::/32 are documentation ranges and should not be treated as ordinary public address assignments. An IP address is not usually a permanent identity for a person or device. Addresses may be assigned dynamically, changed when a device moves between networks, or translated by a network address translator. The address identifies a network attachment point and supports packet delivery. 3.3 Port Numbers and Application EndpointsA transport-layer port number identifies an application process or service on a host. An endpoint is commonly represented by an IP address and a port number. A TCP or UDP flow is identified by a combination of source and destination addresses and ports, together with the transport protocol. For example, a client may use a temporary source port to contact a web service at destination port 443. The IP address delivers the packet to the host; the port number helps deliver the payload to the correct process. 3.4 Name ResolutionHuman users commonly employ domain names rather than numerical addresses. The Domain Name System maps names to resource records, including IP addresses. Name resolution is logically separate from packet forwarding: DNS helps an application learn an address, while IP forwarding carries packets toward that address. 4. IPv4 Addressing and SubnettingSubnetting divides an address block into smaller networks. It improves address organization, limits broadcast scope in IPv4 local networks, and supports administrative and security boundaries. An IPv4 prefix is written in Classless Inter-Domain Routing notation as an address followed by a slash and the prefix length, for example 192.168.10.0/24. The number after the slash is the number of network-prefix bits. For a prefix length p, the number of addresses in an IPv4 block is: N = 2^(32 − p) where N is the total number of addresses and p is an integer from 0 through 32. The expression assumes a conventional binary IPv4 prefix. In a typical ordinary subnet, the network address and directed broadcast address are not assigned to hosts, so the number of conventional usable host addresses is: H = 2^(32 − p) − 2 This host formula applies to ordinary IPv4 subnets with p ≤ 30. It has important exceptions: a /31 link may be used for a point-to-point connection under specific operational conventions, and a /32 identifies one address rather than a multi-host subnet. Worked Example: Subnet RangeConsider 192.168.10.0/26. The prefix length is 26, so 6 bits remain for host addressing. Therefore: N = 2^(32 − 26) = 26 = 64 Under the ordinary host convention: H = 64 − 2 = 62 The block size is 64 addresses. The first block ranges from 192.168.10.0 through 192.168.10.63. Its network address is 192.168.10.0, its directed broadcast address is 192.168.10.63, and its conventional usable host range is 192.168.10.1 through 192.168.10.62. The next /26 block begins at 192.168.10.64 and ends at 192.168.10.127. Subnet boundaries must align with the block size; an arbitrary address such as 192.168.10.20/26 is an address within the first block, not the network address of a new /26 block. Variable-Length SubnettingVariable-length subnet masking allows different subnets to use different prefix lengths. A department requiring 100 hosts may receive a /25 block with 128 total addresses and 126 conventional usable addresses, while a point-to-point connection may use a much smaller prefix. Allocating prefixes according to actual need reduces waste and makes routing aggregation more effective. Subnetting is distinct from supernetting or route aggregation. Subnetting divides a larger block into smaller prefixes; aggregation represents several contiguous routes with one shorter prefix when their address structure and routing policy permit it. 5. Packet ForwardingForwarding is the data-plane operation performed by a router for an arriving packet. A simplified forwarding sequence is: - Receive a frame on an interface.
- Check the frame and extract the IP packet.
- Examine the destination IP address.
- Decrement the IPv4 time-to-live or update the corresponding IPv6 hop limit.
- Consult the forwarding table.
- Select the most specific matching route.
- Resolve the next-hop link-layer address when necessary.
- Encapsulate the packet in a new outgoing frame.
- Transmit it through the selected interface.
The IP packet is not normally copied unchanged at the data-link level. Each routed hop creates a new link-layer frame. The IP header may also change in controlled ways, such as the IPv4 time-to-live value and header checksum. The transport payload is intended to remain end-to-end, although middleboxes can modify traffic in practice. Longest-Prefix MatchingA forwarding table can contain multiple routes that match a destination. The router selects the route with the longest matching prefix because it represents the most specific knowledge. Suppose a table contains: | Destination prefix | Next hop |
|---|
| 10.0.0.0/8 | R1 | | 10.20.0.0/16 | R2 | | 10.20.30.0/24 | R3 | | 0.0.0.0/0 | R4 |
A packet addressed to 10.20.30.44 matches all four entries, but the /24 route is selected because it is the longest matching prefix. A packet addressed to 10.21.4.9 matches the /8 route but not the /16 or /24 routes, so R1 is selected. A packet with no more specific match uses the default route, 0.0.0.0/0, when one exists. Address Resolution on a Local NetworkWhen a host sends to a destination on its own IPv4 subnet, it resolves the destination IP address to a MAC address using Address Resolution Protocol. When the destination is on another subnet, the host resolves the MAC address of its configured default gateway instead. The router then forwards the packet toward the remote network. IPv6 uses Neighbor Discovery rather than ARP. Both mechanisms solve a local-link next-hop resolution problem; they do not replace IP routing across multiple networks. 6. Routing and End-to-End DeliveryRouting is the control-plane process that determines which paths are available. Routers may learn routes through directly connected interfaces, static configuration, or dynamic routing protocols. A static route is manually configured and is useful for simple, stable, or highly controlled environments. Dynamic protocols exchange reachability information and adapt to changes. Interior Gateway Protocols operate within an organization or autonomous system. Examples include OSPF and IS-IS, which use link-state approaches, and BGP, which exchanges inter-domain reachability according to policy. Routing protocols do not simply find the geographically shortest route; they use metrics, policies, administrative preferences, and constraints. A simplified end-to-end sequence is as follows: - An application obtains a destination address, often through DNS.
- The transport layer creates a segment and identifies the destination service by a port.
- The source host determines whether the destination is local. If not, it selects a default gateway.
- The packet is placed in a local frame using the gateway's MAC address.
- Each router performs a forwarding lookup and transmits a new frame on the next link.
- The destination host accepts the packet, delivers it to the transport protocol, and then to the application.
- Return traffic follows a separately selected reverse path; it need not use the same sequence of routers.
This layering explains why a path can be operational even when different components have different responsibilities. Ethernet delivers over a local link, IP provides internetwork addressing and forwarding, transport protocols support process-to-process communication, and applications interpret the data. 7. Performance and Reliability ConsiderationsPacket delivery performance depends on propagation, transmission, processing, and queueing delays. A useful conceptual expression for one hop is: dtotal = dprop + dtrans + dproc + dqueue Here d_total is total delay, d_prop is propagation delay through the medium, d_trans is the time required to place all packet bits on the link, d_proc is device processing delay, and d_queue is waiting time in a buffer. These quantities are measured in seconds. The expression is additive for a particular hop and can be extended across multiple hops, although queueing delay varies with traffic and must not be treated as a fixed constant. Transmission delay for a packet can be calculated as: dtrans = L / R where L is packet length in bits and R is link rate in bits per second. For example, a 12,000-bit packet sent over a 6,000,000-bit/s link has a transmission delay of 0.002 s, or 2 ms, excluding other delays. Propagation delay is determined by distance and signal speed, not by packet length. Congestion occurs when offered traffic persistently approaches or exceeds available capacity. Symptoms include increasing queueing delay, packet loss, and reduced useful throughput. Transport protocols may respond through congestion control; routers may use queue management, scheduling, traffic shaping, or quality-of-service policies. 8. Applied Case: Subnetting a University CampusBackgroundThis illustrative case concerns a university with a central data center, three academic buildings, a residence network, and a guest wireless service. The institution has been using one large IPv4 LAN. Broadcast traffic is increasing, troubleshooting is difficult, and guest devices should not directly access administrative systems. ProblemThe network team must create separate IP subnets, provide a default gateway for each, and ensure that traffic between administrative, academic, residence, and guest networks is controlled by routing and firewall policy. AnalysisThe team receives the private block 10.20.0.0/22. A /22 contains: 2^(32 − 22) = 210 = 1024 addresses. The team allocates four /24 networks, each containing 256 addresses and conventionally 254 usable host addresses: | Purpose | Subnet | Conventional usable range |
|---|
| Administration | 10.20.0.0/24 | 10.20.0.1–10.20.0.254 | | Academic buildings | 10.20.1.0/24 | 10.20.1.1–10.20.1.254 | | Residence | 10.20.2.0/24 | 10.20.2.1–10.20.2.254 | | Guest wireless | 10.20.3.0/24 | 10.20.3.1–10.20.3.254 |
The allocation is simple rather than maximally address-efficient. It leaves room for growth and makes the routing policy easy to understand. Approach and SolutionLayer 3 interfaces on a router or multilayer switch act as default gateways, such as 10.20.0.1, 10.20.1.1, 10.20.2.1, and 10.20.3.1. Hosts use the gateway corresponding to their subnet. Inter-subnet routing is enabled, but firewall rules deny guest access to administrative and internal services except for explicitly permitted resources. Guest traffic may be allowed to reach the Internet through address translation, while administrative systems use stricter egress controls. Dynamic routing advertises campus prefixes to the data center and upstream network. Route summarization can represent the four /24 networks as 10.20.0.0/22 where policy and topology permit. Monitoring records interface utilization, packet loss, route changes, and unusual traffic patterns. OutcomeBroadcast scope is reduced, faults are easier to isolate, and security policy can be applied between logical networks. The design also demonstrates that subnetting alone is not a security boundary: access control lists, firewalls, identity controls, and monitoring are still required. Learning PointsThe case shows that addressing is a design activity, not merely a numerical exercise. Prefix size must reflect capacity, growth, routing structure, and governance requirements. Routing creates reachability; security policy determines which reachable communications are permitted. 9. Challenges, Security, and GovernancePacket-switched networks provide flexibility but expose several risks. Address exhaustion and transition. IPv4 address scarcity has encouraged private addressing, Network Address Translation, and IPv6 adoption. NAT conserves public IPv4 addresses but can complicate inbound connectivity, troubleshooting, logging, and some peer-to-peer applications. IPv6 provides a much larger address space but requires dual-stack, tunneling, or translation strategies during transition. Misconfiguration. Incorrect subnet masks, duplicate addresses, missing routes, and incorrect default gateways can cause partial or complete loss of connectivity. Route leaks and incorrect redistribution can expose private networks or redirect traffic. Security threats. Attackers may spoof source addresses, scan subnets, poison local address-resolution mechanisms, overwhelm links, or exploit insecure routing sessions. Controls include ingress and egress filtering, secure management, routing authentication where supported, segmentation, encryption, least privilege, and continuous monitoring. Privacy and accountability. IP addresses and flow records can reveal location, organizational affiliation, and patterns of behavior. Network operators should define retention periods, restrict access to logs, protect monitoring data, and comply with applicable privacy and communications regulations. Logging should support accountability without collecting unnecessary personal information. Reliability. Redundant links and routers reduce single points of failure, but redundancy must be tested. A backup path that has never been exercised may fail when needed. Convergence time, asymmetric routing, capacity planning, and failure-domain separation should be included in design reviews. 10. Contemporary Developments and Best PracticesModern networks increasingly combine traditional IP routing with software-defined networking, programmable forwarding, overlays, cloud virtual networks, and automated configuration. These technologies separate or abstract the control of forwarding behavior from the physical infrastructure, but the basic concepts of addresses, prefixes, next hops, and encapsulation remain. Best practices include: - Use hierarchical addressing and summarize routes where technically and administratively appropriate.
- Document every prefix, gateway, allocation purpose, and ownership contact.
- Avoid overlapping address ranges across interconnected organizations and cloud environments.
- Apply least-privilege firewall and routing policies; do not assume that subnet separation alone provides security.
- Monitor latency, loss, utilization, route changes, and address-resolution failures.
- Use IPv6 planning rather than treating it as an afterthought.
- Authenticate and protect routing and management protocols where supported.
- Test failover, restore configurations, and review route advertisements.
- Protect logs and use them proportionately for security, reliability, and compliance.
Artificial intelligence can assist with anomaly detection, capacity forecasting, and configuration analysis. It should not be allowed to make unreviewed changes to routing or security policy. Training data, false positives, explainability, access control, and a human approval process remain important. Chapter SummarySwitching enables multiple communications to share network infrastructure. Circuit switching reserves a dedicated path, message switching stores and forwards complete messages, and packet switching divides messages into smaller units for statistical multiplexing. Packet networks may use independent datagrams or established virtual circuits. MAC addresses support local-link delivery, IP addresses support internetwork delivery, and port numbers identify application processes. IPv4 subnetting divides address space into prefixes; for an ordinary IPv4 prefix, total addresses are 2^(32 − p) and conventional usable host addresses are 2^(32 − p) − 2, subject to special cases such as /31 and /32 use. Forwarding is the router's local data-plane decision. Routing is the broader control-plane activity of learning and selecting paths. Routers use longest-prefix matching, decrement hop-lifetime fields, resolve next-hop link-layer addresses, and re-encapsulate packets on outgoing links. End-to-end delivery depends on cooperation among applications, transport protocols, IP, data-link technologies, and routing systems. Effective network design balances efficiency, scalability, reliability, security, privacy, and regulatory responsibility. Subnetting improves organization and segmentation, but it does not replace firewalls or access control. Contemporary automation and AI can support operations, but accountable human governance remains essential. Key TermsSwitching: The process of directing data through shared network infrastructure. Circuit switching: Communication using a dedicated reserved path. Message switching: Store-and-forward delivery of complete messages. Packet switching: Delivery in which messages are divided into smaller packets. Datagram: An independently routed packet. Virtual circuit: A logical, connection-oriented path established through a packet network. MAC address: A data-link identifier for a network interface. IP address: An internetwork-layer address used for logical delivery. Port number: A transport-layer identifier for an application process. Prefix: The network portion of an IP address. Subnetting: Dividing an address block into smaller networks. CIDR: Classless Inter-Domain Routing notation and allocation method. Forwarding: The local selection of an outgoing interface or next hop. Routing: The process of determining and maintaining network paths. Longest-prefix matching: Selecting the most specific matching route. Default gateway: A router used for destinations outside the local subnet. Statistical multiplexing: Sharing capacity according to the presence of traffic. NAT: Translation between address realms, commonly private and public IPv4 space. Route aggregation: Representing multiple networks with a summarized prefix. Congestion: A condition in which offered traffic creates excessive queues or loss. Review QuestionsShort Answer Questions- What is the principal difference between circuit switching and packet switching?
- Why can datagram packets arrive out of order?
- What is the function of a default gateway?
- Define longest-prefix matching.
- Distinguish an IP address from a port number.
Long Answer Questions- Compare circuit, message, and packet switching in terms of resource use, delay, reliability, and application suitability.
- Explain datagram and virtual-circuit networks, including their benefits and limitations.
- Describe the complete forwarding process performed by an IP router.
- Explain IPv4 subnetting and derive the formulas for total addresses and conventional usable host addresses.
- Discuss how routing, segmentation, firewall policy, and monitoring work together in a university network.
Analytical / Application Questions- A department is assigned 172.16.8.0/27. Calculate the total number of addresses, the conventional number of usable host addresses, the broadcast address, and the usable host range.
- A routing table contains 10.0.0.0/8, 10.40.0.0/16, and 10.40.12.0/24. Which route should be used for destination 10.40.12.77, and why?
- Design a high-level addressing and security approach for an organization with staff, servers, guest wireless, and voice devices. Explain your prefix choices, routing boundaries, and controls for protecting sensitive systems.
Multiple Choice Questions with AnswersQuestion 1Which switching method reserves a dedicated path for the duration of a communication session? A. Circuit switching B. Message switching C. Datagram packet switching D. Store-and-forward routing Correct Answer: A. Circuit switching Question 2In a datagram network, packets belonging to one flow can follow different paths because packets are: A. Assigned independent forwarding decisions B. Always transmitted in one reserved time slot C. Stored until the entire message arrives D. Identified only by port numbers Correct Answer: A. Assigned independent forwarding decisions Question 3Which identifier is primarily used for delivery across one local Ethernet network? A. MAC address B. Domain name C. TCP port number D. Autonomous-system number Correct Answer: A. MAC address Question 4How many total IPv4 addresses are in a conventional /26 block? A. 32 B. 64 C. 128 D. 256 Correct Answer: B. 64 Question 5What is the conventional number of usable host addresses in an IPv4 /26 subnet? A. -то 62 B. 64 C. 126 D. 30 Correct Answer: A. -то 62 Question 6A router has routes 10.0.0.0/8 and 10.20.0.0/16. Which route is selected for destination 10.20.5.9? A. 10.0.0.0/8 because it was learned first B. 10.20.0.0/16 because it is more specific C. Both routes simultaneously without a preference D. The default route only Correct Answer: B. 10.20.0.0/16 because it is more specific Question 7What is the main purpose of a port number? A. To identify an application process or service B. To identify the physical transmission medium C. To replace the destination IP address D. To specify the router's geographic location Correct Answer: A. To identify an application process or service Question 8Which delay component is most directly affected by packet length and link transmission rate? A. Propagation delay B. Transmission delay C. Processing delay D. Route-convergence delay Correct Answer: B. Transmission delay Question 9When a host sends to a destination outside its own IPv4 subnet, it normally places the local gateway's address in the destination field of the first frame's: A. MAC address B. IP destination address C. TCP port field D. DNS resource record Correct Answer: A. MAC address Question 10Which statement about subnetting is correct? A. It automatically encrypts all traffic between subnets B. It divides an address block into smaller logical networks C. It eliminates the need for routing D. It guarantees that guest users cannot access internal systems Correct Answer: B. It divides an address block into smaller logical networks
|