Network Short Notes
-
Upload
patrick-ciantar -
Category
Documents
-
view
236 -
download
1
Transcript of Network Short Notes
-
7/28/2019 Network Short Notes
1/13
ISO OSI and TCP Model
Layer Description
Physical
This deals with the physical aspect of a network,
i.e. electrical or light signals sent between local
devices. Includes Encoding and Signalling,
physical data transfer, hardware specifications,
topology and design.
Data Link
Deals with low-level data messages between
local devices. Includes logical link control, data
framing, error detection and handling.
Network
Deals with messages between local or remote
devices. Includes addressing, routing, datagram
encapsulation and fragmentation and
reassembly.
Transport
Deals with the communication between software
processes. Includes process-level addressing,
multiplexing / de-multiplexing, segmentation and
re-assembly, ACK and flow control.
Session
Deals with sessions between local and remote
devices. Includes session establishment,
management and termination.
Presentation
Deals with application data representation
including data transmission, compression and
encryption.
ApplicationDeals with application data associated with user
application such as email programs.
Figure 1: TCP vs ISO OSI
-
7/28/2019 Network Short Notes
2/13
Shannon-Hartley Law
The ShannonHartley theorem tells the maximum rate at which information can be transmitted over a
communications channel of a specified bandwidth in the presence of noise.
= log (1 +)
Automatic Repeat Requests
Stop and Wait
Sender waits for an ACK for each send frame Frames may be damaged or lost, same for ACK No NACKs for lost or error frame Sender uses a timer and resends frame A 1-bit frame number (0 or 1) is needed for data and ACK frames. This value alternates when
data is ACKed (new data sent), but remains the same when data is resent.
Go Back N
Receiver has no buffer It can only accept (and send) a correct frame with the next expected sequence number.
o Sends an ACK for that sequence number, which implies that all previous frames havearrived.
Otherwise it discards the frame and:o Either sends nothing back, oro Sends an ACK for the last accepted frameo Sends a NACK for the next frame
Receiver time to send ACK or NACK in separate frame.Selective Repeat
Receiver buffers frameso Can store out-of-order correct frames
Only 1 frame has to be resent in case of error or loss NACKs are usually used for error or lost frames Sender needs timer of each send frame Receiver timer to send ACK or NACK in separate frame.
Trade-Offs between Go-Back-N and Selective Repeat
Since Go-Back-N only has a buffer on the sender side, if a frame is lost or corrupted, the frameshave to be resent starting from the last ACKed frame.
Since Selective Repeat has a buffer on both the sending and receiving side, only the lost orcorrupted frame needs to be resent.
-
7/28/2019 Network Short Notes
3/13
Media Access Control (MAC)
CSMA/CD
CSMA/CD is a media access control method. It is a modification of the pure CSMA where a transmission
is terminated if a collision is detected (CD).
Figure 2: CSMA Flow Chart
1. The station that wants to transmit first listens to check if another transmission is in progress.2. If medium is in use, station waits, else it transmits3. Transmitter waits for ACK, if none, retransmits4. If Station transmits and no collisions occur during the time the leading edge of frame takes to
propagate to the farthest station, then no collisions.
5. CD: If collision is detected, terminate transmission.Collisions can still occur when 2 or more stations begin transmitting within a short time of each other.
CSMA/CD is not required with GigabitEthernet since the normal mode of operation for Gigabit Ethernet
is full-duplex, which allows traffic in both directions at the same time. In this configuration, all lines are
buffered, so each computer and switch is free to send frames whenever it wants to. On the computer
and a switch, the computer is the only possible sender on the line to the switch. Since no contention is
possible, the CSMA/CD protocol is not used.
Figure 3 Why collision detection takes 2
-
7/28/2019 Network Short Notes
4/13
IPV4
Figure 4 IPV4 Header
Field Description
IHL Defines how long the header is, in 32 bit words.
Type of ServiceContains a 3-bit precedence field used for thepriority and 3 flags: delay, throughput and
reliability, to specify what is most important in
the packet
Time to Live (TTL)
The TTL field is a counter to limit packet lifetimes.
It must decrement at each hop and the packet is
discarded when it reaches 0.
Protocol
This field tells the receiving host which transport
process (TCP / UDP / etc) the packet should be
given to.
Header ChecksumThis is used to verify the header only, useful for
detecting errors.
The fields used for fragmentation are the flag and fragmentation offset. Flag is a 3-bit field and is used
to control or identify fragments. The fragment offset is the offset of a particular fragment to the
beginning of the original IP datagram.
-
7/28/2019 Network Short Notes
5/13
TCP/IP
TCP provides a reliable byte stream over an unreliable internetwork. TCP accepts user data streams
from local processes, breaks them up into pieces not exceeding 64k and sends each piece as a separate
IP datagram. The receiver side gives IP datagrams containing TCP data to its TCP entitiy, which
reconstructs the original byte streams. IP gives no guarantees that datagrams will be delivered properly,so its up to TCP to time out, retransmit, and re-order them in the proper sequence.
Figure 5 TCP/IP Header
Field DescriptionSource Port Identifies the sending port
Destination Port Identifies the receiving port
Sequence Number
If SYN = 1, this is the sequence number of the actual first data byteand the ACK number in the corresponding ACK is this number + 1.
If SYN = 0, this is the accumulated sequence number of the firstdata byte of this segment.
Acknowledgement
Number
If ACK = 1, value of this field is the next sequence number that the receiver
is expecting.
TCP Header Length Specifies the size of the Header in 32 bit words.
Flags (SYN, FIN, ACK, etc)Number of 1 bit flags used for dealing with acknowledgements,
terminations, etcWindow Size
The size of the receive window which specifies the number of window size
units that the sender of the segment is currently willing to receive.
Checksum Used for error checking of both header and Data
Urgent PointerIf flag URG = 1, the value is an offset from the sequence number indicating
the last urgent data byte.
OptionsUsed to add padding so that the TCP header ends (and the data begins) on
a 32 bit boundary.
-
7/28/2019 Network Short Notes
6/13
TCP Connection Protocol Full-Duplex
Figure 6 TCP half duplex 3-way handshake
1. The initiator (A) sends a SYN to the listener (B), and sets the sequence number to a randomvalue .
2. In response, B replies with a SYN-ACK. The acknowledgement number is set to + 1, and thesequence number is another random value .
3. A sends an ACK back to B, the sequence number is set to the received acknowledgment number( + 1) and the acknowledgement number is set to + 1.
Figure 7Special Case TCP connection
This diagram shows what happens when two devices try to open a connection to each other at the same
time. In this case instead of a three-way handshake, each sends a SYN and receives an ACK. They each
follow the same sequence of states, which differs from both sequences in the normal three-wayhandshake.
-
7/28/2019 Network Short Notes
7/13
TCP Connection Termination
Figure 8 TCP Connection Termination
TCP Congestion Control
Slow Start:
Slow start is part of the congestion control strategy used by TCP. It is used to avoid sending more data
than the network is capable of transmitting, that is, to avoid network congestion.
The congestion window is doubled on each packet successfully sent (an ACK received before timeout).
This exponential increase continues until the threshold (initially 32k) is reached, after which the increase
is linear. When a timeout occurs, the threshold is set for half the current congestion window, and the
slow start is repeated.
Congestion Avoidance:
Upon receiving an ACK the congestion window (cwind) is increased by
. This is an additiveincrease, as opposed the multiplicative increase of the basic slow start.
Accurate retransmission timeout estimation:
If the retransmission timer is too short, unnecessary retransmissions will occur. On the other hand, if
too long, a long transmission delay will occur.
A number of algorithms are available to replace the basic RTT timer value, including Jacobson and Karns
algorithms.
Error Detection / Correction
On channels that are highly reliable, such as fiber, it is cheaper to use an error detecting code. On channels such as wireless links, that have many errors, it is better to add enough redundancy
to each block for the receiver to be able to figure out what the original block was.
-
7/28/2019 Network Short Notes
8/13
Hamming Code Example
Bit stream: 10101111
20 2 2 231 2 3 4 5 6 7 8 9 10 11 12
P1 P2 1 P4 0 1 0 P8 1 1 1 1
Bit Index Made up of:
Bit 3 P1 + P2
Bit 5 P1 + P4
Bit 6 P2 + P4
Bit 7 P1 + P2 + P4
Bit 9 P1 + P8
Bit 10 P2 + P8
Bit 11 P1 + P2 + P8
Bit 12 P4 + P8
Odd Parity
P1 = 3, 5, 7, 9, 11
(Bit Value) 1 0 0 1 1 0
P2 = 3, 6, 7, 10, 11
(Bit Value) 1 1 0 1 1 1
P3 = 5, 6, 7, 12
(Bit Value) 0 1 0 1 1
P4 = 9, 10, 11, 12
(Bit Value) 1 1 1 1 1
Final Bit Stream:
01110101111
Cyclic Redundancy Check (CRC)
The CRC bit is typically put in the trailer so that the calculations, for both the sender and receiver, can be
both made without the need of memory. From the sender side, as the data is being transmitted, the
CRC value can be calculated and after all the data is finished being transmitted (and the CRC being
updated each step), the CRC value is then added to the trailer. On the receiving side, as the data is
coming in, the CRC may be calculated (as the data is updated) and then checked with the CRC value inthe trailer. If the CRC were to be in the header, the sender would have to calculate the CRC based on
the data, send it in the header, and then send the data. The receiver would receive the CRC first, store
it, receive the data, calculate the CRC and compare it to the saved data. Thus putting CRC in the trailer
allows the process to be real-time (on the go).
-
7/28/2019 Network Short Notes
9/13
User Datagram protocol (UDP)
Figure 9
UPD Header
No Connection establishment No reliability No ordering No Flow or congestion Control
UDP is basically IP with a shorter header added. The port numbers indicate the sending and receiving
transport endpoints. When a UDP packet arrives its payload is sent to the process attached to the
destination port.
The checksum is optional and stored as 0 if not computed, a calculated 0 checksum is stored as all 1s.
UDP does not do flow control, error control or retransmission upon receipt of bad datagrams.
Domain Name System (DNS)
The DNS maps host names to IP addresses and Vice versa.
Application calls resolver with name Resolver contacts local DNS server (using UDP) passing the name Server returns with corresponding IP address
By using a distributed hierarchy of servers the system has better scalability and does not present a single
point of failure. If DNS were to crash, one could only use IP addresses and not host names when
accessing servers on the internet.
Real Time Transport Protocol (RTP) is intended for real time multimedia applications, it multiplexes
several real-time data streams into a single stream of UDP packets.
HTTP
HTTP is the transfer protocol used throughout the world wide web. It specifies what messages clients
may send to servers and what responses to get in return. All clients and servers must obey this protocol.
Each HTTP request consists of one of more lines of ASCII text, with the first word on the first line being
the name of the method requested. There are a number of methods, such as: GET, HEAD, PUT, etc
Client Side
Clicking in a browser on http://www.cs.ru.nl/~ths/index.html.
The steps that occur then are:
1. The browser determines the URL (by seeing what was selected)2. The browser asks DNS for the IP address of www.cs.ru.nl3. DNS answers with the IP number1544. The browser makes a TCP connection to that number on port 80
-
7/28/2019 Network Short Notes
10/13
5. It then sends a GET /~ths/index.html command6. The www.cs.ru.nl server sends the file index.html7. The TCP connection is released8. The browser displays all the text in index.html9. The browser fetches all images indicated in index.html, by establishing a TCP connection for
each of them, and displays them.
Server Side
This performs the following steps in its main loop:
1. Accept a TCP connection from a client.2. Resolve the name of the page requested.3. Authenticate the client if needed.4. Perform access control on the client, can the requested page be sentgiven the client's identity
and location.
5. Perform access control on the web page, some pages may only been sent to clients on particulardomains, e.g. inside the company.
6. Check the cache if the page is there, otherwise get it from disk.7. Determine the MIME type and include it in the header of the reply.8. Other possible tasks, like building a user profile, gathering statistics or making an entry in a
logfile.
9. Return a reply, either the requested file or error information10.Release the TCP connection
Types of Networks
Circuit switching
For each connection, physical switches are set in the network to create a physical circuit. Switches are
set up at the beginning of the connection and maintained throughout the connection. Network
resources are reserved and dedicated.
Example: Telephone Network
Packet Switching
In this switching method, instead of establishing a dedicated line between the sender and receiver, the
message is sent to the nearest, directly connected switching node. This node stores the message,
checks for errors, selects the best available route and forwards the message to the next intermediate
node. To reduce the required storage size messages are divided into subsets of equal length called
packets. Each packet is composed of the payload (data), and a header, which contains information
useful for network layer functions such as the source and destination addresses.
Example: The internet (TCP/UDP)
Virtual Circuit Switching
At connection establishment time, the path from source to destination is selected and used throughout
the connection lifetime. Thus, packets passing though the route can have a short header, containing
only a virtual circuit identifier (VCI) and not their destination.
-
7/28/2019 Network Short Notes
11/13
Example: Frame Relay
Figure 10
Virtual Circuit Vs. Datagram Subnet
Repeaters, Hubs, Bridges, Switches, Routers and Gateways
A bridge connects two or more LANs A switch is more often used to connect individual computers A router gets the packet out of a frame and uses the information in the packet header, for
example the IP addresses.
A transport gateway receives e.g. a TCP packet and uses the header information to decide whatto do with the packet.
An application gateway understands the format and content of the data. It can translatemessages from on format to another. Might also be used for security, for example, blocking
messages.
Figure 11 Comparison to Layers
-
7/28/2019 Network Short Notes
12/13
Ethernet
Figure 12 Ethernet Frame Format
Field Description
Preamble 7 bytes used to synchronize clocks
Start of Frame (SOF) Contains 10101011
Addresses
Unique values in the world of 6 bytes each. Address containing all 1s is reserved for broadcast, a
message destined to all receivers.
LengthVariable uses, most common is type field that indicates that the data
is a higher level protocol packet.
Data Data
Pad Used so that the frame has always the same lengthChecksum Used for error checking
Dynamic Routing
Distance Vector routing
A routing table in each router contains, for each router, the preferred outgoing line for the router and
the estimate cost to that destination. The cost metric might be number of hops, queue length, time
delay, etc
Once every T msec each router sends its neighbours a list of estimated costs to each destination.
Link State Routing
In Link State routing each router sends the costs to the immediate neighbours to all the routers in the
network.
Each router must:
1. Discover its neighbours, learn their network addresses2. Measure the delay or cost to each of its neighbours3. Construct a packet telling all it has just learned4. Send this packet to neighbouring routers5. Compute the shortest path to every other router
Summary:
In Distance Vector, each node talks only to its directly connected neighbours, but it tells themeverything it has learned the distance to all nodes.
In Link State, each node talks to all other nodes, but it tells them only the state of its directlyconnected links.
-
7/28/2019 Network Short Notes
13/13
Fragmentation
Figure 13 Transparent (a) and Non-transparent (b) fragmentation
Fragmentation happens when a message is larger than the maximum allowable network packet size.
Transparent:
Small packets are transparent to other networks Packet is reassembled at exit gateway
Other networks are not aware fragmentation occurred Exit Gateway must know that all pieces were received (fragment counter or end of
packet bit)
May have to repeatedly fragment and reassemble to travel through a series ofnetworks.
Non-Transparent
Reassembly only occurs at destination host Each Fragment becomes a separate packet and may be routed independently. Every packet (fragment) must carry header until it reaches destination host.
Internet Control Message Protocol (ICMP)
When something unexpected occurs in a router or host, this event is reported by ICMP. It is also used
by routers to test the internet or to obtain information to be used in routing decisions (ECHO).
Messages include: Time Exceeded, Echo, and Echo reply.