Page 290 - DCAP403_Operating System
P. 290
Unit 13: Case Study: Linux
Hosts connected to the same IP subnet can send IP packets directly to each other, all other IP Notes
packets will be sent to a special host, a gateway. Gateways (or routers) are connected to more than
one IP subnet and they will resend IP packets received on one subnet, but destined for another
onwards. For example, if subnets 16.42.1.0 and 16.42.0.0 are connected together by a gateway
then any packets sent from subnet 0 to subnet 1 would have to be directed to the gateway so that
it could route them. The local host builds up routing tables which allow it to route IP packets to
the correct machine. For every IP destination there is an entry in the routing tables which tells
Linux which host to send IP packets to in order that they reach their destination. These routing
tables are dynamic and change over time as applications use the network and as the network
topology changes.
Figure 13.12: TCP/IP Protocol Layers
ETHERNET FRAME
Destination Source
ethernet ethernet Protocol Data Checksum
address address
IP PACKET
Source Destination
Length Protocol Checksum Data
IP address IP address
TCP Packet
Source TCP Destination SEQ ACK Data
address TCP address
The IP protocol is a transport layer that is used by other protocols to carry their data. The
Transmission Control Protocol (TCP) is a reliable end to end protocol that uses IP to transmit
and receive its own packets. Just as IP packets have their own header, TCP has its own header.
TCP is a connection based protocol where two networking applications are connected by a single,
virtual connection even though there may be many subnetworks, gateways and routers between
them. TCP reliably transmits and receives data between the two applications and guarantees
that there will be no lost or duplicated data. When TCP transmits its packet using IP, the data
contained within the IP packet is the TCP packet itself. The IP layer on each communicating host
is responsible for transmitting and receiving IP packets. User Datagram Protocol (UDP) also
uses the IP layer to transport its packets, unlike TCP, UDP is not a reliable protocol but offers
a datagram service. This use of IP by other protocols means that when IP packets are received
the receiving IP layer must know which upper protocol layer to give the data contained in this
IP packet to. To facilitate this every IP packet header has a byte containing a protocol identifi er.
When TCP asks the IP layer to transmit an IP packet , that IP packet’s header states that it contains
a TCP packet. The receiving IP layer uses that protocol identifier to decide which layer to pass
the received data up to, in this case the TCP layer. When applications communicate via TCP/IP
they must specify not only the target’s IP address but also the port address of the application. A
port address uniquely identifies an application and standard network applications use standard
port addresses; for example, web servers use port 80. These registered port addresses can be seen
in /etc/services.
This layering of protocols does not stop with TCP, UDP and IP. The IP protocol layer itself
uses many different physical media to transport IP packets to other IP hosts. These media may
themselves add their own protocol headers. One such example is the ethernet layer, but PPP and
SLIP are others. An ethernet network allows many hosts to be simultaneously connected to a
single physical cable. Every transmitted ethernet frame can be seen by all connected hosts and so
LOVELY PROFESSIONAL UNIVERSITY 283