Data Communication and Networking
Data Communication and Networking
Data Communication and Networking
Switched communication networks are those in which data transformed from source to
destination is routed between various intermediate nodes.
There are mainly three typical Switching Techniques available for digital traffic:
1. Circuit Switching
2. Packet Switching
1. Circuit switching
2. Packet switching
Circuit Switching
Circuit switching is a switching technique that establishes a dedicated path between sender and
receiver.
In the Circuit Switching Technique, once the connection is established then the dedicated path will
remain to exist until the connection is terminated.
Circuit switching in a network operates in a similar way as the telephone works.
A complete end-to-end path must exist before the communication takes place.
In case of circuit switching technique, when any user wants to send the data, voice, video, a request
signal is sent to the receiver then the receiver sends back the acknowledgment to ensure the
availability of the dedicated path. After receiving the acknowledgment, dedicated path transfers
the data.
Circuit switching is used in public telephone network. It is used for voice transmission.
Fixed data can be transferred at a time in circuit switching technology.
1. Circuit establishment
2. Data transfer
3. Circuit Disconnect
Packet Switching
Packet switching can be seen as a solution that tries to combine the advantages of message and
circuit switching and to minimize the disadvantages of both.
There are two methods of packet switching: Datagram and virtual circuit.
In both packet switching methods, a message is broken into small parts, called packets.
Every packet contains some information in its headers such as source address, destination address
and sequence number.
Packets will travel across the network, taking the shortest path as possible.
All the packets are reassembled at the receiving end in correct order.
If any packet is missing or corrupted, then the message will be sent to resend the message.
If the correct order of the packets is reached, then the acknowledgment message will be sent.
Advantages of Packet Switching:
Cost-effective: In packet switching technique, switching devices do not require massive secondary storage
to store the packets, so cost is minimized to some extent. Therefore, we can say that the packet switching
technique is a cost-effective technique.
Reliable: If any node is busy, then the packets can be rerouted. This ensures that the Packet Switching
technique provides reliable communication.
Efficient: Packet Switching is an efficient technique. It does not require any established path prior to the
transmission, and many users can use the same communication channel simultaneously, hence makes use
of available bandwidth very efficiently.
In the above diagram, A and B are the sender and receiver respectively. 1 and 2 are the nodes.
Call request and call accept packets are used to establish a connection between the sender and receiver.
When a route is established, data will be transferred.
After transmission of data, an acknowledgment signal is sent by the receiver that the message has been
received.
If the user wants to terminate the connection, a clear signal is sent for the termination.
Differences b/w Datagram approach and Virtual Circuit approach
Node takes routing decisions Node does not take any routing decision.
to forward the packets.
Congestion cannot occur as all Congestion can occur when the node is busy, and it does
the packets travel in different not allow other packets to pass through.
directions.
LAN Technologies
Local Area Network (LAN) is a data communication network connecting various terminals or computers
within a building or limited geographical area. The connection among the devices could be wired or
wireless. Ethernet, Fast Ethernet, Gigabit Ethernet and 10Gig Ethernet, Wireless LAN using IEEE 802.11 are
examples of standard LAN technologies
MAC:
This protocol controls which gadgets can transmit information to the system, and when they can do so
The Data Link Layer is divided into two Part MAC Media Access Control) Sublayer and LLC (Logic Link
Control) Sublayer.
Ethernet
Ethernet is the LAN technology most commonly used today. Ethernet has become popular because of its
modest price; Ethernet cable is inexpensive and easily installed. Ethernet network adapters and Ethernet
hardware components are also relatively inexpensive.
On Ethernet networks, all computers share a common transmission medium. Ethernet uses an access
method called Carrier Sense Multiple Access with Collision Detect (CSMA/CD) for determining when a
computer is free to transmit data on to the access medium. Using CSMA/CD, all computers monitor the
transmission medium and wait until the line is available before transmitting. If two computers try to
transmit at the same time, a collision occurs. The computers then stop, wait for a random time interval,
and attempt to transmit again.
CSMA/CD can be compared to the protocol followed by a room full of polite people. Someone who wants
to speak first listens to determine whether anybody else is currently speaking (this is the Carrier Sense). If
two people start speaking at the same moment, both people will detect the problem, stop speaking, and
wait before speaking again (this is Collision Detect)
Ethernet Address
End nodes are identified by their Ethernet Addresses (MAC Address or Hardware Address) which is
a unique 6 Byte address.
MAC Address is represented in Hexa Decimal format e.g 00:05:5D:FE:10:0A
The first 3 bytes identify a vendor (also called prefix) and the last 3 bytes are unique for every host
or device
Gigabit Ethernet
1 Gbps bandwidth.
Uses same CSMA/CD media access protocol as in Ethernet and is backward compatible (10/100/100
modules are available).
1000BaseT (UTP), 1000BaseSX (Multimode Fiber) and 1000BaseLX (Multimode/Singlemode Fiber)
standards.
Maximum Segment Length
1000 Base T - 100m (Cat 5e/6)
1000 Base SX - 275 m (Multimode Fiber)
1000 Base LX - 512 m (Multimode Fiber)
1000 Base LX - 20 Km (Single mode Fiber)
1000 Base LH - 80 Km (Single mode Fiber)
10 Gig Ethernet
10 Gbps bandwidth.
Uses same CSMA/CD media access protocol as in Ethernet.
Propositioned for Metro-Ethernet
Maximum Segment Length
1000 Base-T - Not available
10GBase-LR - 10 Km (Singlemode Fiber)
10GBase-ER - 40 Km (Singlemode Fiber)
802.11 Wireless LAN
Wireless LANs are those Local Area Networks that use high frequency radio waves instead of cables for
connecting the devices in LAN. Users connected by WLANs can move around within the area of network
coverage. Most WLANs are based upon the standard IEEE 802.11.
AP (Access Point)
An Access Point (AP) is installed to act as Bridge between Wireless and Wired Network. The AP is
connected to wired network and is equipped with antennae to provide wireless connectivity
Range (Distance between Access Point and WLAN client) depends on structural hindrances and RF gain of
the antenna at the Access Point
Hand-Off
A client is always associated with one AP and when the client moves closer to another AP, it associates
with the new AP called Hand-Off. In other words Hand-Off occurs when a client moves beyond the radio
range of one AP, and into the range of another AP.
802.11b
The most popular 802.11 standard currently in deployment, and provides 1, 2, 5.5 and 11 Mbps
data rates in the 2.4 GHz ISM (Industrial-Scientific-Medical) band.
802.11a
802.11a — an extension to 802.11 that applies to wireless LANs and provides data rate up to 54-
Mbps in the 5GHz band.
802.11g
Applies to wireless LANs and is used for transmission over short distances at up to 54-Mbps in the
2.4 GHz bands
Working Principle
Before every data transmission
Sender sends a Request to Send (RTS) frame containing the length of the transmission
Receiver respond with a Clear to Send (CTS) frame
Sender sends data
Receiver sends an ACK; now another sender can send data
When sender doesn’t get a CTS back, it assumes collision
Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA): is a network protocol
In contrast to CSMA/CD (Carrier Sense Multiple Access/Collision Detection) that deals with
collisions after their occurrence, CSMA/CA prevents collisions prior to their occurrence.
The algorithm of CSMA/CA is:
When a frame is ready, the transmitting station checks whether the channel is idle or
busy.
If the channel is busy, the station waits until the channel becomes idle.
If the channel is idle, the station waits for an Inter-frame gap (IFG) amount of time
and then sends the frame.
After sending the frame, it sets a timer.
The station then waits for acknowledgement from the receiver. If it receives the
acknowledgement before expiry of timer, it marks a successful transmission.
Otherwise, it waits for a back-off time period and restarts the algorithm.
The following flowchart summarizes the algorithms:
Bluetooth is a wireless LAN technology designed to connect devices of different functions such as
telephones, notebooks, computers, cameras, printers, coffee makers, and so on. A Bluetooth LAN is an ad
hoc network, which means that the network is formed spontaneously.
A scatternet is a number of interconnected piconets that supports communication between more than 8
devices. Scatternets can be formed when a member of one piconet (either the master or one of the slaves)
elects to participate as a slave in a second, separate piconet.
Transport Layer
The transport layer is responsible for process-to-process delivery—the delivery of a
packet, part of a message, from one process to another. Two processes communicate in a client/server
relationship.
The client socket address defines the client process uniquely whereas the server socket address
defines the server process uniquely.
A transport layer protocol requires the client socket address as well as the server socket address.
These two addresses contain four pieces.
These four pieces go into the IP header and the transport layer protocol header.
The IP header contains the IP addresses while the UDP and TCP headers contain the port numbers.
TCP is a connection-oriented protocol, which means the sender does not send any data to the destination
node until the destination node acknowledges that it is listening to the sender. TCP is a connection-
oriented protocol; it creates a virtual connection between two TCPs to send data. In addition, TCP uses
flow and error control mechanisms at the transport level. TCP covers parts of Layer 4, the Transport Layer,
and parts of Layer 5, the Session Layer.
For example, when a Web server sends an HTML file to a client, it uses the HTTP protocol to do so. The
HTTP program layer asks the TCP layer to set up the connection and send the file. The TCP stack divides
the file into packets, numbers them and then forwards them individually to the IP layer for delivery.
Although each packet in the transmission will have the same source and destination IP addresses, packets
may be sent along multiple routes. The TCP program layer in the client computer waits until all of the
packets have arrived, then acknowledges those it receives and asks for the retransmission on any it does
not (based on missing packet numbers), then assembles them into a file and delivers the file to the
receiving application.
TCP Header
The length of TCP header is minimum 20 bytes long and maximum 60 bytes.
Source port address: A 16-bit value that defines the port number of the application program in the host
that is sending the segment
Destination port address: A 16-bit value that defines the port number of the application program in the
host that is receiving the segment
Sequence number: A 32-bit value that defines the number assigned to the first byte of data contained in
this segment
Acknowledge number: A 16-bit value that defines the byte number that the sender of the segment is
expecting to receive from the other party
Header length: A 4-bit value that indicates the number of 4-byte words in the TCP header
Reserved: A 6-bit field reserved for future use
Control: A 6-bit field that defines 6 different control bits or flags, as shown in figure
Window size: A 16-bit value in bytes that the other party must maintain
Checksum: A 16-bit checksum; its calculation follows the UDP procedure
Urgent pointer: A 16-bit value, which is valid only if the urgent flag is set, is used when the segment
contains urgent data
Options: There can be up to 40 bytes of optional information in the TCP header
URG - It indicates that Urgent Pointer field has significant data and should be processed.
ACK - It indicates that Acknowledgement field has significance. If ACK is cleared to 0, it indicates that
packet does not contain any acknowledgement.
PSH - When set, it is a request to the receiving station to PUSH data (as soon as it comes) to the receiving
application without buffering it.
RST - Reset flag has the following features:
1. It is used to refuse an incoming connection.
2. It is used to reject a segment.
3. It is used to restart a connection.
SYN - This flag is used to set up a connection between hosts.
FIN - This flag is used to release a connection and no more data is exchanged thereafter. Because packets
with SYN and FIN flags have sequence numbers, they are processed in correct order.
After the data transmission process is finished, TCP will terminate the connection between two endpoints.
Let’s define ISN as a 32-bit number that tracks the packets received by the node and enables the
reassembly of large packets that have been broken up into smaller packets.
Two hosts exchange their ISNs during steps 1 and 2 of the TCP three-way handshake.
2. Transport Protocols
Transport protocols can be connection-oriented (reliable) or connectionless (best-effort) delivery
Transmission Control Protocol (TCP) Responsible for reliable data delivery in TCP/IP
Sequential Packet Exchange (SPX) Novell’s connection-oriented protocol used to guarantee data
delivery
NetBIOS/NetBEUI NetBIOS establishes/manages communications between computers and provides
naming services. NetBEUI provides data transport services for these communications
3. Application Layer Protocols
Domain Name System (DNS) Session layer name-to-address resolution protocol
Hypertext Transport Protocol (HTTP) To transfer Web pages from Web server to browser
File Transfer Protocol (FTP) For file transfer and directory and file manipulation
Telnet Remote terminal emulation; operates at layers 7-5
Simple Mail Transport Protocol (SMTP) Operates at layers 7-5; provides messaging services
UDP Header
UDP header is as simple as its function.
Subnet Mask
Consider IP address = 192.168.2.25
First few bits (left to right) identify network/subnet
Remaining bits identify host/interface
Number of subnet bits is called subnet mask, e.g.
Subnet IP Address range is 192.168.2.0 – 192.168.2.255 or Mask = 255.255.255.0
Subnet IP Address range is 192.168.2.0 – 192.168.2.15 or Mask = 255.255.255.240
Classful Addressing
The 32 bit IP address is divided into five sub-classes. These are:
Class A
Class B
Class C
Class D
Class E
IPv4 address is divided into two parts:
Network ID
Host ID
Class A:
IP address belonging to class A are assigned to the networks that contain a large number of hosts.
The network ID is 8 bits long.
The host ID is 24 bits long.
The higher order bit of the first octet (1 octet=8 bits) in class A is always set to 0. The remaining 7 bits in
first octet are used to determine network ID. The 24 bits of host ID are used to determine the host in any
network. The default subnet mask for class A is 255.x.x.x. Therefore, class A has a total of:
2^7-2= 126 network ID(Here 2 address is subracted because 0.0.0.0 and 127.x.y.z are special address.
)
2^24 – 2 = 16,777,214 host ID
IP addresses belonging to class A ranges from 1.x.x.x – 126.x.x.x
Class B:
IP address belonging to class B are assigned to the networks that ranges from medium-sized to
large-sized networks.
The network ID is 16 bits long.
The host ID is 16 bits long.
The higher order bits of the first octet of IP addresses of class B are always set to 10. The
remaining 14 bits are used to determine network ID. The 16 bits of host ID is used to determine
the host in any network. The default sub-net mask for class B is 255.255.x.x. Class B has a total
of:
2^14 = 16384 network address
2^16 – 2 = 65534 host address
IP addresses belonging to class B ranges from 128.0.x.x – 191.255.x.x.
Class C:
IP address belonging to class C are assigned to small-sized networks.
The network ID is 24 bits long.
The host ID is 8 bits long.
The higher order bits of the first octet of IP addresses of class C are always set to 110. The
remaining 21 bits are used to determine network ID. The 8 bits of host ID is used to determine the
host in any network. The default sub-net mask for class C is 255.255.255.x. Class C has a total of:
2^21 = 2097152 network address
2^8 – 2 = 254 host address
IP addresses belonging to class C ranges from 192.0.0.x – 223.255.255.x.
Class D:
IP address belonging to class D are reserved for multi-casting. The higher order bits of the first
octet of IP addresses belonging to class D are always set to 1110. The remaining bits are for the
address that interested hosts recognize.
Class D does not posses any sub-net mask. IP addresses belonging to class D ranges from
224.0.0.0 – 239.255.255.255.
Class E:
IP addresses belonging to class E are reserved for experimental and research purposes. IP
addresses of class E ranges from 240.0.0.0 – 255.255.255.254. This class doesn’t have any sub-
net mask. The higher order bits of first octet of class E are always set to 1111.
Rules for assigning Host ID:
Host ID’s are used to identify a host within a network. The host ID are assigned based on the following
rules:
Within any network, the host ID must be unique to that network.
Host ID in which all bits are set to 0 cannot be assigned because this host ID is used to represent the
network ID of the IP address.
Host ID in which all bits are set to 1 cannot be assigned because this host ID is reserved as a
broadcast address to send packets to all the hosts present on that particular network.
Rules for assigning Network ID:
Hosts that are located on the same physical network are identified by the network ID, as all host on the
same physical network is assigned the same network ID. The network ID is assigned based on the following
rules:
The network ID cannot start with 127 because 127 belongs to class A address and is reserved for
internal loop-back functions.
All bits of network ID set to 1 are reserved for use as an IP broadcast address and therefore, cannot
be used.
All bits of network ID set to 0 are used to denote a specific host on the local network and are not
routed and therefore, aren’t used.
Gateway
The Gateway Address is the Address of the router where the packet should be sent in case
the destination host does not belong to the same subnet
IP Header
The IPv4 packet header has quite some fields. In this lesson we’ll take a look at them and I’ll explain what
everything is used for. Take a look at this picture:
Version: the first field tells us which IP version we are using, only IPv4 uses this header so you will always
find decimal value 4 here.
Header Length: this 4 bit field tells us the length of the IP header in 32 bit increments. The minimum length
of an IP header is 20 bytes so with 32 bit increments, you would see value of 5 here. The maximum value
we can create with 4 bits is 15 so with 32 bit increments, that would be a header length of 60 bytes. This
field is also called the Internet Header Length (IHL).
Type of Service: this is used for QoS (Quality of Service). There are 8 bits that we can use to mark the
packet which we can use to give the packet a certain treatment. You can read more about this field in my
IP precedence and DSCP tutorial.
Total Length: this 16-bit field indicates the entire size of the IP packet (header and data) in bytes. The
minimum size is 20 bytes (if you have no data) and the maximum size is 65.535 bytes, that’s the highest
value you can create with 16 bits.
Identification: If the IP packet is fragmented then each fragmented packet will use the same 16 bit
identification number to identify to which IP packet they belong to.
IP Flags: These 3 bits are used for fragmentation:
The first bit is always set to 0.
The second bit is called the DF (Don’t Fragment) bit and indicates that this packet should not be
fragmented.
The third bit is called the MF (More Fragments) bit and is set on all fragmented packets except the last one.
Fragment Offset: this 13 bit field specifies the position of the fragment in the original fragmented IP
packet.
Time to Live: Everytime an IP packet passes through a router, the time to live field is decremented by 1.
Once it hits 0 the router will drop the packet and sends an ICMP time exceeded message to the sender. The
time to live field has 8 bits and is used to prevent packets from looping around forever (if you have a
routing loop).
Protocol: this 8 bit field tells us which protocol is enapsulated in the IP packet, for example TCP has value 6
and UDP has value 17.
Header Checksum: this 16 bit field is used to store a checksum of the header. The receiver can use the
checksum to check if there are any errors in the header.
Source Address: here you will find the 32 bit source IP address.
Destination Address: and here’s the 32 bit destination IP address.
IP Option: this field is not used often, is optional and has a variable length based on the options that were
used. When you use this field, the value in the header length field will increase. An example of a possible
option is “source route” where the sender requests for a certain routing path.