CN Bookmarked Note Part 3
CN Bookmarked Note Part 3
by
Joyoshish Saha
Silly Window Syndrome is a problem that arises due to the poor implementation of TCP.
It degrades the TCP performance and makes the data transmission extremely inefficient.
Causes-
Nagle’s Algorithm-
Sender should send only the first byte on receiving one byte data from the application.
Sender should buffer all the rest bytes until the outstanding byte gets acknowledged.
In other words, sender should wait for 1 RTT.
After receiving the acknowledgement, sender should send the buffered data in one TCP segment.
Then, sender should buffer the data again until the previously sent data gets acknowledged.
Consider the receiver continues to be unable to process all the incoming data.
In such a case, its window size becomes smaller and smaller.
A stage arrives when it repeatedly sends the window size of 1 byte to the sender.
Clark’s Solution-
Until it can handle the MSS it advertised during Three Way Handshake
Or until its buffer is half empty, whichever is smaller.
Important Notes-
Note-01:
Nagle’s algorithm is turned off for the applications that require data to be sent immediately.
This is because-
Nagle’s algorithm sends only one segment per round trip time.
This impacts the latency by introducing a delay.
Note-02:
Nagle’s algorithm and Clark’s solution are complementary.
Problem-
A fast typist can do 100 words a minute and each word has an average of 6 characters. Demonstrate Nagle’s algorithm by showing the sequence
of TCP segment exchanges between a client with input from our fast typist and a server. Indicate how many characters are contained in each
segment sent from the client.
1. The client and server are in the same LAN and the RTT is 20 ms.
2. The client and server are connected across a WAN and the RTT is 100 ms.
Solution-
Case-01:
= 0.2 characters
Assuming the TCP header length is 20 bytes, 41 bytes of data will be sent in each segment.
Case-02:
= 1 character
Assuming the TCP header length is 20 bytes, 41 bytes of data will be sent in each segment.
Summary
Publisher Logo
Transmission Control Protocol | Practice Problems
Computer Networks
Problem-01:
1. Multiple
2. Single
3. Zero
4. None
Solution-
Problem-02:
TCP protects itself from miss delivery by IP with the help of-
Solution-
Problem-03:
Solution-
Problem-04:
If WAN link is 2 Mbps and RTT between source and destination is 300 msec, what would be the optimal TCP window size needed to fully utilize
the line?
1. 60,000 bits
2. 75,000 bytes
3. 75,000 bits
4. 60,000 bytes
Solution-
Given-
Bandwidth = 2 Mbps
RTT = 300 msec
= 60,0000 bits
= 75,000 bytes
Problem-05:
Suppose host A is sending a large file to host B over a TCP connection. The two end hosts are 10 msec apart (20 msec RTT) connected by a 1
Gbps link. Assume that they are using a packet size of 1000 bytes to transmit the file. For simplicity, ignore ack packets. At least how big would the
window size (in packets) have to be for the channel utilization to be greater than 80%?
1. 1000
2. 1500
3. 2000
4. 2500
Solution-
Given-
RTT = 20 msec
Bandwidth = 1 Gbps
Packet size = 1000 bytes
Efficiency >= 80%
Window size
= 1 Gbps x 20 msec
= 20 x 106 bits
= 2 x 107 bits
Window size
In terms of packets,
Window size
= 2000 packets
Problem-06:
A TCP machine is sending windows of 65535 B over a 1 Gbps channel that has a 10 msec one way delay.
Solution-
Given-
Method-01:
= 1 Gbps x (2 x 10 msec)
= 20 x 106 bits
= 25 x 105 bytes
Thus,
Line Efficiency(η)
= Amount of data being sent in 1 RTT / Maximum amount of data that can be sent in 1 RTT
= 0.026214
= 2.62%
Now,
= Efficiency x Bandwidth
= 0.0262 x 1 Gbps
= 26.214 Mbps
Method-02:
= 65535 B / 20 msec
= 26.214 Mbps
Now,
Line Efficiency
= Throughput / Bandwidth
= 26.214 x 10-3
= 0.026214
= 2.62%
Summary
Publisher Logo
Liked this article? Share it with your friends and classmates now-
250 CHAPTER 3 • TRANSPORT LAYER
• LastByteRead: the number of the last byte in the data stream read from the
buffer by the application process in B
• LastByteRcvd: the number of the last byte in the data stream that has arrived
from the network and has been placed in the receive buffer at B
3.5 • CONNECTION-ORIENTED TRANSPORT: TCP 251
RcvBuffer
rwnd
Data Application
from IP process
TCP data
Spare room
in buffer
Figure 3.38 � The receive window (rwnd) and the receive buffer
(RcvBuffer)
Because TCP is not permitted to overflow the allocated buffer, we must have
The receive window, denoted rwnd is set to the amount of spare room in the buffer:
Because the spare room changes with time, rwnd is dynamic. The variable rwnd is
illustrated in Figure 3.38.
How does the connection use the variable rwnd to provide the flow-control
service? Host B tells Host A how much spare room it has in the connection buffer
by placing its current value of rwnd in the receive window field of every segment it
sends to A. Initially, Host B sets rwnd = RcvBuffer. Note that to pull this off,
Host B must keep track of several connection-specific variables.
Host A in turn keeps track of two variables, LastByteSent and Last-
ByteAcked, which have obvious meanings. Note that the difference between these
two variables, LastByteSent – LastByteAcked, is the amount of unac-
knowledged data that A has sent into the connection. By keeping the amount of
unacknowledged data less than the value of rwnd, Host A is assured that it is not
overflowing the receive buffer at Host B. Thus, Host A makes sure throughout the
connection’s life that
There is one minor technical problem with this scheme. To see this, suppose
Host B’s receive buffer becomes full so that rwnd = 0. After advertising rwnd = 0
to Host A, also suppose that B has nothing to send to A. Now consider what hap-
pens. As the application process at B empties the buffer, TCP does not send new seg-
ments with new rwnd values to Host A; indeed, TCP sends a segment to Host A
only if it has data to send or if it has an acknowledgment to send. Therefore, Host A
is never informed that some space has opened up in Host B’s receive buffer—Host
A is blocked and can transmit no more data! To solve this problem, the TCP specifi-
cation requires Host A to continue to send segments with one data byte when B’s
receive window is zero. These segments will be acknowledged by the receiver.
Eventually the buffer will begin to empty and the acknowledgments will contain a
nonzero rwnd value.
The online site at http://www.awl.com/kurose-ross for this book provides an
interactive Java applet that illustrates the operation of the TCP receive window.
Having described TCP’s flow-control service, we briefly mention here that UDP
does not provide flow control. To understand the issue, consider sending a series of
UDP segments from a process on Host A to a process on Host B. For a typical UDP
implementation, UDP will append the segments in a finite-sized buffer that “precedes”
the corresponding socket (that is, the door to the process). The process reads one entire
segment at a time from the buffer. If the process does not read the segments fast
enough from the buffer, the buffer will overflow and segments will get dropped.
• Step 1. The client-side TCP first sends a special TCP segment to the server-side
TCP. This special segment contains no application-layer data. But one of the flag
bits in the segment’s header (see Figure 3.29), the SYN bit, is set to 1. For this
reason, this special segment is referred to as a SYN segment. In addition, the
client randomly chooses an initial sequence number (client_isn) and puts
this number in the sequence number field of the initial TCP SYN segment. This
segment is encapsulated within an IP datagram and sent to the server. There has
(/)
TCP/IP stands for Transmission Control Protocol/ Internet Protocol. It is specifically designed as a model to offer highly reliable
and end-to-end byte stream over an unreliable internetwork.
What is UDP?
UDP is a Datagram oriented protocol. It is used for broadcast and multicast type of network transmission. The full form of UDP
is User Datagram Protocol (A datagram is a transfer unit associated with a packet-switched network.) The UDP protocol works
almost similar to TCP, but it throws all the error-checking stuff out, all the back-and-forth communication and deliverability.
Features of TCP
Here, are some important features of TCP
Delivery Acknowledgements
Re transmission
Delays transmission when the network is congested
Easy Error detection
Here, are some important feature of UDP:
(/images/1/011720_0714_TCPvsUDPWha1.png)
TCP UDP
TCP reads data as streams of bytes, and the message is UDP messages contain packets that were sent one by one. It
transmitted to segment boundaries. also checks for integrity at the arrival time.
TCP messages make their way across the internet from one It is not connection-based, so one program can send lots of
computer to another. packets to another.
TCP rearranges data packets in the specific order. UDP protocol has no fixed order because all packets are
independent of each other.
The speed for TCP is slower. UDP is faster as error recovery is not attempted.
TCP is heavy-weight. TCP needs three packets to set up a UDP is lightweight. There are no tracking connections,
socket connection before any user data can be sent. ordering of messages, etc.
TCP does error checking and also makes error recovery. UDP performs error checking, but it discards erroneous
packets.
Using handshake protocol like SYN, SYN-ACK, ACK No handshake (so connectionless protocol)
TCP is reliable as it guarantees delivery of data to the The delivery of data to the destination can't be guaranteed in
destination router. UDP.
TCP offers extensive error checking mechanisms because it UDP has just a single error checking mechanism which is
provides flow control and acknowledgment of data. used for checksums.
Application of TCP
Here, are pros/benefits of using the TCP/IP model:
Application of UDP
UDP method is largely used by time-sensitive applications as well as by servers that answer small queries from a larger
client base.
UDP is compatible with packet broadcasts for sending all over the network and for multicasting sending.
It is also used in Domain Name System, Voice over IP, and online games.
Advantage of TCP
Here, are pros/benefits of TCP:
Advantage of UDP
Here are the pros/benefits of UDP:
It never restricts you to a connection-based communication model; that's why startup latency in distributed applications is
low.
The recipient of UDP packets gets them unmanaged, which also includes block boundaries.
Broadcast and multicast transmission are also available with UDP
Data loss can be made
Small transaction ( DNS lookup)
Bandwidth intensive app which endures packet loss
Disadvantages of TCP
Here, are disadvantage of using TCP:
TCP never conclude a transmission without all data in motion being explicitly asked.
You can't use for broadcast or multicast transmission.
TCP has no block boundaries, so you need to create your own.
TCP offers many features that you don't want. It may waste bandwidth, time, or effort.
In this, model the transport layer does not guarantee delivery of packets.
Replacing protocol in TCP/IP is not easy.
It doesn't offer clear separation from its services, interfaces, and protocols.
Disadvantages of UDP
Here, are important cons/drawback of UDP:
In UDP protocol, a packet may not be delivered or delivered twice. It may be delivered out of order, so you get no indication.
Routers are quite careless with UDP, so they never retransmit it if it collides.
UDP has no Congestion Control, and flow control, so implementation is the job of a user application.
UDP mostly like to suffer from worse packet loss
When to use UDP and TCP?
TCP is an ideal choice, and even it has associated overhead, Therefore, when most of the overhead is in the connection,
your application stays connected for any length of time.
UDP is ideal to use with multimedia like VoIP.
Use TCP sockets when both client and server independently send packets at that time; an occasional delay is acceptable.
(e.g., Online Poker).
You should use user UDP if both client and server may separately send packets, and occasional delay is also not acceptable.
(e.g., Multiplayer games).
KEY DIFFERENCES:
Networking Tutorial
5) TCP 3-Way Handshake (/tcp-3-way-handshake.html)
UDP Protocol | UDP Header | UDP Header Format
Computer Networks
There are mainly two transport layer protocols that are used on the Internet-
UDP Protocol-
Characteristics of UDP-
It is a connectionless protocol.
It is a stateless protocol.
It is an unreliable protocol.
It is a fast protocol.
It offers the minimal transport service.
It is almost a null protocol.
It does not guarantee in order delivery.
It does not provide congestion control mechanism.
It is a good protocol for data flowing in one direction.
Need of UDP-
1. Source Port-
2. Destination Port-
3. Length-
4. Checksum-
Applications which require one response for one request use UDP. Example- DNS.
Routing Protocols like RIP and OSPF use UDP because they have very small amount of data to be transmitted.
Trivial File Transfer Protocol (TFTP) uses UDP to send very small sized files.
Broadcasting and multicasting applications use UDP.
Streaming applications like multimedia, video conferencing etc use UDP since they require speed over reliability.
Real time applications like chatting and online games use UDP.
Management protocols like SNMP (Simple Network Management Protocol) use UDP.
Bootp / DHCP uses UDP.
Other protocols that use UDP are- Kerberos, Network Time Protocol (NTP), Network News Protocol (NNP), Quote of the day protocol etc.
Important Notes-
Note-01:
Note-02:
This is because-
Note-03:
This is because-
UDP does not guarantee the delivery of datagram to its respective user (application).
The lost datagrams are not retransmitted by UDP.
Note-04:
This is because-
UDP is already an unreliable protocol and error checking does not make much sense.
Also, time is saved and transmission becomes faster by avoiding to calculate it.
It may be noted-
Note-05:
This is because-
Note-06:
1. Trace Route
2. Record Route
3. Time stamp
When required,
Problem-01:
Which field is optional in UDP?
1. Checksum
2. Destination port
3. Length
4. None
Solution-
Problem-02:
1. Only TCP
2. Only UDP
3. Both TCP and UDP
4. None
Solution-
IP Pseudo header is used in both TCP and UDP while calculating checksum.
Thus, Option (C) is correct.
Problem-03:
Broadcasting applications like WHOD (who daemon on UNIX) uses what transport layer protocol?
1. TCP
2. UDP
3. Either TCP or UDP
4. IGMP
Solution-
Stateful /
Stateless Stateless Stateless Stateful Stateful
Stateless
Transport
UDP TCP TCP TCP TCP
Protocol Used
Connectionless
Connection Connection Connection
/ Connection Connectionless Connectionless
Oriented Oriented Oriented
Oriented
Control
connection
HTTP 1.0 is is
non-persistent. persistent.
Persistent /
Non-persistent Persistent Persistent
Non-persistent HTTP 1.1 is Data
persistent. connection
is non-
persistent.
20 for data
connection.
Port Number
53 80 25 110 21 for
Used
control
connection.
Summary
(/)
IP address act as an identifier for a specific machine on a particular network. The IP address is also called IP number and
internet address. IP address specifies the technical format of the addressing and packets scheme. Most networks combine
IP with a TCP (Transmission Control Protocol). It also allows developing a virtual connection between a destination and a
source.
What is IPv4?
IPv4 was the first version of IP. It was deployed for production in the ARPANET in 1983. Today it is most widely used IP
version. It is used to identify devices on a network using an addressing system.
The IPv4 uses a 32-bit address scheme allowing to store 2^32 addresses which is more than 4 billion addresses. Till date, it
is considered the primary Internet Protocol and carries 94% of Internet traffic.
What is IPv6?
It is the most recent version of the Internet Protocol. Internet Engineer Taskforce initiated it in early 1994. The design and
development of that suite is now called IPv6.
This new IP address version is being deployed to fulfill the need for more Internet addresses. It was aimed to resolve issues
which are associated with IPv4. With 128-bit address space, it allows 340 undecillion unique address space. IPv6 also called
IPng (Internet Protocol next generation).
Features of IPv4
Connectionless Protocol
Allow creating a simple virtual communication layer over diversified devices
It requires less memory, and ease of remembering addresses
Already supported protocol by millions of devices
Offers video libraries and conferences
Features of IPv6
Both are used to identify machines connected to a network. In principle, they are the same, but they are different in how
they work.
Basis for
IPv4 IPv6
differences
Size of IP
IPv4 is a 32-Bit IP Address. IPv6 is 128 Bit IP Address.
address
Number of
12 8
header fields
Length of
20 40
header filed
Type of
Unicast, broadcast, and multicast. Unicast, multicast, and anycast.
Addresses
You have to configure a newly installed system before it can In IPv6, the configuration is optional,
Configuration
communicate with other systems. depending upon on functions needed.
VLSM support IPv4 support VLSM (Virtual Length Subnet Mask). IPv6 does not offer support for VLSM.
Fragmentation Fragmentation is done by sending and forwarding routes. Fragmentation is done by the sender.
Routing
RIP does not support IPv6. It uses static
Information RIP is a routing protocol supported by the routed daemon.
routes.
Protocol (RIP)
Address Mask Use for the designated network from host portion. Not used.
SNMP SNMP is a protocol used for system management. SNMP does not support IPv6.
Packet
Allows from routers and sending host Sending hosts only
fragmentation
DNS records Address (A) records, maps hostnames Address (AAAA) records, maps hostnames
IP to MAC
Broadcast ARP Multicast Neighbour Solicitation
resolution
Local subnet
Group Internet Group Management Protocol GMP) Multicast Listener Discovery (MLD)
management
Uses ARP(Address Resolution Protocol) to map to MAC Uses NDP(Neighbour Discovery Protocol)
Mapping
address to map to MAC address
Basis for
IPv4 IPv6
differences
KEY DIFFERENCE
CCNA Tutorial
1) CCNA Certification Tutorial (/introduction-ccna.html)
WiFi is the marketing name for IEEE standard 802.11. It is a standard for both Level 1 (physical) and Level 2 (data link) of a wireless data transmission
protocol.
802.11 defines many Level 1 variants. 802.11g is the new, high-speed Level 1 standard, versus 802.11b, the first generation WiFi. The radio frequency
band is around 3 Gigahertz, same as a microwave oven. As you can see in your WiFi setup, there are channels within the band. These channels overlap
so that at most 3 channels can be in use at the same time.
WiFi Concepts
There are two general types of WiFi transmission: DCF (Distributed Coordination Function) and PCF (Point Coordination Function). DCF is
ethernet in the air. It employs a very similar packet structure, and many of the same concepts. There are two problems that make wireless different then
wired.
These problems demand that a DCF WiFI be a CSMA/CA network (Collision Avoidance) rather than a CSMA/CD network (Collision Detect). The
result are the following protocol elements,
Positive Acknowledgement. Every packet sent is positively acknowledged by the receiver. The next packet is not sent until receiving a positive
acknowledgement for the previous packet.
Channel clearning. A transmission begins with a RTS (Request to Send) and the destination or receiver responds with a CTS (Clear to Send).
Then the data packets flow. For the channel is cleared by these two messages. All that hear the CTS squelch. This helps with the hidden
substation problem.
Channel reservation. Each packet has a NAV (Network Allocation Vector) containing a number X. The channel is reserved to the correspondents
(the sender and receiver of this packet) for an additonal X milliseconds after this packet. Once you have the channel, you can hold it with the
NAV. The last ACK contains NAV zero, to immediately release the channel.
As for PCF, it is a polling, token-ring type communcation system. We shall skip the details. It isn't much used.
A group of corresponding stations is called a BSS (Basic Service Set). The BSS can be organized in several ways.
Independent BSS, or ad hoc. The network is only the members of the BSS, they talk between themselves directly, they self-organize, there is not
central autority.
Infrastructure BSS. The BSS is organized around an Access Point which can bridge traffic out the BSS onto a distribution network. Members of
the BSS talk to the AP only. You can often understand a domain by answering the question "who will hear a broadcast". A BSS (data link layer) is
defined by who will hear a broadcast from the AP (but not by a station which is not an AP, because of the hidden station problem!).
ESS (Extended Service Set). A bunch of BSS's connected by a distribution network. The distribution network connects the Access Points. WiFi
doesn't specify the protocol that builds ESS's.
Since this is ethernet on the air, each transmitter/receiver has a 48 bit MAC consistent with the ethernet address. That is, same address space, OUI's, and
so on. An AP is a bridge between wired and unwired ethernet, so it has two interfaces. As the leader of a BSS, it gives names the BSS by the ethernet
address of its air interface. This is called the BSSID.
An ESS is given a name, called the SSID (Service Set ID). This is the thing you type into your network configuration to join a WiFi network.
A packet on the air will have three addresses, source, destination and BSSID (access point address, essentially). The AP takes traffic it receives off the
air that has its address and drops it onto its wired interface, eliting its own address. That is, on the wired side, only the source and destination addresses
are seen. The address of the AP is not used, either its wired or unwired addresses.
When an AP sends a packet into the air, it uses the source and destination address of the packet it is bridging as found, and adds its own wireless
address as the BSSID. A wired station sending to a wireless station uses the wireless stations's ethernet address just as if it were a wired station. The AP
picks the packet off the wire, carries it across to its wireless interface, inserting its wireless address as the extra, third address, and sends it out to the
destination.
Association and so on
Definitions:
BSS
Basic Service Set. A bunch of machines forming a cell.
ESS
Extended Service Set. Using WiFi beyond a BSS, gluing together several BSS
BSSID
A 48 bit identifier for a BSS. If an infrastructure BSS, it is the MAC of the 802.11 side of the Acess Point. Else the local bit is set and a 48-bit
identifier is randomly selected.
SSID
Service set Identifier. An character string identifier for a ESS.
NAV
Network Access Vector. A time slot reservation, in microseconds.
RTS/CTS
Request To Send, Clear To Send. Reservation mechanism. Source,
Quick description
1. WiFi is standard 802.11, with various letters added. The standard includes a large number of physical variants.
2. The link levels can either be an Independent BSS (IBSS) or an infrastructure BSS. An infra. BSS can be contention based or coordinated (Point
Coordination Function).
3. Infrastructure BSS uses AP (access points) and a distribution medium, e.g. ethernet (802.2), either the AP acting as bridges. In a simple example,
the packet has three addresses, the two "transparent" endpoints and the BBSID, which is the way-point for the packet between air and wire.
4. In an infra. BSS, the AP either Beacons or responds to a probe from a node. An association (after possible authentication) occurs, so that traffic
from the host is bridged onto the distribution by the AP.
5. Gratuitous ARPs open up switches to L2 forward traffic to associated AP.
6. There are mobility issues, which are not part of the standard.
7. It is a positive acknowledge system. Each packet is positively acknowledge (an ACK packet) before the next packet is sent.
8. Packets carry NAV's which hold the channel clear for the time stated in the NAV.
9. RTS/CTS pair with NAV covering up to the end of the ACK of the data packet are exchanged. The ACK has a NAV of 0.
10. There are not NACKs.
HOME OFFICIAL BOOKS STUDY MATERIAL QUIZ ISRO ANALYSIS TOPPERS STRATEGY
GATE CUTOFF
LOGIN/REGISTER
It is Based on 802.11 and primarily a LAN Technology. Wi-Fi operates at the physical
and data link layers of the OSI model
Username or E-mail *
Wi-Fi is Half Duplex.
Ethernet is more secure than WiFi
There is Collision avoidance in wi and collision detection in Ethernet.
Password *
Keep me signed in
Login
Register
GET UPDATES
There are 2 General type of Wi Transmission IIT’s and IISc Cuto Gate 2019
March 18, 2020
1. DCF (Distributed Coordination Function)
IISc Bangalore GATE 2019 Cuto s
2. PCF (Point coordination Function) – Not much used
March 18, 2020
Important Notes
Every packet sent is positively acknowledged by receiver. Next packet is not sent
until receiving a positive acknowledgment for previous Packet.
A Transmission begin with a RTS (Request to send) & Receiver respond with CTS
(Clear to send). then the data packet ow. This help in hidden substation problem.
Independent BSS, or ad hoc : The network is only the members of the BSS, they talk
between themselves directly, they self-organize, there is no central autority.
Infrastructure BSS : The BSS is organized around an Access Point which can bridge
tra c out the BSS onto a distribution network. Members of the BSS talk to the
AP(Access Point) only. A BSS (data link layer) is de ned by who will hear a broadcast
from the AP (but not by a station which is not an AP, because of the hidden station
problem!).
ESS (Extended Service Set) : A bunch of BSS’s connected by a distribution network.
The distribution network connects the Access Points. WiFi doesn’t specify the protocol
that builds ESS’s.
When a mobile host move beyond the range of one base station and into range
of another. It will change its point of attachment into larger network . This is
Hando .
References
Wikipedia
http://www.cs.miami.edu/home/burt/learning/Csc524.052/notes/wi .html
Kurose
If you like GatePoint and would like to contribute, you can also write an article and
mail your article to gatecsepoint@gmail.com. See your article appearing on the
GatePoint main page and help other Gate Aspirants.
Anup Patel
M.Tech Student at Indian Institute of Science
AIR 2 ISRO SC Written Test Dec 2017
AIR 142 GATE 2018
Please write comments if you nd anything incorrect, or you want to share more
information about the topic discussed above.
Public Key Cryptography | RSA Algorithm Example
Computer Networks
Before you go through this article, make sure that you have gone through the previous article on Cryptography.
We have discussed-
In this technique,
Sender and receiver use different keys to encrypt and decrypt the message.
It is called so because sender and receiver use different keys.
It is also called as public key cryptography.
Working-
The message exchange using public key cryptography involves the following steps-
Step-01:
At sender side,
Step-02:
The cipher text is sent to the receiver over the communication channel.
Step-03:
At receiver side,
Advantages-
It is more robust.
It is less susceptible to third-party security breach attempts.
Disadvantages-
Each individual requires two keys- one public key and one private key.
For n individuals to communicate, number of keys required = 2 x n = 2n keys.
1. RSA Algorithm
2. Diffie-Hellman Key Exchange
RSA Algorithm-
Let-
Step-01:
At sender side,
It raises the plain text message ‘P’ to the eth power modulo n.
This converts the message into cipher text ‘C’.
C = Pe mod n
Step-02:
The cipher text ‘C’ is sent to the receiver over the communication channel.
Step-03:
At receiver side,
P = Cd mod n
NOTE-
P = Cd mod n
P = Ped mod n
ed = 1 mod Ø(n)
OR
ed = kØ(n) + 1
An individual can generate his public key and private key using the following steps-
Step-01:
Step-02:
n=pxq
Ø(n) = (p-1) x (q-1)
Step-03:
Choose any value of ‘e’ such that-
Step-04:
Problem-01:
In a RSA cryptosystem, a participant A uses two prime numbers p = 13 and q = 17 to generate her public and private keys. If the public key of A is
35, then the private key of A is _______.
Solution-
Given-
Step-01:
Value of n,
n=pxq
n = 13 x 17
∴ n = 221
Toilent function,
∴ Ø(n) = 192
Step-02:
Step-03:
Here,
The least value of ‘k’ which gives the integer value of ‘d’ is k = 2.
On substituting k = 2, we get d = 11.
Problem-02:
In the RSA public key cryptosystem, the private and public keys are (e, n) and (d, n) respectively, where n = p x q and p and q are large primes.
Besides, n is public and p and q are private. Let M be an integer such that 0 < M < n and f(n) = (p-1)(q-1).
II. ed ≡ 1 mod n
Solution-
Summary
Publisher Logo
Liked this article? Share it with your friends and classmates now-
Di e Hellman Key Exchange | Asymmetric Encryption
Computer Networks
Asymmetric Encryption-
Before you go through this article, make sure that you have gone through the previous article on Asymmetric Key Cryptography.
In asymmetric encryption,
Sender and receiver use different keys to encrypt and decrypt the message.
The famous asymmetric encryption algorithms are-
In this article, we will discuss about Diffie Hellman Key Exchange Algorithm.
Both sender and receiver use a common secret key to encrypt and decrypt the message.
The major issue is exchanging the secret key between the sender and the receiver.
Attackers might intrude and know the secret key while exchanging it.
This algorithm is used to exchange the secret key between the sender and the receiver.
This algorithm facilitates the exchange of secret key without actually transmitting it.
Let-
Step-01:
One of the parties choose two numbers ‘a’ and ‘n’ and exchange with the other party.
‘a’ is the primitive root of prime number ‘n’.
After this exchange, both the parties know the value of ‘a’ and ‘n’.
Step-02:
Ys = aXs mod n
Yr = aXr mod n
Step-03:
Finally, both the parties obtain the same value of secret key.
Suppose that two parties A and B wish to set up a common secret key (D-H key) between themselves using the Diffie Hellman key exchange
technique. They agree on 7 as the modulus and 3 as the primitive root. Party A chooses 2 and party B chooses 5 as their respective secrets. Their
D-H key is-
1. 3
2. 4
3. 5
4. 6
Solution-
Given-
n=7
a=3
Private key of A = 2
Private key of B = 5
Step-01:
Both the parties calculate the value of their public key and exchange with each other.
Public key of A
= 32 mod 7
=2
Public key of B
= 35 mod 7
=5
Step-02:
Both the parties calculate the value of secret key at their respective side.
= 52 mod 7
=4
Secret key obtained by B
= 25 mod 7
=4
Finally, both the parties obtain the same value of secret key.
Problem-02:
In a Diffie-Hellman Key Exchange, Alice and Bob have chosen prime value q = 17 and primitive root = 5. If Alice’s secret key is 4 and Bob’s secret
key is 6, what is the secret key they exchanged?
1. 16
2. 17
3. 18
4. 19
Solution-
Given-
n = 17
a=5
Private key of Alice = 4
Private key of Bob = 6
Step-01:
Both Alice and Bob calculate the value of their public key and exchange with each other.
= 54 mod 17
= 13
= 56 mod 17
=2
Step-02:
Both the parties calculate the value of secret key at their respective side.
= 24 mod 17
= 16
= 136 mod 17
= 16
Finally, both the parties obtain the same value of secret key.
Summary
How Digital Signature Works | Algorithm
Computer Networks
Digital Signatures-
The signature on a document is the proof to the receiver that the document is coming from the correct entity.
A digital signature guarantees the authenticity of an electronic document in digital communication.
At Sender Side-
At sender side,
Using a hash function, sender converts the message to be sent into a digested form.
There are various hash functions that may be used like SHA-1, MD5 etc.
The message in digested form is called as message digest.
Sender encrypts the message digest using his private key.
The encrypted message digest is called as signed digest or signature of the sender.
Sender sends the signed digest along with the original message to the receiver.
At Receiver Side-
At receiver side,
Important Points-
Point-01:
After digitally signing the document, sender sends the following two things to the receiver-
Point-02:
Point-04:
In digital signature,
Point-05:
Authenticity
Integrity
Non-repudiation
Problem-01:
Anarkali digitally signs a message and sends it to Salim. Verification of the signature by Salim requires-
Solution-
Consider that B wants to send a message m that is digitally signed to A. Let the pair of private and public keys for A and B be denoted by Kx– and
Kx+ for x = A, B respectively. Let Kx(m) represent the operation of encrypting m with a key Kx and H(m) represent the message digest. Which one
of the following indicates the correct way of sending the message m along with the digital signature to A?
1. {m, KB+(H(m))}
2. {m, KB–(H(m))}
3. {m, KA–(H(m))}
4. {m, KA+(H(m))}
Solution-
Summary
Publisher Logo
Liked this article? Share it with your friends and classmates now-
Introduction to Firewalls v1.01 – Aaron Balchunas 1
- Introduction to Firewalls -
Firewall Basics
Traditionally, a firewall is defined as any device (or software) used to filter
or control the flow of traffic. Firewalls are typically implemented on the
network perimeter, and function by defining trusted and untrusted zones:
Most firewalls will permit traffic from the trusted zone to the untrusted
zone, without any explicit configuration. However, traffic from the
untrusted zone to the trusted zone must be explicitly permitted. Thus, any
traffic that is not explicitly permitted from the untrusted to trusted zone will
be implicitly denied (by default on most firewall systems).
A firewall is not limited to only two zones, but can contain multiple ‘less
trusted’ zones, often referred to as Demilitarized Zones (DMZ’s).
To control the trust value of each zone, each firewall interface is assigned a
security level, which is often represented as a numerical value or even color.
For example, in the above diagram, the Trusted Zone could be assigned a
security value of 100, the Less Trusted Zone a value of 75, and the
Untrusted Zone a value of 0.
As stated previously, traffic from a higher security to lower security zone is
(generally) allowed by default, while traffic from a lower security to higher
security zone requires explicit permission.
***
All original material copyright © 2007 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Introduction to Firewalls v1.01 – Aaron Balchunas 2
Firewall Services
Firewalls perform the following services:
• Packet Filtering
• Stateful Packet Inspection
• Proxying
• Network Address Translation (NAT)
Each will be covered in some detail in this guide.
Packet Filtering
Packet Filtering is one of the core services provided by firewalls. Packets
can be filtered (permitted or denied) based on a wide range of criteria:
• Source address
• Destination address
• Protocol Type (IP, TCP, UDP, ICMP, ESP, etc.)
• Source Port
• Destination Port
Packet filtering is implemented as a rule-list:
Number Action Protocol Source Add. Source Port Destination Add. Destination Port
***
All original material copyright © 2007 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Introduction to Firewalls v1.01 – Aaron Balchunas 3
Proxy Services
A proxy server, by definition, is used to make a request on behalf of another
device. It essentially serves as a middle-man for communication between
devices.
This provides an element of security, by hiding the actual requesting source.
All traffic will seem to be originated from the proxy itself.
Traditionally, proxy servers were used to cache a local copy of requested
external data. This improved performance in limited-bandwidth
environments, allowing clients to request data from the proxy, instead of the
actual external source.
Other services that proxy servers can provide:
• Logging
• Content Filtering
• Authentication
***
All original material copyright © 2007 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Introduction to Firewalls v1.01 – Aaron Balchunas 4
(Reference: http://www.cisco.com/en/US/tech/tk648/tk361/technologies_white_paper09186a0080194af8.shtml)
***
All original material copyright © 2007 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Introduction to Firewalls v1.01 – Aaron Balchunas 5
Types of NAT
NAT can be implemented using one of three methods:
Static NAT – performs a static one-to-one translation between two
addresses, or between a port on one address to a port on another address.
Static NAT is most often used to assign a public address to a device behind a
NAT-enabled firewall/router.
Dynamic NAT – utilizes a pool of global addresses to dynamically translate
the outbound traffic of clients behind a NAT-enabled device.
NAT Overload or Port Address Translation (PAT) – translates the
outbound traffic of clients to unique port numbers off of a single global
address. PAT is necessary when the number of internal clients exceeds the
available global addresses.
NAT Terminology
Specific terms are used to identify the various NAT addresses:
• Inside Local – the specific IP address assigned to an inside host
behind a NAT-enabled device (usually a private address).
• Inside Global – the address that identifies an inside host to the
outside world (usually a public address). Essentially, this is the
dynamically or statically-assigned public address assigned to a private
host.
• Outside Global – the address assigned to an outside host (usually a
public address).
• Outside Local – the address that identifies an outside host to the
inside network. Often, this is the same address as the Outside Global.
However, it is occasionally necessary to translate an outside (usually
public) address to an inside (usually private) address.
For simplicity sake, it is generally acceptable to associate global addresses
with public addresses, and local addresses with private addresses.
However, remember that public-to-public and private-to-private translation
is still possible. Inside hosts are within the local network, while outside
hosts are external to the local network.
***
All original material copyright © 2007 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Introduction to Firewalls v1.01 – Aaron Balchunas 6
Consider the above example. For a connection from HostA to HostB, the
NAT addresses are identified as follows:
• Inside Local Address - 10.1.1.10
• Inside Global Address - 55.1.1.1
• Outside Global Address – 99.1.1.2
• Outside Local Address – 99.1.1.2
HostA’s configured address is 10.1.1.10, and is identified as its Inside Local
address. When HostA communicates with the Internet, it is stamped with
RouterA’s public address, using PAT. Thus, HostA’s Inside Global address
will become 55.1.1.1.
When HostA communicates with HostB, it will access HostB’s Outside
Global address of 99.1.1.2. In this instance, the Outside Local address is also
99.1.1.2. HostA is never aware of HostB’s configured address.
It is possible to map an address from the local network (such as 10.1.1.5) to
the global address of the remote device (in this case, 99.1.1.2). This may be
required if a legacy device exists that will only communicate with the local
subnet. In this instance, the Outside Local address would be 10.1.1.5.
Static NAT Translation
99.1.1.2 = 192.168.1.5
The above example demonstrates how the source (SRC) and destination
(DST) IP addresses within the Network-Layer header are translated by NAT.
(Reference: http://www.cisco.com/warp/public/556/8.html)
***
All original material copyright © 2007 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Introduction to Firewalls v1.01 – Aaron Balchunas 7
Implementing a DMZ
As briefly described earlier, a DMZ is essentially a less trusted zone that
sits between the trusted zone (generally the LAN) and the untrusted zone
(generally the Internet). Devices that provide services to the untrusted world
are generally placed in the DMZ, to provide separation from the trusted
network.
A single firewall with multiple ports can be used to implement a logical
DMZ:
***
All original material copyright © 2007 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.