1 tutorial on computer networks ece 7750: distributed control system lili ma department of...
TRANSCRIPT
1
Tutorial on Computer NetworksECE 7750: Distributed Control System
Lili MaDepartment of Electrical & Computer Engineering
Utah State University
January 2005
2
Contents
►Physical Layer:
Guided Transmission Media
Wireless Transmission Media
Communication Networks
►Introduction:
Classification
Software
►Data Link Layer:
Services
Framing
Error Control
Flow Control
►Ethernet:
Connecting Devices
Evolution of Ethernet
Wireless LAN
►Network Layer:
Routing Algorithms
Congestion Control
Quality of Services
IP Protocols
►Transport Layer:
UDP and TCP
►Application Layer Protocols
Back to TOC
3
►Introduction
Back to TOC
Distinguish Between Two Important Concepts:• Computer Networks:
A large number of separate but interconnected computers.
Example: LAN, WAN, Internet.
• Distributed Systems:
A software system built on top of a computer network that appears to its users as a single coherent system.
Example: WWW (world wide web).
4
Usages of Computer Networks
• Business Applications:– Resource sharing: printer, scanner, custom records, inventories.
– Communication medium: email, file update, video conferencing.
– Enable companies to do business electronically or online.
• Home Applications:– Access to remote information.
– Person-to-person communication.
– Interactive entertainment.
• Mobile Users:– Mobile & wireless notebook computers.
– Portable office, PDS for store inventory.
Back to TOC
5
Network Classification
• Transmission Technology:
– Broadcasting: Broadcasting or multicasting.
– Point-to-point, also called unicasting.
• Scale:
– PAN: processors located in same square meter.
– LAN: processors located in same room, building, campus.
– WAN: processors located in same city.
– MAN: processors located in same country, continent.
– Internet: processors located in same planet.
Back to TOC
6
LAN and MAN
Back to TOC
Bus
Ring
• LAN:
• MAN:
7
WAN and Internet
Back to TOC
• WAN:
– Subnet consists of transmission lines and switching elements (such as routers).
• Internet:
– A collection of interconnected networks.
8
Wireless Networks
Back to TOC
Wireless Networks:• Bluetooth Configuration: Master-slave configuration
• Wireless LAN.
Bluetooth Configuration Wireless LAN
9
Software Protocol Hierarchy
Back to TOC
• Information is passed from higher layer to lower layer for transmission. Appropriate headers and/or tailors are added.
• Pieces of information is delivered from lower layer to higher layer where the data load is extracted.
Dashed: Virtual Communication
Solid: Actual Communication
10
Service vs. Protocol
Back to TOC
• Service: a set of operations that a layer provides to its layer above.
• Protocol: a set of rules governing the transmitting between peers of the same layer.
11
Services
Back to TOC
• Connection-oriented/connectionless:
– Whether or not sequence (or order) can be guaranteed.
– Connection-oriented: modeled after the telephone system.
– Connectionless: modeled after the postal office.
• Reliable/Unreliable:
– Whether or not there are ACKs.Connection-oriented Connectionless
ReliableFile Transfer
We want sequence of data and the correctness of data.
Acked DatagramModeled after the register letter. We don’t care how the letter is routed,
but make sure it is arrived by requesting a receipt – ACK
UnreliableVoice/Video Transmission
We want the sequence but not the reliability since the speed is
more important than correctness
Called Datagram Service
12
OSI vs. TCP/IP Models
Back to TOC
13
OSI Layers
Back to TOC
• Physical Layer:
Transmit raw bits over a communication channel.
• Data Link Layer:
Ensure raw transmission appear to be free of undetected error.
• Network Layer:
Control the operation of subnet. Do the routing.
• Transport Layer: End-to-end layer.
Accept data from above, send to the receiver.
• Application Layer:
A variety of protocols commonly used by users.
14
TCP/IP Layers
Back to TOC
• Internet Layer: IP Protocol.
Permit packets to be transmitted independently to destination
• Transport Layer: Allow peers to have conversations.
– TCP: Reliable and connection-oriented.
– UDP: Unreliable and connectionless.
• Application Layer:
A variety of protocols commonly used by users.
15
►Physical Layer
Back to TOC
• Fact:
No transmission facilities can transmit signals without lose of power.
• Bandwidth:
The range of frequencies transmitted without being strongly attenuated. The bandwidth can depend on:
– Transmission media.
– Transmission distance.
– Signal-to-noise ratio.
– Thickness, construction, and ….
16
Guided Transmission Media
Back to TOC
• Magnetic Media: Write data onto magnetic tape or removal media and physically transport the media to destination.
– Advantages: Excellent bandwidth.
– Disadvantages: Slow.
• Unshielded Twisted Pair (UTP): Consists of two twisted copper pair.
– Application: Telephone system.
– Be able to transmit analog/digital signals.
Category 3 UTP Category 5 UTP
17
Guided Transmission Media (cont)
Back to TOC
• Coaxial Cable:
– Can span longer compared with twisted pairs.
– High bandwidth.
– Excellent noise immunity.
– Used to be widely used within telephone system, now
replaced by fiber optics. Still widely in use in cable TV and
MAN.
18
Guided Transmission Media (cont)
Back to TOC
• Fiber Optics:
– Light Source: pulse (absence) of light indicates “1” (“0”).
– Detector (Photodiode): generates electrical pulse in response to light.
– Multimode: multiple rays bouncing inside the media
– Single-mode: when the fiber’s diameter is reduced to few
wavelengths of light, light will propagate in a straight line.
(a) Side view of a single fiber
(b) End view of a sheath with three fibers.
Light Source
Multimode Operation
19
Wireless Transmission
Back to TOC
• Principle:– When an antenna of appropriate size is attached to an electrical circuit, the electromagnetic waves can be broadcasted and received by a receiver some distance away.– In vacuum, electromagnetic waves travel at the speed of light.– In copper or fiber, this speed slows down.
• Wireless Transmission Media:– Radio Transmission.– Microwave Transmission.– Infrared and Millimeter Waves.– Lightwave Transmission.
20
Electromagnetic Spectrum
Back to TOC
The electromagnetic spectrum and its uses for communication.
21
Wireless Transmission (cont)
Back to TOC
• Radio Transmission:
– Easy to generate, subject to interference from electrical
devices, frequency dependent.
– Low (omnidirectional): pass through objects, power decreases
sharply. The transmitter & receiver do not have to be aligned.
– High (travel straightly): bounce off objects, absorbed by rain.
High FrequencyLow Frequency
22
Wireless Transmission (cont)
Back to TOC
• Microwave Transmission:
– Travel in nearly straight lines.
– Can be narrowly focused.
– Transmitter & receiver need to be aligned.
– Widely used for long-distance mobile phones.
• Inferred Transmission:
– Used for short-range communication, TV remote control.
– Relatively directional, cheap, easy to build.
– Drawback: Cannot penetrate objects.
– Advantage: Communication in one room will not interfere
with neighbors.
23
Examples of Communication Networks
Back to TOC
• PSTN (Public Switched Telephone Network):
Each local loop is independent.
Physically circuit switched.
• Mobile Phones:
The local loop uses wireless transmission media.
Frequency reuse.
• Cable TV:
Neighbors share the same physical medium. Competitions exist among neighbors for bandwidth. Security can be an issue.
24
Switching Techniques
Back to TOC
• Circuit Switching:– Physical path is established before transmission.– This dedicated path is available till finish.
• Message Switching:– No physical path is established before transmission.– No limitation on data/block size.– Thus requires router to have disk for storing.– Data is stored at router before being forwarded.
• Packet Switching:
– Strict upper limit about packet size.– Packet can be stored at router’s memory, instead of hard disk.– Be able to handle traffic much better.
25
Switching Techniques (cont)
Back to TOC
(a) Circuit switching (b) Packet switching
26
Switching Techniques (cont)
Back to TOC
Computer network is always packet switching,
occasionally circuit-switching, and
never message-switching.
27
►Data Link Layer
Back to TOC
Tasks of Data Link:• To achieving reliable and efficient communications between
adjacent machines.
• By adjacent, we mean that two machines are connected by a communication channel, “like” a wire.
• The “wire-like” channel guarantees the order of bits exactly as they are sent.
• The data link layer is not an end-to-end layer. Protocols happen among adjacent computers
28
Position of Data Link
Back to TOC
29
Problems Might Encounter
Back to TOC
Problems that might be encountered:
• There are errors in the physical communication layer.
• The physical layer only provides finite data rate.
• There exists non-zero propagation delay between T-send and T-receive.
A simple thinking of data link layer is:“A puts bits on wire and B gets them”.
30
Function & Design Issues of Data Link
Back to TOC
Functions of Data Link:
– Provide service interfaces to network layer.
– Dealing with transmission errors.
– Regulating flow control.
Design Issues of Data Link:
– Services provided to Network layer.
– Framing.
– Error control.
– Flow control.
31
Services Provided by Data Link
Back to TOC
• Un-Acked Connectionless Service:
– No logical channel is established.– Independent frames are sent without Acks.– No attempt is made for lost frames (left to higher layer).– Suitable over reliable channels (fiber).
Hope for the best!
Ack: No.Timer: No.Sequence #: No. Error Control: No.
32
Services Provided by Data Link (cont)
Back to TOC
• Acked Connectionless Service:
– No logical channel is established.
– Frame is individually Acked!
– If a frame has not been received for certain amount time, re-send.
– Suitable over un-reliable channels (wireless).
Ack: Yes.Timer: Yes.Sequence #: No. Error Control: Yes.
33
Services Provided by Data Link (cont)
Back to TOC
• Acked Connection-Oriented Service:
– Logical channel is established.
– Frame is guaranteed to be received!
– Each frame is received exactly once!
– All frames are received in the right order!
– Frame is numbered!
– Three phases: Initialization, Send, Release.
Ack: Yes.Timer: Yes.Sequence #: Yes. Error Control: Yes.
34
Services Provided by Data Link (cont)
Back to TOC
• Acked service is not a necessity in Data Link since higher layer (Network, for example) can also do the job.
• However, if frames are individually Acked, packets can get through faster.
• For reliable channels, this might be unnecessary.
• For un-reliable channels, this is worth doing.
35
Framing
Back to TOC
• What is framing?
Break raw bits into discrete frames.
• Why framing?
Can add a field for error detection (checksum).
Packets from Network Layer Frames by Data Link
36
Framing Methods
Back to TOC
Character Count:A field in the header tells the # of characters in each frame.
• Problems of Character Count:– It will not help to re-send, since the sender does not know how
many characters to skip over to re-transmit.
– Due to the above problem, character count is rarely used anymore
alone.
37
Framing Methods (cont)
Back to TOC
Flag Byte:– To get around the problem of re-synchronization.
– Each frame starts and ends with special bytes (can be same), called flag byte.
– If get lost, the receiver can search for “flag byte” for frame boundary.
In actual usages, many protocols use combinations of “character count” plus “flag” for safety purpose.
38
Error Control
Back to TOC
Ultimate Goal:
By managing timers and sequence # to ensure that each frame is passed to the layer above (not just received by the receiver) exactly once, no more and no less!
Error will be with us for several/many years to come.
We have to live with it and deal with it.
39
Error Control (cont)
Back to TOC
• The receiver provides Acks to received frames.
• How about when a whole frame is lost?
– Action of receivers: receive nothing, do nothing.
– Action of senders: have sent something, get no Ack, wait for
certain time (timer is assumed), re-send.
• Problem arising from retransmission:
– The same frame might be received many times and delivered
to “network” layer many times.
– To solve this problem, add sequence # in each frame,
receiver will know if the same frame has been received many
times.
40
Error Control: Piggybacking
Back to TOC
• To improve efficiency.
• The receiver attaches Acks to outgoing frames to get a “free ride”.
• The Ack needs to be sent out “soon” (due to sender’s timer).
• The data link of receiver side has no way to foretell when a new frame will come from Network Layer.
The rule is to wait for certain time, if a new frame comes, then the Ack gets a free ride, else send the Ack independently.
41
Flow Control
Back to TOC
• When the receiver is slow and cannot process all the data received, some data might get lost.
• Methods:
– Feedback-based: the receiver updates its status or sends
permission for the sender to send.
– Rate-based: (usually in higher level).
42
Flow Control: Stop-and-Wait
Back to TOC
Stop-and-Wait:
• The sender waits for an Ack after sending each frame.
• Only when an Ack is received, or timer out, next frame goes.
– Advantage: simple.
– Disadvantage: slow and inefficient since each frame is alone
on the wire.
Deal with damaged frame?Deal with lost frame?Deal with lost ACK/NACK?
43
Flow Control: Sliding Window
Back to TOC
Sliding Window:
• The sender can transmit multiple frames at a time, thus increases efficiency.
• The receiver Acks some of the frames, using a single Ack to confirm the receipt of multiple frames.
– Advantage: more efficient.
– Disadvantage: complex.
Deal with damaged frame?Deal with lost frame?Deal with lost ACK/NACK?
44
Sliding Window Protocols
Back to TOC
• Sliding Window Protocols:
– One-bit sliding window.
– Go back N.
– Selective Repeat.
• The protocols differ in efficiency, complexity, buffer Size.
• Both the sender and receiver maintain their own windows.
45
Sliding Window Protocols (cont)
Back to TOC
• Sending Window:
– At any time, the sender maintains a set of Seq.#
corresponding to frames it is allowed to send.
– Seq.# that falls into the sending window represents frames
that have been sent or can be sent but are not Acked.
• Receiving Window:
– Corresponds to frames it may accept.
• The sending window and receiving window can have different sizes.
46
One-Bit Sliding Window
Back to TOC
Sliding window of size 1:
Initially After the first frame is sent
After the first frame is received
After the first Ack is received
47
One-Bit Sliding Window (cont)
Back to TOC
• In one-bit sliding window, though the transmission is bi-directional, the hosts are still blocked by waiting for Acks.
• When the transmission time is not negligible, it means the available bandwidth is not used properly.
Solution: To allow the sender to send more frames before being blocked.
• With an appropriate choice of window size, the sender will be able to continuously transmit frames for a time equal to the round-trip transmission time.
• Bandwidth increases window size increases.
• Delay increases window size increases.
• The sliding window can help to keep the “line” busy!
48
S R0123
S R1234
0
S R2345
10
S R4567
3210
S R5678
4321
Frame #
Ack #
…………
Sliding Window (cont)
Back to TOC
Illustration to improve efficiency:
49
Sliding Window: Go-Back-N
Back to TOC
Go Back N:– Discard all subsequent frames and send no Acks back to the
sender. Send Acks to frames correctly received.
– Eventually, timer times out and the sender resends again.
– Suitable for reliable channels where error rarely occurs.
– Buffer on receiver side: not required (just deliver correct frames to Network Layer above)
– Buffer on sender side: required (to remember what to re-send)
– The protocol is relatively simple.
50
Sliding Window: Selective Repeat
Back to TOC
Selective Repeat:– Buffer all subsequent frames that are “good” and send NAK
(negative Ack) to sender to inform the situation.
– The NAK will expedite the re-transmission process
– Suitable for un-reliable channels where it wastes a lot of
bandwidth on re-transmission
– Buffer on receiver side: required (to buffer the subsequent
“good” frames)
– Buffer on sender side: required (to remember what to re-send)
– The protocol is relatively complex
51
NAK will help to inform the sender the problem earlier before timer times out.
The main difference lies in the buffering & ordering at the receiver side.
* Totally lost.* Get damaged.
Go-Back-N vs. Selective Repeat
Back to TOC
52
Error & Flow Control Methods
Back to TOC
Stop-and-wait Go-Back-N Selective Repeat
Damaged Frames
Re-send the damaged one
(by NAK)
Re-send all since the last Acked one
(by NAK)
Re-send the damaged one
(by NAK)
Lost Frames
Re-send the lost one (by timer)
Re-send all since the last Acked one
(by out of order)
Re-send the lost one
(by out of order)
Lost Acks
Re-send the last one
(by timer)
Re-send all since the last Acked one
(by timer)
Re-send all since the last Acked one
(by timer)
53
►Ethernet
Back to TOC
IEEE Standards for LANs:
• Ethernet: IEEE 802.3 – Widely used
• Wireless LAN: IEEE 802.11 – Widely used
• Bluetooth: IEEE 802.15 – Hard to say
• Wireless WAN: IEEE 802.16 – Hard to say
Because Ethernet and IEEE 802.3 has only two differences, people use these two terms interchangeably.
54
Ethernet: Classical
• The Ethernet protocol is the most widely used protocol for LANs.
• It is first designed in 1973.
• The classical Ethernet operates at 10 Mbps, uses baseband signaling.
– Baseband: The whole capacity of the medium is occupied by the signal and frequency multiplexing is not possible.
– Broadband: The capacity of the medium is divided into channels using multiplexing.
Back to TOC
55
DIX
802.3
Difference: Length < 1500 < Type. 802.3: Has SOF (Start of Frame). 802.3: The type filed can be specified at the beginning of Data.
Ethernet Framing: DIX & IEEE 802.3
Back to TOC
56
PreambleStart of frame
delimiter
Data, the payload CRC
7 bytes 1 byte
46 to 1500 bytes 4 bytes
Destination address Source addressType
Length
6 bytes6 bytes 2 bytes
IEEE 802
Done in hardwareDone in software
Ethernet Framing: IEEE 802.3
Back to TOC
57
Preamble: a bit pattern of “1010 1010……”
– Preamble is to allow the receiver’s clock to synchronize with the sender’s.
SOF (Start of Frame) Delimiter: a byte to demark when
preamble has finished.
– SOF has a bit pattern of “1010 1011”.
– The Ethernet controller chip becomes interested
only after the SFD has been received.
Back to TOC
Preamble and SOF
58
• Performed by hardware.
• CRC compares the calculated value with the received one at the time the signal stops.
• A CRC error is sent to the controller chip and the damaged frame is normally discarded.
CRC Checksum
Back to TOC
59
Global Address:
Assigned by the IEEE to ensure that no two stations in the world would have the same addresses.
Local Address:
Assigned by the network administrator and has no significance outside the local network.
Back to TOC
Addresses: Global & Local
60
Group Address:
– Higher order bit is 1.
– Allow multiple stations to listen to a single address.
– All “1”s in the destination address: broadcasting.
Ordinary Address:
– Individual address.
Addresses: Group & Ordinary
Back to TOC
61
• Minimum length of frame: 64 bytes from destination address to checksum.
• Reason for this minimum length requirement:
– To distinguish between jam frames on the cable all the time.
– To prevent a station from completing the transmission of a short frame before detection of possible collision with another frame far away.
Minimum Length of Frame
Back to TOC
62
• The station sets the backoff factor to 0.
• The station monitors the medium, waiting for an ideal channel.
• If the channel is free, send the frame, otherwise, use 1-persistent strategy to aggressively monitor the channel.
• The channel is monitored during frame transmission.
• If a collision is detected, transmission stops immediately, and a special jam signal is generated to inform nearby stations of the collision.
• The station increases backoff factor and perform binary exponential backoff.
• After 15 (actually 10) times of retries, report failure.
Back to TOC
Medium Access: CSMA/CD
63
• The binary exponential backoff dynamically adapts to the number of stations trying to send.
• The algorithm ensures a low delay when only a few stations collide; also ensures a reasonable interval when many stations collide.
• Truncating the backoff interval to be within certain value prevents the upper bound from exploding.
• The CSMS/CD that we have discussed so far does not provides Acks.
• For reliable transmission, Acks can be sent to the sender for receipt of good frames. It depends.
Back to TOC
Medium Access: CSMA/CD (cont)
64
RepeaterBridgeSwitchRouterGateway
Repeater: • Operates only on the physical layer.
• Receive signals before attenuation, amplify/regenerate the original bit pattern, and put back to the link.
Back to TOC
65
RepeaterBridgeSwitchRouterGateway
Bridge: • Divides a large network into smaller segments and has the logic to keep the traffic for each segment separate.
• Bridges are repeaters that are smart enough to relay a frame only to the side of the segment containing the intended receipt • They filter traffics and are useful for controlling congestion.
• Bridges don’t modify the structure of the frames and can only be used between segments that use the same protocol.
• In summary, bridges not only just amplify the input signals, but forward frames to segments to which the destination belongs.
Back to TOC
66
RepeaterBridgeSwitchRouterGateway
Switch:
• Traditionally a device to provide bridging function efficiently.
• Normally has a buffer for each link it is connected.
• When it receives a frame, it stores it in its buffer and check its address (sometimes CRC) to find the outgoing link.
• If the outgoing link is idle, sends the frame to the particular link.
Back to TOC
67
RepeaterBridgeSwitchRouterGateway
Router: • Repeaters and bridges are simple network devices.
• Routers are more sophisticated.
• They have access to network layer addresses and certain software and thus be capable to determine which of several possible paths is the best for the transmission.
Back to TOC
68
RepeaterBridgeSwitchRouterGateway
Gateway: • A gateway is a protocol converter.
• A gateway can accept a packet formatted for one protocol and convert it to a packet formatted for another protocol before forwarding it.
• A gateway is generally software installed within a router.
Back to TOC
69
Hub & Switch (1)
Hub: All the incoming lines are logically connected, forming a single
collision domain.
Only one particular station at a time can be transmitting.
Hubs only allow half-duplex communication.
Switch: Each incoming frame is buffered.
Each frame is only forwarded to its specific destination.
Switches allow full-duplex communication.
Back to TOC
70
Hub & Switch (2)
Back to TOC
71
Ethernet Evolution (1)
Bridged Ethernet: • The first evolution is the division of a LAN by bridges.
• Bridges have two functions:
– Raising the bandwidth: Bandwidth-wise, each division/segment is independent.
– Separating collision domains: The collision domain becomes smaller and the probability of collision is reduced.
Back to TOC
72
Ethernet Evolution (2)
Switched Ethernet: • The idea of bridged Ethernet is extended to switched Ethernet.
• Instead of having multi-port bridge, why not N-port switch, where N is the # of stations in the LAN?
• In this way, bandwidth is shared only between the switch and each station.
• The collision domain is further divided.
Back to TOC
73
Ethernet Evolution (3)
Full-Duplex Ethernet: • Each station can send and receive at the same time.
• No need for CSMA/CD:
If a switched Ethernet is further full-duplex, there is no need to sense, there is no need for collision detection the MAC sub-layer can be turned off.
Back to TOC
74
Ethernet Evolution (4)
• Fast Ethernet (Operate at 100 Mbps): The idea is to keep the MAC sub-layer untouched.
Because advantages of the 10Base-T is so overwhelming, fast Ethernet is based entirely on this design – Star Topology.
• Gigabit Ethernet (Operate at 1000 Mbps): The whole idea in the evolution of Ethernet was to keep the
MAC sub-layer untouched. But, when it comes to the Gigabit rate, the designers feel that changes are needed.
Back to TOC
75
Fast Ethernet (1)
100Base-T4:Four pairs of UTP in a physical star topology.
– One pair is always to the hub/switch.
– One pair is always from the hub/switch.
– Two are switchable to the current transmission direction.
Logical topology: – Using hub: Star for half-duplex mode (CSMA/CD is needed).
– Using switch: Bus for full-duplex mode (CSMA/CD can be turned off).
– Hub/Switch is allowed.
Back to TOC
76
Fast Ethernet (2)
100Base-TX:Two pairs of twisted-pair cable (category 5 UPT) in a physical star topology.
Logical topology: – Using hub: Star for half-duplex mode (CSMA/CD is needed).
– Using switch: Bus for full-duplex mode (CSMA/CD can be turned off).
– Hub/Switch is allowed.
Back to TOC
77
Fast Ethernet (3)
100Base-FX:Two pairs of fiber-optic cable in a physical star topology.
Logical topology: – Using switch: Bus for full-duplex mode (CSMA/CD can be turned off).
– Only switch is allowed.
Back to TOC
78
Gigabit Ethernet
– The basic idea is similar to fast Ethernet.
– Hub or Switch?
Though it is foolish to keep a hub thus sacrificing the property of full-duplex, this is added for the purpose of back compatibility.
– Fiber or Copper?
Gigabit Ethernet implementations support fiber and copper, though copper is unlikely to be used, if not all.
Back to TOC
79
Software Side
• So far, for the evolution of Ethernet from
Classical Fast Gigabit Ethernets,
we discussed the implementations in the hardware.
• Algorithms in the software are also evolving, but will be not discussed in this class.
Back to TOC
80
Logic Link Control (LLC)
• We have seen a variety of Ethernet implementations and protocols.
• The logic link control sub-layer is added to make the data link layer to appear transparent to the layer above, thus different LANs can be connected together.
Back to TOC
81
• So far, we have:
– discussed fundamental Medium Access Methods (MA, CSMA, CSMA/CD).
– discussed Ethernet and how CSMS/CD is used in Ethernet.
• Now, let us see:
– the MAC methods that are used in Wireless LAN.
Wireless LAN
Back to TOC
82
Wireless LAN
• Fact: Not all stations are within the range of each other.
• Problem: Hidden/Exposed State Problem
(a) Hidden (b) Exposed
Back to TOC
83
CSMA/CA: Handshaking (1)
Handshaking when A wants to sent to B:
(1) A B: Request to Send (RTS)
All stations hearing RTS should be quiet to ensure RTS can be correctly received by B
(2) A B: Clear to Send (CTS)
All stations hearing CTS should be quiet to ensure CTS can be correctly received by A
(3) A B: Frame/Data
All stations hearing RTS can transmit if they are not in the range of B.
All stations hearing CTS should be quite since they are inside range of B.
(4) A B: ACK
All stations inside range of A should be quiet to ensure this ACK can be correctly received by A.
Back to TOC
84
CSMA/CA: Handshaking (2)
• The handshaking process listed in above seems to be complex.
• To make things easy, we can have:
– All stations hearing either RTS or CTS should be quiet till the final ACK is correctly received by A.
– By doing so, we might waste the bandwidth, since when A B (for frame), stations inside range of A can transmit to another station, such as D, as long as D is not inside range of B.
Back to TOC
85
Other Stations
CSMA/CA: Handshaking (3)
NAV: records the duration to wait till start sensing the channel again.The above duration is indicated in RTS and CTS (copied from RTS).
Back to TOC
86
CSMA/CA: Via Base Station
• The above handshaking process is completed by the stations themselves.
• Another method is via base station:
– The base station polls the stations to see if they want to send.
– Since the transmission order is controlled by the base station, no collision will occur.
Back to TOC
87
►Network Layer
Back to TOC
Data Link:Moving frames from one end of the wire to the other.
Network:Getting packets from the source all the way to the destination.
– Design Issues.
– Routing Algorithms.
– Congestion Control.
– Quality of Service.
– IP Protocol.
88
Position of Network Layer
Back to TOC
89
Functions of Network Layer
Back to TOC
• Packetizing:To encapsulate packets received from the upper layer.
• Addressing: To uniquely identify a station in the world (IP address).
• Internetworking:To provide internetworking, logically gluing physical networks together to look like a single network to the upper layer.
• Routing:To choose one path when multiple choices exist.
• Fragmenting: Processed by routers when the datagram travels through different networks.
90
Services: Opinions of Two Camps
One Camp, the Internet Camp:
- Routers’ job is moving packets around and nothing else.
- Thus, the Network layer services – Connectionless.
- Example: Internet.
- Internet begins to provide connection-oriented services.
- Need routing for each packet.
The Other Camp, the telephone companies:
- Need to provide a reliable, connection-oriented service.
- Example: ATM.
- Need routing at the set-up stage (session routing).
Back to TOC
91
Connectionless Service
- Packets are injected into the subnet individually and routed independently.
- No advance setup is needed.
- Frames are called datagrams. The subnet is called datagram subnet.
- Internal tables of the router can be dynamic.Back to TOC
92
Connection-oriented Service
- Avoid choosing a new route for every packet by setting up a route in advance.
- The connection is called virtual circuit (VC). The subnet is called VC subnet.
- Each packet carries an identifier telling which virtual circuit it belongs to.
- Routers have the ability to replace identifiers to avoid confliction.Back to TOC
93
Routing vs. Forwarding
Routing:
Be responsible for filling in and updating the routing table.
Here, this is what we call the routing.
Forwarding:
Look up the routing table when a new packet arrives and forward it out.
Back to TOC
94
Adaptive/Non-adaptive Routing
Non-adaptive Routing (Static):
– The routing table is computed in advance, off-line, and downloaded to the routers when the network is booted.
– The routing table is not updated frequently.
Adaptive Routing (Dynamic):
– Routing decisions are changeable to reflect changes in topology and traffic.
– Differs in where to get input information, routers in adjacent or all – local or global.
Back to TOC
95
Routing Principle
Routing Principle:
If B is on the optimal path from router A to router C, then the optimal path from B to C also falls in the same path.
How about an inverse question:
Given A C optimal, is C A optimal?
A B C
Back to TOC
96
Sink Tree
Sink Tree:From the routing principle, there is a tree illustrating the optimal path from all sources to the destination, rooted at the destination.
(a) A subnet (b) sink tree rooted at BBack to TOC
97
Unicast Routing Algorithms
1. Shortest path routing
2. Flooding
3. Distance Vector Routing
4. Link State Routing
5. Hierarchical Routing
Back to TOC
98
Shortest Path Routing
Criteria: Hops, delay, physical distance, …Back to TOC
99
Flooding
Flooding:
– Every packet is sent out on every outgoing line except the one it comes in.
– The disadvantages are so obvious ……, but still suitable to applications where ……
Selective Flooding:
The packet is sent out to outgoing lines that are approximately/roughly in the right direction.
Back to TOC
100
Distance Vector Routing (1)
Operation:
Each router maintains a table containing the best known distance to each destination and the line to get there.
Other Names: Bellman-Ford, Ford-Fulkerson, Routing Information Protocol (RIP).
Dynamic, since:
Every T seconds, each router sends to its neighbor its estimated cost to each destination.
Shortcoming:
– Slow in convergence.
– Stability?Back to TOC
101
Distance Vector Routing (2)
Operation in details: Each router periodically shares its knowledge about the entire internet with its neighbors.
1. Sharing knowledge about the entire network with neighbors: It sends out whatever it knows.
2. Sharing only with neighbors.
3. Sharing at regular intervals.
4. Old routing table is not used in the calculation.
Thus,
1. Scope of knowledge to share: entire.
2. To whom to share the knowledge: only its neighbors.
3. When to share the knowledge: periodically.Back to TOC
102
Distance Vector Routing (3)
Back to TOC
103
The count-to-infinity problem.
Distance Vector Routing (4)
Good news is distributed/propagated at a reasonable speed.
Bad news propagates slowly.
Cost of each link: Hop.
Dot: denotes infinity.
Info is distributed at the same time.
Only consider router’s info about A. Back to TOC
104
Distance Vector Routing (5)
Some remedies for the in-stability/slow convergence:
Triggered Update:
If there are no changes in the network, updates are sent regularly about 30 s. If there are changes in the network, updates are sent out immediately.
Split Horizon:Be selective in sending out updates. If a router has received updates from an interface, then this updated info should not be sent back to this interface.
Poison Reverse:It is a variation of the split horizon. Updated info is sent to all interfaces. But, the entry that comes from one interface is set to be 16 (denote infinity).
Back to TOC
105
Link State Routing (1)
RIP “is replaced” by Link State Routing because RIP:• Does not take bandwidth into consideration.• The algorithm takes too long to converge to the right
solutions.• Unstable? When this happens, a packet could go from one
router to another in a dead loop.
Back to TOC
106
Link State Routing (1)
Main difference between RIP and Link State Routing
Link State Routing (2)
Link State Routing does the following:• Scope of knowledge to share:
– “Entire” knowledge about the net.
– Whatever the router knows.
• To whom to share the knowledge: sharing with neighbors, then neighbors, …, and finally the whole nodes in the net.
• When to share the knowledge: when there is a “change” in the net.
Back to TOC
107
Link State Routing (3)
Five Steps:
– Discover its neighbors, learn their network address.
– Measure the delay or cost to each of its neighbors.
– Construct a packet telling all it has just learned.
– Send this packet to all other routers.
– Compute the shortest path to every other router using the
shortest-path algorithm discussed before.
Back to TOC
108
Hierarchical Routing (1)
• As the network grows in size, as the # of routers increases, it is reasonable to do a hierarchical routing to reduce the entries inside a router’s table.
• When doing hierarchical routing, the best route is with respect to regions, instead of individual station.
Back to TOC
109
Hierarchical Routing (2)
Back to TOC
110
What is Congestion?
Congestion in a network may occur if the load on the network is greater than the capacity of the network.
Load – the number of packets sent to the network.
Capacity – the number of packets a network can handle.
• Congestion happens in any system that involves waiting.
• Congestion happens on a freeway because any abnormality in the flow, such as an accident during the rush hour, creates blockage.
Back to TOC
111
Reason of Congestion
Congestion in a network or internetwork occurs because routers and switches have queues – buffers that hold the packets before and after processing.
Back to TOC
112
Factors that May Cause Congestion
• Suddenly appeared packets requiring the same line: – Due to the finite buffer size of router, packets will get lost.
– Increase the buffer size can only help to a “point”.
– Due to Nagle’s study.
• Slow receiver will cause queue up.
• Low bandwidth.
Back to TOC
113
Network Performance
Congestion control involves two factors that measure the performance of a network: delay and throughput.
Back to TOC
114
Congestion Control
Congestion control refers to techniques and mechanisms that can either:
- Prevention: prevent congestion before it happens.
- Removal: remove congestion after it happened.
Congestion Control
Open-Loop Closed-Loop
Back to TOC
115
To overcome congestion
Reduce the load Increase the resources
Congestion in the Network Layer (IP)Congestion in the Transport Layer (TCP)
Congestion Control
Back to TOC
116
Congestion Control: Open-Loop (1)
Retransmission Policy:
– A good retransmission policy can prevent congestion.
– The retransmission policy and the retransmission timers should be designed to optimize efficiency and at the same time prevent congestion.
Window Policy:
– The type of window at the sender can also affect congestion.
– The Selective Repeat is better than Go-Back-N for congestion control.
Back to TOC
117
Congestion Control: Open-Loop (2)
ACK Policy:
– The ACK policy at the receivers may also affect congestion.
– If the receiver does not ACK every packet it receivers, it may help prevent congestion (piggybacking).
Discarding Policy:
– Good discarding policy by routers may prevent congestion.
– In audio transmission, if the policy is to discard less sensitive packets when congestion is likely to occur, the quality of sound is still preserved and congestion is prevented.
Admission Policy:
– A quality of service (QoS) mechanism.
– Routers or switches in a flow first check the resource requirement before admitting it to the network. Back to TOC
118
Congestion Control: Closed-Loop (1)
Chock Packet:A chock packet is the packet
sent by routers to the sender
to inform the congestion.
Hop-by-Hop Chock Packet:
- If a router is congested, it informs the previous upstream router to reduce the rate of outgoing packets.
- Recursive all the way to the sender.
Back to TOC
119
Congestion Control: Closed-Loop (2)
Explicit Signaling:- The routers that experience congestion can send an explicit signal, such as by setting one bit in a packet, to inform the sender or the receiver of the congestion.
- Forward direction: to warn to receivers..
- Backward direction: to warn the sources.
Implicit Signaling:- The sender can detect an implicit signal of congestion and slow down its sending rate.
- Ex: the mere delay in receiving an ACK can be a signal that the network might be congested.
Back to TOC
120
NoteNote::
TCP assumes that the cause of a lost segment is due to congestion
in the network.
Back to TOC
121
NoteNote::
If the cause of the lost segment is congestion, retransmission of the segment
does not remove the cause—it aggravates it.
Back to TOC
122
What is Quality of Service?
QoS is an internetworking issue that has been discussed more than defined.
We can informally define quality of service (QoS) as something a flow seeks to attain.
SchedulingTraffic
ShapingAdmission
ControlResource
Reservation
Techniques toImprove QoS
Back to TOC
123
Flow Characteristics (1)
Four types of characteristics are attributed to a flow:
Reliability, Delay, Jitter, and Bandwidth.
Back to TOC
124
Flow Characteristics (2)
Reliability:Lack of reliability means losing a packet or ACK, which will cause retransmission.
The sensitivity of applications to reliability is not the same:
– More important for Emails.
– Less important for video/audio transmissions.
Delay:Applications can tolerate delays in different degrees:
– File transfer/Emails: delays are less important.
– Video conferencing/remote log-in: delays are important.
Back to TOC
125
Flow Characteristics (3)
Jitter:Jitter is the variation in delay for packets belonging to same flow.
Applications can tolerate jitters in different degrees:
– File transfer/Emails: jitters are less important.
– Video conferencing: jitters are important.
Bandwidth:Applications have different requirements on bandwidth.
– Video conferencing: need to send millions of bits per second.
– Emails: total number of bits might not exceed a million.
Back to TOC
126
Resource Reservation
Resource Reservation:
- A flow of data needs resources such as a buffer, bandwidth, CPU time, and …
- The quality of service can be improved if these resources can be reserved beforehand.
- If we have a specific route for a flow, the above reservation can be possible.
Back to TOC
127
Admission Control
Admission Control:
– Admission control refers to a mechanism used by a router, or a switch, to accept or reject a flow based on predefined parameters, called flow specifications.
– Before a router accepts a flow for processing, it checks its specifications to see if the router’s capacity (buffer, CPU time) and its previous commitment to other flows can handle this new flow.
Back to TOC
128
Scheduling
Scheduling:
To treat packets from different interfaces in a fair and appropriate manner.
– FIFO Queuing.
– Priority Queuing.
– Weighted Fair Queuing.
Back to TOC
129
Scheduling (1)
FIFO Queuing:
- First-in first-out.
- If the average arrival rate is higher than the processing rate, the queue will fill up and new packets will be discarded.
Back to TOC
130
Scheduling (2)
Priority Queuing:
- Packets are assigned to a priority class.
- Each priority class has its own queue.
- Packets in higher-priority queue are processed first.
- Packets in lower-priority queue are processed last.
- The system does not stop serving a queue until it is empty.
Back to TOC
131
Scheduling (3)
Weighted Fair Queuing:- Packets are still assigned to priority classes.
- Packets of different priority are assigned to different queues.
- Packets in different queues are processed based on
corresponding weights.
Back to TOC
132
Traffic Shaping
Traffic Shaping:
Traffic shaping is a mechanism to control the amount and the rate of the traffic sent to the network.
– Leaky Bucket.
– Token Bucket.
Back to TOC
133
Traffic Shaping: Leaky Bucket
Leaky Bucket:
– If a bucket has a hole, the water leaks from the bucket at a constant rate independent on the rate at which the water is input to the bucket as long as the bucket is not empty.
– Idea: the input rate can vary, the output rate remains constant.
– Thus, leaky bucket can smooth traffics.
Back to TOC
134
Traffic Shaping: Leaky Bucket
The leaky bucket shapes burst traffic into fixed-rate traffic by averaging the data rate.
Leaky Bucket’s Restriction:• If a host is not sending for a while, its bucket becomes empty.
• Now, if the host has burst data, the leaky bucket algorithm allows only an average rate.
• The time that the host is idle is not taken into account.
Back to TOC
135
Traffic Shaping: Token Bucket
Token Bucket:Allows idle hosts to accumulate credits for a future use in the form of tokens.
– Tokens are assigned to the bucket at a constant rate.
– Packets need tokens to be processed/transmitted.
– The host can consume all the tokens at once or slowly.
– The host can send burst data as long as the bucket is not empty.
Differences from Leaky Bucket:
– Allowing varying output rate.
Token bucket allows burst outgoing traffic.
Back to TOC
136
Traffic Shaping: Token Bucket
Token Bucket Illustration:
Back to TOC
137
IP Protocol
The IP Protocol is designed with the internetworking in mind.
The glue of the whole Internet is the Network Layer Protocol: IP Protocol.
Back to TOC
138
Top Principles in Designs
• Keep it simple:
When in doubt, use the simplest solution. That is, fight features: if a feature is not absolutely necessary, leave it out.
• Make clear choices:
If there are several ways to do one job, use one.
• Look for good design:
Though it might not handle some weird situations, leave that burden to those users.
• Be strict when sending but tolerant when receiving…
Back to TOC
139
The IPv4 (Internet Protocol) header.
IP Header (v4)
Back to TOC
140
IP Header (v4)
Version: To keep track of which version the datagram belongs to.
IHL: To tell how long the header is.
Type of Service: Originally designed to distinguish between different classes of services. But usually ignored.
Total Length: Include everything in the datagram, header + data.
Identification: To let the receiver know which segment a newly arrived datagram belongs to.
DF (Don’t Fragment): In case the destination can not reassembly pieces back together.
MF (More Fragments): All fragments except the last one have this bit set.
Fragment Offset: To indicate the current position of the datagram in the segment.
Time to Live: A counter to limit packet lifetimes avoid dead loop.
Protocol: To indicate the Transport Protocol, such as TCP, UDP.
Header Checksum: Checksum of the header.Back to TOC
141
IP Addresses
Function:To uniquely identify each device on the Internet to allow global communication between all devices.
Analog to our daily live: The telephone system, where each telephone subscriber has a unique telephone number, given that the country code and the area code are part of the identification scheme.
What is an IP Address?An IP address, in the current version of protocol, is a 32-bit binary address that uniquely and universally defines the connection of a host or a router to the Internet.
An IP address is a 32-bit binary address.Back to TOC
142
IP Addresses
Uniquely:IP addresses are unique in the sense that each address defines one, and only one, connection to the Internet. Two devices on the Internet can never has the same address at the same time.
If a device has two connections to the Internet via two networks, it has two IP addresses.
Universally:IP addresses are universal in the sense that the addressing system must be accepted by any host wants to be connected to the Internet.
Back to TOC
143
IP Address Notations
IP Address Notations:There are two common notations to represent an IP address:
Binary notation:
01110101 10010101 00011101 11101010
Dotted-decimal notation:
Back to TOC
144
We are running out of IP addresses!
Short-Term Solutions:
1. Classless AddressingCIDR (Classless InterDomain Routing):
– To allocate the remaining IP addresses in variable-sized blocks,
without regard to the classes.
– Ex: if someone needs 2000 addresses, it will be given 2048.
– Size of routing table is more likely to be increased (thus need
hierarchy routing).
2. NAT (Network Address Translation):
Each stations inside a domain has unique address for internal traffic/communication.
Outgoing packets experience an address translation – to use single or several assigned global IP address.
Long-Term Solution: Use IPv6. Back to TOC
145
TCP/IP Protocol Suite
Back to TOC
146
ICMP: Motivation
Motivation:
The IP protocol is a best-effort service that delivers a datagram from its source to destination. However, it has two deficiencies:
– Lack of Error Control.
– Lack of Assistant Mechanism.
Solution:
– ICMP (Internet Control Message Protocol).
– ICMP is a companion to IP Protocol.
Back to TOC
147
ICMP: Message Type
Error-Reporting:
To report problems that a router or a host (destination) may encounter when it processes an IP packet.
Query:
– Occur in pairs.
– To help a host or a network manager to get a specific information from a router or another host.
Back to TOC
148
ARP: Background Info
• Delivery of packets need two levels of addressing: logical and physical.
• We need to be able to map a logical address to its corresponding physical address, and vice visa.
• This can be done statically or dynamically. • ARP: Address Resolution Protocol.• RARP: Reverse Address Resolution Protocol.
Back to TOC
149
Static & Dynamic
Static:
A table is created and maintained that contains logical addresses and their corresponding physical ones.
– This table is stored in each station in the network.
– Disadvantages: Physical address may change.
Dynamic:
The machine can find out the required physical/logical address using a protocol.
Back to TOC
150
ARP
Idea:
The sender asks the receiver to announce its physical address, if needed.
Operation:
(1) Each time a host wants to find the physical address of a receiver, it sends an ARP query packet.
(2) The ARP query packet contains the source physical + IP addresses, and the destination IP address.
(3) The ARP query packet is sent via broadcast.
(4) Only the receiver replies its physical address via unicast.
Back to TOC
151
ARP: Query and Reply
Back to TOC
152
Proxy ARP
Proxy ARP:
– A proxy ARP is an ARP that acts on behalf of a set of
hosts.
– Whenever a router running a proxy APR receives an
ARP request regarding one of these hosts, it will send
an ARP reply announcing its own physical address (the
router’s).
Back to TOC
153
RARP
RARP:
RARP finds the logical
address for a machine
only knowing its
physical address.
Situations:
• Diskless machines.
• Machines booted
the first time.
Back to TOC
154
BOOT & DHCP
Each host attached to a TCP/IP internet must know:
(1) Its IP address.
(2) Its subnet mask.
(3) The IP address of a router.
(4) The IP address of a name server (DNS: to discuss later).
The above info is usually stored in a configuration file and accessed by the computer during the boot-up process.
BOOT and DHCP are designed to provide the listed information. DHCP is more popularly implemented.
Back to TOC
155
DHCP
• DHCP stands for Dynamic Host Configuration Protocol.
• DHCP is an extension to BOOTP.
• It enhances BOOTP and is backward compatible with BOOTP.
• DHCP has two databases:
– The 1st database statically binds physical with logical addresses – same as the database of a BOOTP server.
– The 2nd database has a pool of available IP addresses – makes DHCP dynamic!
Back to TOC
156
DHCP Components
• Two Components:
– A protocol for delivering host-specific configuration
parameters from a server to a host
– A mechanism for allocation of network addresses to hosts.
• DHCP supports three mechanisms for IP address allocation.
– Automatic allocation -- in which a permanent IP address is
assigned to the client.
– Dynamic allocation -- in which the address is assigned for a
limited period of time (a "lease").
– Manual allocation -- in which the address is assigned
manually by the network administrator.
Back to TOC
157
DHCP Terminologies
• DHCP Server: Host that provides and manages the configuration parameters for many “clients” hosts using UDP Transport (port 67).
• DHCP Client: Host that requests configuration parameters from a DHCP Server, also known as a DHCP Daemon (DHCPD). It also uses the UDP transport (port 68).
• BOOTP Relay Agent: A host or router that passes DHCP messages between DHCP clients and DHCP servers.
• Binding: A binding is a collection of configuration parameters, including at least an IP address, associated with or "bound to" a DHCP client.
Back to TOC
158
DHCP State Diagram
Back to TOC
159
►Transportation Layer
Back to TOC
Node-to-Note Delivery:
The data link layer is responsible for delivery of frames between two nodes over a link.
Host-to-Host Delivery:
The network layer is responsible for delivery of packets between two hosts (might not be on the same network).
Process-to-Process Delivery:
The transport layer is responsible for delivery of datagrams/segments, parts of messages, between two processes (application programs) on two hosts.
160
Node, Host, and Process Deliveries
Node-to-Note Delivery:
The data link layer is responsible for delivery of frames between two nodes over a link.
Host-to-Host Delivery:
The network layer is responsible for delivery of packets between two hosts (might not be on the same network).
Process-to-Process Delivery:
The transport layer is responsible for delivery of datagrams/segments, parts of messages, between two processes (application programs) on two hosts.
Back to TOC
161
Process-to-Process Delivery
Process-to-Process Delivery Illustration:
Back to TOC
162
Client-Server Paradigm
(1) Although there are several ways to achieve process to process communication, the most common one is through client-server paradigm.
(2) A process on the local host, called client, needs service from a process on a remote machine, called server.
(3) Both processes have the same name: HTTP client, HTTP server.
Back to TOC
163
Addressing
Physical Layer Addressing (node-to-note):
Physical address MAC address in Ethernet (48-bit).
Network Layer Addressing (host-to-host):
Logical address IP address (32-bit in IPv4).
Transport Layer Addressing (process-to-process):
logical address Port number (16-bit).
(1) Client’s port number can be randomly chosen by its transport protocol.
(2) Server’s port number is decided to be universal.
Back to TOC
164
IP + Port Number
IP address selects the specific host.
Port number selects the specific process running on the host.
(1) Client’s port number can be
randomly chosen by its
transport protocol.
(2) Server’s port number is
decided to be universal
for easy communication:
well-known port numbers.
Back to TOC
165
Socket Address
Fact: Process-to-process communication needs two identifiers: IP address + Port Number.
Socket Address:The combination of IP address and Port Number is called socket address.
The client socket address defines the client process uniquely.
The server socket address defines the server process uniquely.
IP header provides IP address.
TCP/UDP header provides port number.
Back to TOC
166
Connection-Oriented/Connectionless Service
Connectionless Service: (1) The packet is sent from one party to another with no need for connection establishment or connection release.
(2) The packets are not numbered, may be delayed, lost, or arrive out of order. There is no ACK.
UDP (unreliable and connectionless)
Connection-Oriented Service:
(1) Connection is first established.
(2) Data is transmitted.
(3) Connection is released.
TCP (reliable and connection-oriented)
Back to TOC
167
UDP: Datagram Format
UDP (User Datagram Protocol):
UDP is a connectionless, unreliable protocol that has no error control and no flow control (simple and faster).
UDP packets are called user datagrams.
User Datagram Format:
The calculation of checksum and its inclusion in the user datagram is optional.
Back to TOC
168
UDP: Applications
UDP is a convenient transport-layer protocol for applications that provide flow and error control. It is
also used by multimedia applications.
Back to TOC
169
TCP
TCP (Transition Control Protocol):
TCP is a connection-oriented, reliable transport protocol (complex and slower).
• Transmission is full duplex.
• Transmission unit is called segment.
• Connection is established and released for communication
• Has error control and flow control.
• Has timer and Acks.
• Numbering is regarding “byte”.
• …… Back to TOC
170
Port Protocol Description
7 Echo Echoes a received datagram back to the sender
9 Discard Discards any datagram that is received
13 Daytime Returns the date and the time
20 FTP, Data File Transfer Protocol (data connection)
21 FTP, Control File Transfer Protocol (control connection)
23 TELNET Terminal Network
25 SMTP Simple Mail Transfer Protocol
53 DNS Domain Name Server
67 BOOTP Bootstrap Protocol
80 HTTP Hypertext Transfer Protocol
TCP: Port Numbers
Back to TOC
171
Basic Idea of Flow Control:
Similar to the mechanisms in Data Link Layer
One Serious Problem – Silly Window Syndrome:
In sliding window operation, when either the sending process creates data slowly, or the receiving process consumes data slowly, we are not using the capacity of the network efficiently. This problem is called silly window syndrome.
Proposed Solutions:
From the side of the sending process:
From the side of the receiving process:
TCP: Flow Control
Back to TOC
172
Syndrome Created by the Sender:• The sending TCP may create a silly window syndrome if it is serving an application program that creates data slowly, for example, byte by byte.
• The solution is to prevent the sending TCP from sending the data byte by byte.
Q: How long should the sending TCP wait? If wait long, it may delay the process. If wait shortly, it may end up with small segments.
A: Nagle’s Algorithm.
TCP: Silly Window Syndrome
Back to TOC
173
Nagle’s Algorithm: for the sending TCP.1. The sending TCP sends the first piece of data it receives from the sending application even if it is 1 byte.
2. After sending the first segment, the sending TCP accumulates data until either it receives an ACK or enough data has been accumulated to fill a max-size segment. At this time, the sending TCP can send.
3. The above Step-2 is repeated…
TCP: Nagle’s Algorithm
Back to TOC
174
TCP: Nagle’s Algorithm
The Elegance of Nagle’s Algorithm:
Lies in its simplicity and the fact that it takes into account the speed of the application program that creates data and the speed of the network.
• If the application is faster than the network, segments will be transmitted with max-size.
• If the application is slower than the network, smaller segments (not max-size) will be transmitted.
Back to TOC
175
Syndrome Created by the Receiver:• The receiving TCP may create a silly window syndrome if it is serving an application program that consumes data slowly, for example, byte by byte.
• One solution is to delay Acks: Acks are not sent immediately.
Delayed Acks:
• Can reduce traffic.
• However, it is possible that it may force the sender to retransmit the un-Acked segments.
• The protocol balances the advantage and disadvantage and specifies that the delayed Acks should not exceed 500ms.
TCP: Silly Window Syndrome
Back to TOC
176
TCP: Congestion Control
TCP assumes that the cause of a lost segment is due to the congestion
in the network.
If the cause of the lost segment is congestion, retransmission of the segment
does not remove the cause—it aggravates it.
Back to TOC
177
TCP: Congestion Control
• In TCP, the sending window is not only determined by the receiver, but also by the congestion in the network.
• Three Phases of Congestion Control in TCP:
Slow Start, Additive Increase, and Multiplicative Decrease.
Back to TOC
178
TCP: Congestion Control
(1) Slow Start (Van Jacobson’s Algorithm):• At the beginning of a connection, TCP sets the congestion window size to be the max segment size.
• For each segment Acked, TCP increases the congestion window size by one max segment size, until it reaches a threshold of one-half of the allowable window size.
• The above is called slow start, though the actual operation is now slow, but exponential.
Back to TOC
179
TCP: Congestion Control
(2) Additive Increase:• To avoid congestion before it happens, we must slow down this exponential process.
• After the congestion window size reaches the threshold, the size is increased one max segment for each Ack even if an Ack is for several segments.
• The additive-increase strategy continues until as long as Acks arrives before timer times out, and the congestion window size does not reach the receiver window value.
Back to TOC
180
TCP: Congestion Control
(3) Multiplicative Decrease:• If congestion occurs, the congestion window size must be decreased.
• If the sending TCP does receive an ACK before times out, it assumes that there is a congestion.
• Then, the threshold must be set to one-half of the last congestion window size, and the congestion window size should start from 1 again.
• In other words, the sender returns to the “slow start” phase.
Back to TOC
181
►Application Layer Protocols
Back to TOC
DNS (Domain Name System):
• To identify an entity, TCP/IP protocols use the IP address. However, people prefer to use names instead of IP address.
• DNS provides a mapping between an IP address and a name.
• DNS can use the services of UDP or TCP, using the well-known port 53.
• DNS uses UDP as a transport protocol, for the most part for normal resource records lookup. The exceptions are zone transfers and very large responses, which use TCP.
182
Protocols
Back to TOC
Telnet/Rlogin (Terminal Network/Remote Login):
• A TELNET connection is a Transmission Control Protocol (TCP) connection used to transmit data. It uses the well-known port 23.
FTP (File Transfer Protocol):
• A standard mechanism provided by TCP/IP for copying a file from one host to another.
• FTP uses two well-known TCP ports: Port 21 is used for the control connection, and port 20 is used for the data connection.
183
Protocols
TFTP (Trivial FTP):
• TFTP uses the services of UDP on the well-known port 69.
SMTP (Simple Mail Transfer Protocol):
• The TCP/IP protocol that support electronic mail on the Internet.
• Uses the TCP well-known port 25.
SNMP (Simple Network Management Protocol):
• A framework for managing devices in an internet.
• An application-level protocol in which a few manager stations control a set of agents.
• Uses the services of UDP on two well-known ports: 161 and 162.
Back to TOC
184
Protocols
HTTP (Hypertext Transfer Protocol):• A protocol used mainly to access data on the World Wide Web.
• Uses the services of TCP on well-known port 80.
WWW (World Wide Web):• A repository of information spread all over the world and linked
together.
• When accessing the WWW, DNS is first queried for the IP address (UDP). Then, data is transferred using TCP.
Back to TOC
185
Protocols
RTP (Real-time Transport Protocol):
• A protocol to handle real-time traffic on the Internet.
• RTP stands between UDP and the application program.
• RTP does not have a delivery mechanism and it must be used with UDP.
• RTP is treated as an application-level program and is encapsulated into a UDP datagram.
• RTP uses a temporary UDP port.
RTCP (Real-time Transport Control Protocol):
• Work with RTP for real-time traffic transmission.
• Like RTP, uses a temporary UDP port.
Back to TOC