I was reading about the 'IP' in TCP/IP. Most of its functions seem to be for connecting different (types of) networks. Does this mean that network layer is not required for communication between computers in the same LAN? If not, what other functions are provided by network layer other than common addressing (in case of IP) and routing?
3 Answers
That is correct - the IP layer is not required for communication within a LAN. On Ethernet for example, there's no reason a computer can't send an Ethernet frame addressed to some other computer with some non-IP data inside it.
However, now that the Internet is ubiquitous, TCP/IP is the most useful configuration and therefore the most work has gone into supporting it. There's rarely any reason for a commercial software vendor to make a protocol that runs directly over Ethernet, when they could make it run over IP instead, and have it be able to work on the Internet. I can't think of any protocols used by the average consumer that don't use IP, besides ARP. (NetBIOS used to be ubiquitous on Windows LANs).
However, professional networking gear does use such protocols. Two examples that came to mind are the IS-IS routing protocol, or STP used by Ethernet switches.
IS-IS could've run over IP, really (there's a similar protocol OSPF that does just that). STP runs on Ethernet switches, which might not even have IP addresses, so it really does need to run over Ethernet.
I imagine most protocols that run on IP (such as TCP) could be adapted to run over Ethernet, Token Ring, ATM, or whatever - but there would be no benefit to doing so.
Frames on a layer-2 LAN are delivered directly from one host to another host on the same LAN. To get from one LAN to another LAN, you need layer-3 (IPv4, IPX, IPV6, etc.). IPv4 and IPv6 both provide fields in the IP header for facilitating QoS, and each has various options, which may also be extended in the future.
RFC 791, Internet Protocol provides the scope of IP:
1.2. Scope
The internet protocol is specifically limited in scope to provide the functions necessary to deliver a package of bits (an internet datagram) from a source to a destination over an interconnected system of networks. There are no mechanisms to augment end-to-end data reliability, flow control, sequencing, or other services commonly found in host-to-host protocols. The internet protocol can capitalize on the services of its supporting networks to provide various types and qualities of service.
IPv4 also provides for fragmentation and reassembly of packets, but that has been eliminated in IPv6.
-
Am I right in my understanding that fragmentation may not be required for packets/frames in a single LAN? Does the other mentioned fields useful in a single LAN?– aniztarCommented Mar 21, 2017 at 10:20
-
Fragmentation is required if the MTU on the path shrinks. That will not happen on a local LAN because every host on the local LAN knows the MTU of the LAN because each is directly connected to the local LAN. It is when the MTU later in the path gets smaller due to a different layer-1/2 protocol, or maybe a tunnel or VPN.– Ron Maupin ♦Commented Mar 21, 2017 at 13:50
I would say the opposite - IP is designed to connect to all (IP) networks, regardless of the underlying link-layer technology supporting them (Ethernet/WLAN/WiMAX/LTE)
Coming at it from the other end - don't assume a host only ever has a single IP address - think about a web server hosting multiple sites bound to multiple addresses in the same subnet - the link-layer cannot provide any information for the host OS to determine which one to send it to.