Communicating with the system under different subnet within a LAN using TCP
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
When dealing with a local area network (LAN), it is common to encounter devices allocated in different subnets. Communicating between these devices using Transmission Control Protocol (TCP) requires an understanding of both IP addressing and TCP/IP networking fundamentals. Here, we delve into the necessary technical background and practical steps to communicate with systems across different subnets within a LAN.
Understanding IP Addresses and Subnetting
The Internet Protocol (IP) address is a numerical label assigned to each device connected to a computer network that uses the IP for communication. An IP address serves two main functions: host or network interface identification and location addressing. IP addresses are divided into several classes, and for the purpose of general networking, Class C is often utilized within LAN environments.
Subnetting is the process of dividing a network into two or more smaller networks. It increases the efficiency of IP addressing by better managing the available address space. Each subnet within a LAN can efficiently contain a specific number of hosts, reducing broadcast traffic and segmenting network traffic more effectively.
Example of Subnetting
Suppose a LAN uses the network, where the /24 indicates that the first 24 bits are the network part, leaving the last 8 bits for host addresses from to . If this network is divided into four subnets, it might look like this:
- Subnet 1: (addresses from to )
- Subnet 2: (addresses from to )
- And so on.
Routing Between Subnets
For communication between devices on different subnets, routing is required. Routing is the process of selecting paths in a network along which to send network traffic. In a LAN, a router or a layer-3 switch typically performs this function.
Configuring TCP/IP Settings for Inter-Subnet Communication
Setting Static IP Addresses
Configure each device with a valid IP address, subnet mask, and default gateway. The subnet mask determines which portion of the IP is used for network bits and which part is for host bits. The default gateway is the IP address of the router interface leading towards the rest of the network or to the Internet.
Example Configuration on Windows
- Go to Control Panel > Network and Sharing Center > Change Adapter Settings.
- Right-click the network connection, select Properties.
- Select Internet Protocol Version 4 (TCP/IPv4), then click Properties.
- Choose "Use the following IP address" and enter the IP address, subnet mask, and default gateway.
Example Configuration on Linux
- Edit the network configuration file, for example,
/etc/network/interfacesor usenmclicommands. - Set the IP address, netmask, and gateway.
TCP Communication Across Subnets
TCP is a connection-oriented protocol, which means that a connection is established and maintained until the application programs at each end have finished exchanging messages. In an environment where multiple subnets are involved, TCP handles communication without needing to know the particulars about subnets; it relies on IP for such details.
When an application on a host in one subnet needs to communicate with a host in another subnet, it sends the TCP data to its gateway, which then routes the data to the gateway of the receiving subnet, and finally to the receiving host.
Table: Key Points in Subnet TCP Communication
| Topic | Description |
| IP Address & Subnetting | Used to uniquely identify devices and efficiently partition a LAN into manageable sections. |
| Routing | Essential for conveying data between different subnets within a LAN. |
| IP Configuration | Involves setting the IP address, subnet mask, and default gateway for devices in each subnet. |
| TCP Role | Manages end-to-end connections and reliable data transfer without worrying about subnet configurations. |
Conclusion
TCP communication across different subnets within the same LAN requires properly configured network settings including IP addresses, subnet masks, and default gateways. By understanding and applying the basics of IP addressing, subnetting, and routing, devices on separate subnets can communicate effectively, utilizing the robustness of the TCP protocol to ensure data is transferred reliably and in an ordered manner.

