Internet dan Jaringan Komputer Komunikasi Data dan Jaringan Komputer (Bagian 2) Dr. Tb. Maulana Kusuma mkusuma@staff.gunadarma.ac.id http://staffsite.gunadarma.ac.id/mkusuma Magister Manajemen Sistem Informasi 0 Review of OSI Networking Model Program X Data AH Data Application Presentation Presentation SH Data unit Transport TH Network Physical Application PH Data unit Session Data link Program Y NH LH Session Data unit Transport Data unit Network Data unit Bits LT Data link Physical Physical transmission medium Magister Manajemen Sistem Informasi 1 Data Link Layer Means of activating, maintaining and deactivating a reliable link Error detection and control Higher layers may assume error free transmission Magister Manajemen Sistem Informasi 2 Introduction The PDU at the Data Link Layer (DL-PDU) is typically called a Frame. A Frame has a header, a data field, and a trailer Example: Magister Manajemen Sistem Informasi 3 Framing Problem: Identify the beginning and the end of a frame in a bit stream Solution (bit-oriented Framing): A special bit pattern (flag) signals the beginning and the end of a frame (e.g., "01111110") Problem: The sequence '01111110' must not appear in the data of the frame Magister Manajemen Sistem Informasi 4 Bit-oriented framing and bit stuffing 'Bit stuffing': If the sender detects five consecutive '1‘ it adds a '0' bit into the bit stream. The receiver removes the '0' from each occurrence of the sequence '111110' Note: The flags itself are not bit-stuffed. Magister Manajemen Sistem Informasi 5 Flow control Flow Control is a technique for speed-matching of transmitter and receiver. Flow control ensures that a transmitting station does not overflow a receiving station with data We will discuss two protocols for flow control: Stop-and-Wait Protocol Sliding Window Protocol For the time being, we assume that we have a perfect channel between sender and receiver (no errors) Magister Manajemen Sistem Informasi 6 Stop-and-wait flow control Simplest form of flow control In Stop-and-Wait flow control, the receiver indicates its readiness to receive data for each frame Operations: 1. Sender: Transmit a single frame 2. Receiver: Transmit acknowledgment (ACK) 3. Go to 1. Magister Manajemen Sistem Informasi 7 Analysis of stop-and-wait Magister Manajemen Sistem Informasi 8 Analysis of stop-and-wait Transmission delay is the time that the sender needs to transmit a frame Transmission delay is dependent on the size of a frame and the maximum data rate Example: Frame Size = 1000 bit Data rate of network = 1 Mbps Transmission delay = 1000 bit / 1 Mbps = 1 ms Magister Manajemen Sistem Informasi 9 Analysis of stop-and-wait Propagation delay is the time that a transmitted bit needs to travel from sender to the receiver Propagation delay is only dependent on the speed of the transmission medium and the distance between sender and receiver. Speed of light: 300000 km/sec, Speed in guided media (approx.): 200000 km/sec Example: Distance = 1000 km Propagation delay = 1000 km / (200000 km/sec) = 5 ms Magister Manajemen Sistem Informasi 10 Sliding window flow control Major Drawback of Stop-and-Wait Flow Control: Only one frame can be in transmission at a time Sliding Window Flow Control Allows transmission of multiple frames Assigns each frame a k-bit sequence number Range of sequence number is [0..2k-1], i.e., frames are counted modulo 2k Magister Manajemen Sistem Informasi 11 Operation of sliding window Sending Window: At any instant, the sender is permitted to send frames with sequence numbers in a certain range The range of sequence numbers is called the sending window Magister Manajemen Sistem Informasi 12 Operation of sliding window Receiving Window: The receiver maintains a receiving window corresponding to the sequence numbers of frames that are accepted Magister Manajemen Sistem Informasi 13 Operation of sliding window Operations at the sender: Magister Manajemen Sistem Informasi 14 Operation of sliding window Operations at the sender: Magister Manajemen Sistem Informasi 15 Operation of sliding window Operations at the receiver Magister Manajemen Sistem Informasi 16 Operation of sliding window Operations at the receiver Magister Manajemen Sistem Informasi 17 Operation of sliding window How is “flow control” achieved? Receiver can control the size of the sending window By limiting the size of the sending window data flow from sender to receiver can be limited Interpretation of ACK N message: Receiver acknowledges all packets until (but not including) sequence number N Magister Manajemen Sistem Informasi 18 Analysis of sliding window Magister Manajemen Sistem Informasi 19 Error control Two basic approaches to handle bit errors: Error-detecting codes plus retransmission (Automatic Repeat reQuest / ARQ) Used if retransmission of corrupted data is feasible Receiver detects error and requests retransmission of a frame. Error-correcting codes Used if retransmission of the data is not possible Data are encoded with sufficient redundancy to correct bit errors Examples: Hamming Codes, Reed Solomon Codes, etc. Magister Manajemen Sistem Informasi 20 Error detection techniques Error Detection Techniques: Parity Checks Cyclic Redundancy Check (CRC) Magister Manajemen Sistem Informasi 21 Parity checks General Method: Append a parity bit to the end of each character in a frame such that the total number of '1' in a character is: even (even parity) or odd (odd parity) Example: With ASCII code, a parity bit can be attached to an 7-bit character ASCII "G" = 1 1 1 0 0 0 1 with even parity = with odd parity = Magister Manajemen Sistem Informasi 22 Cyclic-Redundancy Codes General Method: The transmitter generates an n-bit check sequence number from a given k-bit frame such that the resulting (k+n)-bit frame is divisible by some number The receiver divides the incoming frame by the same number If the result of the division does not leave a remainder, the receiver assumes that there was no error Magister Manajemen Sistem Informasi 23 Cyclic-Redundancy Codes CRC is used by all advanced data link protocols, for the following reasons: Powerful error detection capability CRC can be efficiently implemented in hardware Magister Manajemen Sistem Informasi 24 Additional facts on CRC CRC can be efficiently implemented in hardware by a set of XOR gates and a shift register The following generator polynomials are widely used: CRC-12: CRC-16: CRC-CCITT: CRC-32: P(x) = x12 + x11 + x3 + x2 + x + 1 P(x) = x16 + x15 + x2 + 1 P(x) = x16 + x12 + x5 + 1 P(x) = x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 Magister Manajemen Sistem Informasi 25 ARQ error control Two types of errors: Lost frames Damaged Frames Most Error Control techniques are based on (1) Error Detection Scheme (e.g., Parity checks, CRC), and (2) Retransmission Scheme Error control schemes that involve error detection and retransmission of lost or corrupted frames are referred to as Automatic Repeat ReQuest (ARQ) error control Magister Manajemen Sistem Informasi 26 ARQ error control All retransmission schemes use all or a subset of the following procedures: Receiver sends an acknowledgment (ACK) if a frame is correctly received Receiver sends a negative acknowledgment (NAK) if a frame is not correctly received The sender retransmits a packet if an ACK is not received within a timeout interval All retransmission schemes (using ACK, NAK or both) rely on the use of timers Magister Manajemen Sistem Informasi 27 ARQ error control Note: Once retransmission is used, a sequence number is required for every data packet to prevent duplication of packets Both ACKs and NAKs can be sent as special frames, or be attached to data frames going in the opposite direction (Piggybacking) Magister Manajemen Sistem Informasi 28 ARQ schemes The most common ARQ retransmission schemes: Stop-and-Wait ARQ Go-Back-N ARQ Selective Repeat ARQ The protocol for sending ACKs in all ARQ protocols are based on the sliding window flow control scheme Magister Manajemen Sistem Informasi 29 Stop-and-wait ARQ Stop-and-Wait ARQ is an addition to the Stopand-Wait flow control protocol: Frames have 1-bit sequence numbers (SN = 0 or 1) Receiver sends an ACK (1-SN) if frame SN is correctly received Sender waits for an ACK (1-SN) before transmitting the next frame with sequence number 1-SN If sender does not receive anything before a timeout value expires, it retransmits frame SN Magister Manajemen Sistem Informasi 30 Stop-and-wait ARQ Lost frame Magister Manajemen Sistem Informasi 31 Stop-and-wait ARQ Lost ACK Magister Manajemen Sistem Informasi 32 Go-back-N ARQ Go-Back-N uses the sliding window flow control protocol. If no errors occur the operations are identical to Sliding Window Operations: A station may send multiple frames as allowed by the window size Receiver sends a NAKi if frame i is in error. After that, the receiver discards all incoming frames until the frame in error was correctly retransmitted If sender receives a NAKi it will retransmit frame i and all packets i+1, i+2,... which have been sent, but not been acknowledged Magister Manajemen Sistem Informasi 33 Go-back-N ARQ Lost frame Magister Manajemen Sistem Informasi 34 Go-back-N ARQ Lost ACK Magister Manajemen Sistem Informasi 35 Details Go-back-N ARQ Scenario 1: A transmits frame i, and B detects error in frame i, but has received frames i-1, i-2,... correctly ➨ B sends NAKi Scenario 2: Frame i is lost or B does not recognize frame i Assume that A sends frame i+1 and B receives it ➨ B sends NAKi, or A will timeout and retransmit frame i Magister Manajemen Sistem Informasi 36 and all subsequent frames Details Go-back-N ARQ Scenario 3: B receives frame i and sends ACK(i+1) which is lost ➨ B may send an ACK(i+k) later which also acknowledges all frames < i+k (ACKs are “cumulative”) or A retransmits frame i and all subsequent frames Scenario 4: NAKi is lost ➨ A will eventually time out Magister Manajemen Sistem Informasi 37 Example of Go-back-N ARQ Magister Manajemen Sistem Informasi 38 Selective-repeat ARQ Similar to Go-Back-N ARQ. However, the sender only retransmits frames for which a NAK is received Advantage over Go-Back-N: Fewer Retransmissions. Disadvantages: More complexity at sender and receiver Each frame must be acknowledged individually (no cumulative acknowledgements) Receiver may receive frames out of sequence Magister Manajemen Sistem Informasi 39 Selective-repeat ARQ Lost frame Magister Manajemen Sistem Informasi 40 Example of Selective-repeat ARQ Magister Manajemen Sistem Informasi 41 Analysis of ARQ protocols What is the efficiency of the discussed ARQ protocols? A number of assumptions: ACKs and NAKs are never lost, and frames are not dropped. Sizes of ACKs, NAKs, and frame headers are negligible. Magister Manajemen Sistem Informasi 42 Error correction techniques Forward error correction (FEC) Hybrid-ARQ (H-ARQ) Type-I H-ARQ Type-II H-ARQ Type-III H-ARQ Magister Manajemen Sistem Informasi 43 Networking Point to point communication not usually practical Devices are too far apart Large set of devices would need impractical number of connections Solution is a communications network Magister Manajemen Sistem Informasi 44 Simplified Network Model Magister Manajemen Sistem Informasi 45 Two types of networks at the data link layer Broadcast Networks: All stations share a single communication channel Point-to-Point Networks: Pairs of hosts (or routers) are directly connected Broadcast Netw ork Point-to-Point Netw ork Typically, local area networks (LANs) are broadcast and wide area networks (WANs) are point-to-point Magister Manajemen Sistem Informasi 46 Networking Computer network A collection of computing devices that are connected in various ways in order to communicate and share resources Usually, the connections between computers in a network are made using physical wires or cables However, some connections are wireless, using radio waves or infrared signals Magister Manajemen Sistem Informasi 47 Networking The generic term node or host refers to any device on a network Data transfer rate The speed with which data is moved from one place on a network to another Data transfer rate is a key issue in computer networks Magister Manajemen Sistem Informasi 48 Switching Networks Long distance transmission is typically done over a network of switched nodes Nodes not concerned with content of data End devices are stations Computer, terminal, phone, etc. A collection of nodes and connections is a communications network Data routed by being switched from node to node Magister Manajemen Sistem Informasi 49 Nodes Nodes may connect to other nodes only, or to stations and other nodes Node to node links usually multiplexed Network is usually partially connected Some redundant connections are desirable for reliability Two different switching technologies Circuit switching Packet switching Magister Manajemen Sistem Informasi 50 Simple Switched Network Magister Manajemen Sistem Informasi 51 Circuit Switching Dedicated communication path between two stations Three phases Establish Transfer Disconnect Must have switching capacity and channel capacity to establish connection Must have intelligence to work out routing Magister Manajemen Sistem Informasi 52 Circuit Switching - Applications Inefficient Channel capacity dedicated for duration of connection If no data, capacity wasted Set up (connection) takes time Once connected, transfer is transparent Developed for voice traffic (phone) Magister Manajemen Sistem Informasi 53 Public Circuit Switched Network Magister Manajemen Sistem Informasi 54 Telecomm Components Subscriber Devices attached to network Local Loop Subscriber loop Connection to network Exchange Switching centers End office - supports subscribers Trunks Branches between exchanges Multiplexed Magister Manajemen Sistem Informasi 55 Circuit Switch Elements Magister Manajemen Sistem Informasi 56 Circuit Switching Concepts Digital Switch Provide transparent signal path between devices Network Interface Control Unit Establish connections Generally on demand Handle and acknowledge requests Determine if destination is free construct path Maintain connection Disconnect Magister Manajemen Sistem Informasi 57 Blocking or Non-blocking Blocking A network is unable to connect stations because all paths are in use A blocking network allows this Used on voice systems Short duration calls Non-blocking Permits all stations to connect (in pairs) at once Used for some data connections Magister Manajemen Sistem Informasi 58 Space Division Switching Developed for analog environment Separate physical paths Crossbar switch Number of crosspoints grows as square of number of stations Loss of crosspoint prevents connection Inefficient use of crosspoints All stations connected, only a few crosspoints in use Non-blocking Magister Manajemen Sistem Informasi 59 Crossbar Matrix Magister Manajemen Sistem Informasi 60 Time Division Switching Partition low speed bit stream into pieces that share higher speed stream e.g. TDM bus switching based on synchronous time division multiplexing Each station connects through controlled gates to high speed bus Time slot allows small amount of data onto bus Another line’s gate is enabled for output at the same time Magister Manajemen Sistem Informasi 61 Control Signaling Functions Audible communication with subscriber Transmission of dialed number Call can not be completed indication Call ended indication Signal to ring phone Billing info Equipment and trunk status info Diagnostic info Control of specialist equipment Magister Manajemen Sistem Informasi 62 Control Signal Sequence Both phones on hook Subscriber lifts receiver (off hook) End office switch signaled Switch responds with dial tone Caller dials number If target not busy, send ringer signal to target subscriber Feedback to caller Ringing tone, engaged tone, unobtainable Target accepts call by lifting receiver Switch terminates ringing signal and ringing tone Switch establishes connection Connection release when Source subscriber hangs up Magister Manajemen Sistem Informasi 63 Packet Switching Data transmitted in small packets Typically 1000 octets Longer messages split into series of packets Each packet contains a portion of user data plus some control info Control info Routing (addressing) info Packets are received, stored briefly (buffered) and past on to the next node Store and forward Magister Manajemen Sistem Informasi 64 Use of Packets Magister Manajemen Sistem Informasi 65 Advantages Line efficiency Single node to node link can be shared by many packets over time Packets queued and transmitted as fast as possible Data rate conversion Each station connects to the local node at its own speed Nodes buffer data if required to equalize rates Packets are accepted even when network is busy Delivery may slow down Priorities can be used Magister Manajemen Sistem Informasi 66 Switching Technique Station breaks long message into packets Packets sent one at a time to the network Packets handled in two ways Datagram Virtual circuit Magister Manajemen Sistem Informasi 67 Datagram Each packet treated independently Packets can take any practical route Packets may arrive out of order Packets may go missing Up to receiver to re-order packets and recover from missing packets Magister Manajemen Sistem Informasi 68 Virtual Circuit Preplanned route established before any packets sent Call request and call accept packets establish connection (handshake) Each packet contains a virtual circuit identifier instead of destination address No routing decisions required for each packet Clear request to drop circuit Not a dedicated path Magister Manajemen Sistem Informasi 69 Virtual Circuits v Datagram Virtual circuits Network can provide sequencing and error control Packets are forwarded more quickly No routing decisions to make Less reliable Loss of a node looses all circuits through that node Datagram No call setup phase Better if few packets More flexible Routing can be used to avoid congested parts of the network Magister Manajemen Sistem Informasi 70 Circuit v Packet Switching Performance Propagation delay Transmission time Node delay Magister Manajemen Sistem Informasi 71 External Virtual Circuit and Datagram Operation Magister Manajemen Sistem Informasi 72 Internal Virtual Circuit and Datagram Operation Magister Manajemen Sistem Informasi 73