tcp, network protocols and fragmentation

11
Answer of Question 1: (Part a) TCP Reno Performance in case of packet losses due to non-congestion in wireless Networks In wired network packet loss usually occurs due to congestion and traditional TCP Reno use congestion control mechanism to improve performance. Whenever TCP Reno detects packet loss it sets its congestion window size to 1 and goes into slow start. In case of wireless networks packet loss due to congestion is not the main reasons, there are many other main reasons for packet loss i.e. interference, mobility, handover, fading etc. If TCP Reno uses congestion control mechanism in wireless network for packet loss due to non-congestion, it will think packet loss due to congestion and go into slow start to avoid congestion but as there is no congestion on wireless network, so it will waste lots of available bandwidth available to send packets. Example If Host A wants to send data to Host B in a wireless network and TCP Reno is working that network. At start congestion window size is 1 segment and will increase exponentially on each successful acknowledgement. When congestion window size will reach to threshold value TCP will go into congestion avoidance mode to avoid congestion but there is no congestion on the network. Now at this point Host B moves from its terminal to other terminal and few packets are lost due to handover. On detection of missing acknowledgement TCP will think that there is congestion on the network and on timeout it will go to slow start and set congestion window size to 1. But as packet was not lost due to congestion, all bandwidth is available for data transmission and after handover complete Host B will be available for communication. So due to congestion control mechanism for packet loss due to non-congestion, lots of bandwidth will be wasted by TCP Reno.

Upload: haroon-tariq

Post on 21-Jul-2016

7 views

Category:

Documents


1 download

DESCRIPTION

This assignment is submitted in "Network Switching and Routing" Course. In this assignment TCP and some of its types, Packet Fragmentation and Networks protocols (SIP, DHCP, BOOTP, NAT, ARP) are discussed in details.

TRANSCRIPT

Page 1: TCP, Network Protocols and Fragmentation

Answer of Question 1:

(Part a)

TCP Reno Performance in case of packet losses due to non-congestion in

wireless Networks

In wired network packet loss usually occurs due to congestion and traditional TCP Reno

use congestion control mechanism to improve performance. Whenever TCP Reno detects packet

loss it sets its congestion window size to 1 and goes into slow start.

In case of wireless networks packet loss due to congestion is not the main reasons, there

are many other main reasons for packet loss i.e. interference, mobility, handover, fading etc.

If TCP Reno uses congestion control mechanism in wireless network for packet loss due

to non-congestion, it will think packet loss due to congestion and go into slow start to avoid

congestion but as there is no congestion on wireless network, so it will waste lots of available

bandwidth available to send packets.

Example

If Host A wants to send data to Host B in a wireless network and TCP Reno is working

that network. At start congestion window size is 1 segment and will increase exponentially on

each successful acknowledgement. When congestion window size will reach to threshold value

TCP will go into congestion avoidance mode to avoid congestion but there is no congestion on

the network.

Now at this point Host B moves from its terminal to other terminal and few packets are

lost due to handover. On detection of missing acknowledgement TCP will think that there is

congestion on the network and on timeout it will go to slow start and set congestion window size

to 1. But as packet was not lost due to congestion, all bandwidth is available for data

transmission and after handover complete Host B will be available for communication. So due to

congestion control mechanism for packet loss due to non-congestion, lots of bandwidth will be

wasted by TCP Reno.

Page 2: TCP, Network Protocols and Fragmentation

(Part b)

Three Enhancements of TCP proposed for Wireless Environments

1. Indirect TCP (I-TCP)

Indirect TCP was developed because the performance of traditional TCP for wireless

environment was not good and also TCP cannot be changed in the wired network. So some new

enhancement of TCP was needed to overcome these two problems.

Indirect TCP splits end-to-end TCP connection into two parts, one for wired network and

other part for wireless network. Traditional Standard TCP is used within wired network and for

wireless network modified TCP is used to work in wireless environment.

Working

Figure 1

Host 1 wants to send data to host 2. Host 1 is connected with access point through wired

link and host 2 is connected with access point through wireless link. Between host 1 and access

point Standard TCP will work and between host 1 and access point modified TCP will be used.

TCP connection will split at access point and it will act as proxy between two hosts for Host 1

access point is host 2 and for host 2 access point is host 1. Now if host 1 sends a packet to host 2,

access point will store it in its buffer and send the acknowledgement by itself to host 1 and also

transmits the buffered packet to host 2 and wait for acknowledgement of host 2 on receiving of

acknowledgement it will discard the packet from its buffer, it will repeat same process for all

packets.

In case if access point detects any missing acknowledgement access point will retransmit packet

from its buffer and host 1 will not know about any missing acknowledgement from host 2. Both

hosts are unaware of separate TCP connections.

In case of handover if host 2 moves from its access point (Foreign Agent) other foreign agent

then previous foreign agent will send all buffered data and proxy information to new foreign

agent.

2. Snooping TCP

Problem of Indirect TCP is that it splits the TCP connection and does not maintain single

end-to-end connection between sender and receiver. For example if host 1 sends packet to host to

when intermediate access point will receive data it will send the acknowledgement to host 1

Access Point (Foreign Agent)

Host 1

Host 2

Standard TCP for Wired Network Modified TCP for Wireless Network

Page 3: TCP, Network Protocols and Fragmentation

without confirming that packet is received by host 2. This problem is resolved in Snooping TCP

that maintains transparent end-to-end TCP connection between sender and receiver.

Working

In snooping TCP foreign agent nearest to host 2 will buffer packets for fast

retransmission and discards packets when it receive acknowledgement from receiving host but

will not send acknowledgements by itself, instead it will snoop each packet goes through it for

acknowledgements. If it finds any missing acknowledgement or duplicate acknowledgement it

will locally retransmit packet from its buffer. Closest access point has much shorter timeout time

then sending host because it is far nearer then it. It will filter the duplicate and missing

acknowledgements to save host 1 from retransmitting the packet.

Access point works transparently between sending and receiving hosts and both hosts are

unaware of any snooping or anything else so this will maintain the single end-to-end connection

between two hosts because access point will not send acknowledgements on its own but only

snoops the packets to fast retransmit packets in case of loss.

3. Mobile TCP

There is another reason of packet loss in wireless environment which is disconnection of

mobile host which can happen very often in wireless network. If a host want to send data to

mobile host and due to some reason mobile host disconnects during communication, so host 1

will wait for acknowledgement and if it does not receives ACK for specified time it will

retransmit packet and double the time of retransmission after each retransmission. In case of

Indirect TCP if mobile host at receiving end disconnects then foreign agent will have to store

more and more packets in its buffer until host reconnects. The more time it reconnection takes

more buffer is needed. And if mobile host is disconnected during handover then previous agent

will have to send more packets and information to the new foreign agent.

Mobile TCP was developed to solve this problem of disconnection which is common in

wireless environment.

Working

Like Indirect TCP, mobile TCP also splits TCP connection in two parts standard TCP for

wired network and modified TCP for wireless network. In mobile TCP packets are not buffered

and in case of packet loss sending host will detect missing or duplicate acknowledgement and

will retransmit packet, this maintains the end-to-end connection between sender and receiver.

In Mobile TCP access point or foreign agent works as supervisor it monitors the packets passing

through it and if it detects that there is no acknowledgement from receiving mobile host for the

specified period of time it will assume that mobile host is disconnected and set the window size

of sending device to 0 which will send the device to persistent mode. Sending device will stop

retransmitting the packets and will remain in persistent mode. Whenever sender will detect that

receiving mobile host is reconnected it will set the window size of sender to previous value and

sender will start from where it stopped. This prevents sender to go in slow start.

Page 4: TCP, Network Protocols and Fragmentation

Answer of Question 2:

Fragmentation

Every Network has the Maximum Transmission Unit (MTU) which is the maximum data

in bytes that a network can carry at a time. If a packet has size greater than MTU then it will be

divided into smaller part and sent separately independent of each other, this process is called

fragmentation.

To divide a packet into smaller fragments MTU is used. Size of fragmented packet +

original packet’s header size is less than or equal to MTU because the header of the original

packet is copied into the header of fragmented packet.

Following are the main fields used in fragmentation and reassembly of original packet.

Identification ID: Identification number or ID is used with each fragmented packet which is

same in every fragmented packet of a single original packet. ID helps the destination to

reassemble the packet because it groups the packets with same ID and source IP together to form

original packet.

More Flag (MF): this field tells whether the packet is last or not. If it is set to 1 then it mean the

fragmented packet is not the last packet and there is one or more fragment after this and if it is 0

then it tells that the fragment is last.

Fragment Offset (FO): this field tells the position of the fragment in original packet with

respect to original datagram. Offset of a data in original packet is measured in unit of 8 bytes.

For example if we want to fragment a packet of 3000 bytes into three fragments and MTU is

1200 bytes. First fragment will have bytes from 0 to 1200 and its offset will be 0/8 = 0, the next

fragment will carry the bytes from 1200 to 2399 and its offset will be 1200/8 = 150 and the last

fragment will have the bytes from 2400 to 3000 and its offset will be 2400/8 = 300. This force to

choose the size of fragment that has first byte of multiple of 8.

At destination packets are reassembled into original packets this process is called

reassembly. ID, more flag, and fragment offset tell that which fragment belong to particular

original packet and where to position the fragment.

Fragments are sent independent of each other and may take different paths to reach to the

destination that is why they are reassembled at destination. A fragmented packet can again be

fragmented into more fragments at any host or router in path but are reassembled at destination.

Example

Host A wants to send a datagram of 3020 bytes (3000 bytes of data + 20 bytes of header) to host

b and data will pass through network 1 with MTU 1500 bytes and Network 2 with MTU 1000

bytes (as shown in figure 1).

Figure 1

Host A

Network 1 MTU =1500 Router

Host B

Network 1 MTU =1000

Page 5: TCP, Network Protocols and Fragmentation

The datagram will be needed fragment into three parts to pass through the network 1, as 20 bytes

header will be attached to each fragment so MTU for data will be 1480.

First fragment will carry bytes from 0 to 1479 of data so its FO (Fragment Offset) will be

0/8 = 0 and because it is not the last fragment so its MF (More Flag) will be 1. ID (Identification)

for each fragment will be same because they belong to same original datagram say 1 in this case.

Second fragment will carry bytes from 1480 to 2959 of data so its FO will be 1480/8 =

185 and this fragment too is not the last so its MF will be 1.

Third fragment will carry bytes from 2960 to 2999 of data so its FO will be 2960/8 = 370

and this fragment is last so its MF will be 0.

Now to get passed through network 2 fragments with total size of 1500 bytes will again

be fragmented into sub fragments because its MTU is 1000 bytes. Now both fragments of 1500

bytes will be sub fragmented into two fragments ad follow

First sub fragment of fragment 1 will carry data bytes from 0 to 975 and 20 bytes of

header here 4 bytes will be wasted because first byte of each fragment must be multiple of 8. FO

of this sub fragment will be 0/8 = 0 + 0 = 0 (0 is added from previous fragment because FO is

related to original datagram). Its MF will be 1 because it is first sub fragment.

Second sub fragment will carry the data from 976 to 1499 and its offset will be (976/8 +

0 = 122) and as it is last sub fragment its MF will be 1.

Figure 2 illustrate the process of fragmentation

Page 6: TCP, Network Protocols and Fragmentation

Answer of Question 3:

Session Initiation Protocol (SIP)

Session Initiation Protocol is a communication protocol which is used to control session

(start, manage, end) between two or more users for communication such as voice call, video

conference, instant messaging etc. SIP is also widely used in VoIP.

SIP works on application layer and is independent of transport layer protocols i.e. it can run on

both TCP and UDP.

Working

SIP is text based protocol and it is similar to HTTP. SIP uses two types of different

messages that are as follow

1. Request Messages

There are six request messages

INVITE: this message is used by the caller to establish a session for communication.

ACK: it is a conformation message sent by caller after receiver answers INVITE

message.

BYE: this message is used to end the session.

OPTIONS: this message is used to request the information about the capabilities of

machine.

CANCEL: this message is used to cancel the session initialization request.

REGISTER: this message is used to tell the current location of the user. It contains

the users current IP address and port on which user will communicate.

2. Responses Messages

Whenever user agent receives a request message it sends a response message. There are

six responses.

Provisional Responses: this message tells to its recipient that request is received

and is under process.

Positive Final Responses: these messages tell the request initiator that request has

been received, processed successfully and accepted.

Redirect Responses: these are usually sent by proxy server. When a proxy server

cannot process a request it sends redirection response to caller that can be the

location of other proxy or the location of receiver.

Client error Response: this response means that there is syntax error in request

and it cannot be processed by server side.

Server Side error: this response means that request is correct but server cannot

process request due to problem at server side.

Global Failure: this means that request cannot be processed by any server.

Page 7: TCP, Network Protocols and Fragmentation

User Agents

User agents are end points that want to communicate with each other using SIP. If a user

agent is sending request and receiving response then it is referred to as User Agent Client (UAC)

and if it is receiving requests and sending response then it is referred to as User Agent Server

(UAS).

Proxy Server

Although two user agents can communicate directly with each other but proxy servers are

very important in SIP. A proxy server works as intermediary to perform routing of session

messages to the entity closer to user agent.

Communication through session

For a user agent to communicate with other user involves three parts, establish a session,

communicate and terminate session.

1. Establish a session

It requires a three way handshake, first user agent initiate session by sending INVITE

request using transport layer protocol to the user agent with whom it want to communicate. If the

receiver of request wants to start a session then it will send a replay and session initiator will

send ACK to conform the receipt of reply this will establish a session between to users. But if

sender of INVITE request does not receive any replay or negative response then it can CANCEL

the session.

2. Communicate

After the session is established then both user agent will communicate using temporary

ports.

3. Terminate session

When the communication is done any user agent can send BYE message to terminate the

session.

Tracking

Sometimes receiver can be in other terminal away from its own terminal. SIP uses

registration concept to track a user if it is not in its own terminal. A user will register itself with

registration server if it is not in its own terminal. Now if sender want to communicate it will use

email address of receiver in INVITE message instead of IP address. Proxy server will receive the

message and then sends a look up message to the register server wit which receiver is registered.

If proxy server receives the replay then it will change the email address with IP address in

INVITE message’s header and send it to receiver.

Benefits

SIP is a text based protocol which is easy to extend

SIP is simple to use and lightweight

SIP uses authentication and encryption which increase security.

Page 8: TCP, Network Protocols and Fragmentation

Dynamic Host Configuration Protocol (DHCP)

Dynamic Host Configuration Protocol is used to automatically assign IP addresses and

other configuration information to a host in TCP/IP network. DHCP contains a pool of IP

addresses and whenever it receives a request from a host it assigns it an IP address from pool of

available addresses. It is a client\server protocol in which client requests the configuration

information from DHCP server to enable it to communicate on the network and DHCP server

provides the required information such as IP address, DNS address, and default gateway.

DHCP Messages

Following are the DHCP messages sent between server and clients.

DHCP Discover: broadcasted by client when it when it want to connect with the

network, requesting the configuration information from server.

DHCP Offer: Sent by server when it receives discover message from client. It

contains the IP address to offer to the client and other configuration information.

DHCP Request: sent by client if it select the DHCP offer. It contains the IP

address that client selected.

DHCP Decline: sent by client if it declines the offer of IP address sent by server.

DHCP ACK: sent by server acknowledging the client request of selected IP

address.

DHCP NACK: sent by server if it declines the client request of selected IP

address.

DHCP Release: sent by client to server if client releases the IP address assigned to

it.

DHCP Inform: sent by client if it already has IP address and wants additional

configuration parameters information.

IP Lease Process

There are two types of lease processes

1. Obtaining new IP lease

1. When a host want a new IP address and other network configuration information it start

communication with DHCP server by broadcasting DHCPDiscover message

2. When DHCP server receives request from client it sends DHCPOffer message that

contains the IP address being offered to client and other network configuration

information.

3. Client responds to IP address offer from server by selecting offered IP and sending

DHCPRequest message telling server that client has accepted IP address.

4. DHCP conforms the client’s request by sending DHCPACK message finalizing the lease

of IP address.

When client receives acknowledgement from server, it configures its TCP/IP properties and

start communication on the network.

Page 9: TCP, Network Protocols and Fragmentation

2. Renewing IP lease

When 50% of IP address lease time is completed, client tries to renew its IP lease by

sending DHCP request message to the server from which IP lease was taken. If server is

available then server check whether lease is available if yes then server will send DHCPACK to

client renewing IP lease for client

If server is available but lease is not available then server will send DHCPNACK to client

and client will start the process of obtaining new IP address.

If there is no response from server then client will wait until 87% of lease time completes

then it will again send request for renew of IP lease to server if still no response and lease time is

complete then client will start the process of new IP lease by broadcasting DHCPDiscover

message.

Benefits

It saves from manually configuring each network host on the network.

Prevents IP addresses conflicts which can occur in manual configuration of host.

BOOTP Protocol

BOOTP protocol is used to assign IP address from a pool of IPs to host on a network when

it starts up. It was intended to use with diskless workstations, assigning them IP address on

startup and giving the information about the location of their Operating system.

BOOTP was designed to overcome the deficiencies of RARP such as it provides more

information then only IP address and in can be anywhere on the network. BOOTP provides the

base to its successor DHCP which is now widely used in place of it. BOOTP does not provide

extended features of DHCP such as lease and renewal features.

Working

BOOTP is a static configuration protocol because it maintains a table that contains a

predetermined binding of IP address and physical address. Whenever a client requests a IP

address BOOTP protocol matches the physical address of client and returned an IP address

bound with that physical address. Table is managed by network administrator.

Network Address Translation (NAT)

Network Address Translation protocol is used to map local unregistered IP addresses of a

private network to unique global IP address. Hosts in a private network can use registered global

IP addresses locally within their private network, but if any host wants to communicate globally

with internet it requires a globally unique IP address. So NAT is used to translate the local IP

address of that host with the unique global IP address if host is communicating with global

network and when a packet will come from global network for that host NAT will translate it

back to local IP.

NAT works as intermediary between private local network and global network. Gateway

router can be configured to perform the function of NAT.

Page 10: TCP, Network Protocols and Fragmentation

Working

For example if a host of local network is using local IP (192.168.1.2) to communicate

locally and wants to communicate with a server outside of local network and a gateway router is

configured to perform NAT function. When router will receive a packet it will read the IP

address of source host and also verify that the source meets the criteria of address translation by

checking Access Control List. If ok then it will translate the local IP address with a global IP

from available given global IP addresses for example that is (213.10.45.4) and add the entry of

that mapping in its NAT table.

Now if the Outside server responds, the packet from server will come on (213.19.45.4) IP of

default gateway. Gateway router will check for mapping against that global IP address in NAT

table if entry found it will retranslate the global IP address with local IP address of host and

forward the packet to destination IP of (192.168.1.2).

There are two types of IP address mappings

Static Mapping

In static mapping there is a fixed one-to-one relationship between local and global

addresses. Each host in a local network with local IP is assigned a one permanent global IP

address and host will always communicate with that global IP on global network.

Dynamic Mapping

In dynamic mapping there is a pool of global IP addresses from which an available global IP

address is mapped with the local IP of local host if it wants to communicate on the outside

network and entry of mapping is added into NAT table. In this first come first serve mechanism

is used.

Benefit

The main benefit for which NAT was created is that NAT minimize the space of required

global IP addresses, for example if there are 100 hosts in local private network they can use

unregistered local IP addresses within local network and when some host want to communicate

on global network it can be assigned a global IP address from available range of 20 to 25 global

IP addresses that saves the space of global IP addresses because instead of assigning 100 global

IPs to each host we have only 20 to 25 global IP addresses.

Address Resolution Protocol (ARP)

Address Resolution Protocol is used to translate an IP address of host into its physical

address.

Within a single physical network host are identified by their physical address instead of IP

address but higher level protocols use IP addresses instead of physical addresses as destination

address of host. So ARP maps the IP addresses of host with its physical address. ARP uses

lookup tables to perform mapping of addresses.

Page 11: TCP, Network Protocols and Fragmentation

Working

If a device wants to send data to other device in a network it need the physical address of

receiving device. Each device maintains ARP cache to map IP address with physical address. So

if sending device will look for the physical address of the device against its IP if sending device

finds the physical address it will simply send the data on that address.

In case if sending device does not find the physical address of receiving device then, it will send

broadcast message within a network requesting for physical address of receiving device, the

device will match IP if IP matches with device’s IP then it will send ARP response to sending

device and device will update its ARP cache.