38
1 EEC-682/782 Computer Networks I Lecture 18 Wenbing Zhao [email protected] http://academic.csuohio.edu/zhao_w/teaching/eec682.htm (Lecture nodes are based on materials supplied by Dr. Louise Moser at UCSB and Prentice-Hall) Spring Semester 2005 EEC-682: Computer Networks I - Wenbing Zhao 2 Outline The Transport layer Performance issues Review for midterm #2 Reminder: Midterm #2, April 7 Thursday Chapters 5-6 Closed book, closed notes

EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

1

EEC-682/782Computer Networks I

Lecture 18

Wenbing [email protected]

http://academic.csuohio.edu/zhao_w/teaching/eec682.htm(Lecture nodes are based on materials supplied by

Dr. Louise Moser at UCSB and Prentice-Hall)

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 2

Outline

The Transport layerPerformance issues

Review for midterm #2Reminder: Midterm #2, April 7 Thursday

Chapters 5-6Closed book, closed notes

Page 2: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

2

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 3

Performance Issues

Performance Problems in Computer NetworksNetwork Performance MeasurementSystem Design for Better PerformanceFast TPDU ProcessingProtocols for Gigabit Networks

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 4

Performance Problems in Computer Networks

Congestion - caused by temporary resource overloads If more traffic suddenly arrives at a router than the router can handle, congestion will build up and performance will suffer

Structural resource imbalanceFor example, if a gigabit communication line is attached to a low-end PC, the poor CPU will not be able to process the incoming packets fast enough and some will be lost

Page 3: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

3

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 5

Performance Problems in Computer Networks

Broadcast storm - overloads can also be synchronously triggered

For example, if a TPDU contains a bad parameter (e.g., the port for which it is destined), in many cases the receiver will thoughtfully send back an error notification (recall the ICMP packets)

Lack of system tuningFor example, if a machine has plenty of CPU power and memory but not enough of the memory has been allocated for buffer space, overruns will occur and TPDUs will be lost

Networks with high bandwidth-delay productE.g., Gigabit EthernetReceiver’s window should be at least as large as bandwidth-delay

Performance Problems in Computer Networks

The state of transmitting one megabit from San Diego to Boston(a) At t = 0, (b) After 500 μsec, (c) After 20 msec, (d) after 40

msec.

Page 4: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

4

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 7

Network Performance Measurement

The basic loop for improving network performance.Measure relevant network parameters, performanceTry to understand what is going onChange one parameter

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 8

Network Performance Measurement

Where measurements take place - both physically and in the protocol stackWhat to measure ?

How long activity takes - start a timer when beginning some activity and stop the timer at the end of the activity

E.g., knowing how long it takes for a TPDU to be acknowledged How often some event has happened – use counters

E.g., number of lost TPDUsHow many / how much

E.g., the number of bytes processed in a certain time interval.

Page 5: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

5

Network Performance MeasurementAvoid pitfalls during performance measurements

Make sure that the sample size is large enoughMake sure that the samples are representativeBe careful when using a coarse-grained clockBe sure that nothing unexpected is going on during your testsCaching can wreak havoc with measurementsUnderstand what you are measuringBe careful about extrapolating the results

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 10

System Design for Better PerformanceRules of thumb

CPU speed is more important than network speedReduce packet count to reduce software overheadMinimize context switchesMinimize copyingYou can buy more bandwidth but not lower delayAvoiding congestion is better than recovering from itAvoid timeouts

Page 6: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

6

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 11

System Design for Better Performance

Four context switches to handle one packet with a user-space network manager

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 12

Fast TPDU Processing

TPDU processing overhead has two components: overhead per TPDU and overhead per byteThe key to fast TPDU processing is to separate out the normal case (one-way data transfer) and handle it specially

Headers of consecutive data TPDUs are almost the same. To take advantage of this fact, a prototype header is stored within the transport entity. At the start of the fast path, it is copied to a scratch buffer,word by word. Those fields that change from TPDU to TPDU are then overwritten in the buffer. A pointer to the full TPDU header plus a pointer to the user data are then passed to the network layer.

Page 7: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

7

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 13

Fast TPDU Processing

The fast path from sender to receiver is shown with a heavy line. The processing steps on this path are shaded

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 14

Fast TPDU Processing

(a) TCP header. (b) IP header. In both cases, the shaded fields are taken from the prototype without change.

Page 8: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

8

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 15

Fast TPDU Processing

For TCP, the connection record can be stored in a hash table for which some simple function of the two IP addresses and two ports is the key. Once a TPDU is received, the connection record is located from the hash table. The fast path then updates the connection record and copies the data to the user.The general scheme of first making a quick check to see if the header is what is expected and then having a special procedure handle that case is called header prediction

Many TCP implementations use it

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 16

Fast TPDU Processing

Two other areas where major performance gains are possible

Buffer management - avoiding unnecessary copyingTimer management - nearly all timers set do not expire

They are set to guard against TPDU loss, but most TPDUsarrive correctly and their acknowledgements also arrive correctly. Hence, it is important to optimize timer management for the case of timers rarely expiring.

A common scheme is to use a linked list of timer events sorted by expiration time

Page 9: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

9

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 17

Fast TPDU ProcessingTiming wheel – An array for timer management. A more efficient approach if maximum timer interval is bounded and known in advance

Each slot corresponds to one clock tickTo add a timer, an entry is made into an appropriate slot To cancel a timer, the corresponding slot is located and the entry is removedWhen the clock ticks, the current time pointer is advanced by one slot (circularly)

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 18

Protocols for Gigabit Networks

Problems of old network protocols on Gigabit networks

Sequence number recyclingThe assumption that the time to use up the entire sequence space would greatly exceed the maximum packet lifetime no longer hold trueMany protocols use 32-bit sequence numbers. It take as little as 34 sec to cycle through, well under the 120 sec maximum packet lifetime on the Internet

Communication speeds have improved much faster than computing speeds

Fast network traffic can easily saturate CPU

Page 10: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

10

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 19

Protocols for Gigabit Networks

Problems of old network protocols on Gigabit networks

go back n protocol performs poorly on lines with a large bandwidth-delay productGigabit lines are fundamentally different from megabit lines in that long gigabit lines are delay limited rather than bandwidth limitedFor many gigabit applications, such as multimedia, the variance in the packet arrival times is as important as the mean delay itself. A slow-but-uniform delivery rate is often preferable to a fast-but-jumpy one

Protocols for Gigabit Networks

Time to transfer and acknowledge a 1-megabit file over a 4000-km line

Latency is determined by the speed of light for high enough bandwidth

Page 11: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

11

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 21

Protocols for Gigabit Networks

Design principleDesign for speed, not for bandwidth optimizationFeedback issues

Use rate-based protocol in stead of sliding window protocolResource reservation based protocol in stead of slow start algorithm

Header should contain as few fields as possible

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 22

Protocols for Gigabit Networks

Design principleThe header and data should be separately checksummed.

First, to make it possible to checksum the header but not the data.Second, to verify that the header is correct before copying the data into user space. It is desirable to do the data checksum at the time the data are copied to user space

Page 12: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

12

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 23

Protocols for Gigabit Networks

Design principleThe maximum data size should be large, to permit efficient operation even in the face of long delays

1500 bytes is too smallSend a normal amount of data along with the connection requestOn protocol software

concentrating on the successful caseMinimize copying

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 24

Review for Midterm #2

Chapter 5: Network layerChapter 6: Transport layer

Page 13: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

13

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 25

Network Layer

Network layerMain concern: end-to-end transmission

Perhaps over many hops at intermediate nodesNetwork Layer Design Issues

Services Provided to the Transport LayerRouting, Congestion control, Internetworking

Goals – services shouldBe independent of subnet technologiesShield transport layer from number, type, topology of subnetsUniform network addresses across LAN/WAN

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 26

Routing Algorithms

Shortest Path RoutingFloodingDistance Vector RoutingLink State RoutingBroadcast Routing

Page 14: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

14

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 27

Sink TreeSink tree – the set of optimal routes from all sources to a given destination form a tree rooted at the destination

(a) A subnet. (b) A sink tree for router B.

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 28

Shortest Path Routing

Shortest in what sense?Number of hops, geographical distance, least queueing and transmission delay

Dijkstra’s AlgorithmEach node labeled with distance from source node along best known pathInitially, no paths known all nodes labeled with infinityAs algorithm proceeds, labels may change reflecting shortest pathLabel may be tentative or permanent, initially, all tentativeWhen label represents shortest path from source to node, label becomes permanent

Page 15: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

15

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 29

FloodingIdea: every incoming packet is sent out on every outgoing line except the one it arrived onAdv: flooding always chooses shortest path, no other algorithm has shorter delayDisadv: generates lots of duplicatesMethods to damper this effect

Header of each packet has hop counter that is decremented at each hop; packet discarded when counter reaches 0Source router puts sequence number in each packet it receives from its hosts

Each router has list for each source router telling which sequence numbers originating at that source have already been seenEach list augmented with counter k, meaning all sequence numbers up through k have been seenIf packet is duplicate, router discards it

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 30

Distance Vector RoutingAlso called Bellman-Ford or Ford-Fulkerson. Used in ARPANETIdea: each router maintains a table (a vector), giving best known distance to each destination and which line to use to get there

Table is updated by exchanging info with neighborsTable contains one entry for each router in network with

Preferred outgoing line to that destinationEstimate of time or distance to that destination

Once every T msec, router sends to each neighbor a list of estimated delays to each destination and receives same from those neighbors

d(A,Y)A

X Zd(A,X)

d(Y,Z)

d(X,Z)

At router A, for ZCompute d(A,X) + d(X,Z) and d(A,Y) + d(Y,Z), take minimum

Y

Page 16: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

16

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 31

Distance Vector Routing -Exercise

Consider the subnet shown. Distance vector routing is used, and the following vectors have just come in to router C:

from B: (5, 0, 8, 12, 6, 2); from D: (16, 12, 6, 0, 9, 10); and from E: (7, 6, 3, 9, 0, 4).

The measured delays to B, D, and E, are 6, 3, and 5, respectively. What is C's new routing table? Give both the outgoing line to use and the expected delay.

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 32

Distance Vector Routing - Exercise

Going via B gives (11, 6, 14, 18, 12, 8).Going via D gives (19, 15, 9, 3, 9, 10).Going via E gives (12, 11, 8, 14, 5, 9).Taking the minimum for each destination except C gives (11, 6, 0, 3, 5, 8).The outgoing lines are (B, B, –, D, E, B).

Page 17: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

17

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 33

Building Link State PacketsPackets contain identity of sender, sequence number, age, list of neighbors and delay to that neighborWhen are link state packets constructed?

Periodically at regular intervalsWhen link or nodes goes down or comes back

(a) A subnet. (b) The link state packets for this subnet.

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 34

Broadcast RoutingAlternative strategies

Spanning tree – the sink tree (no loops) rooted at source that includes all routersRouter forwards copies of packet on all lines except line on which it arrived, using reverse path forwarding

Idea: if router gets packet on optimal (reverse) path to root, then it forwards the packet

Page 18: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

18

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 35

Broadcast Routing - Exercise

Looking at the subnet shown below, how many packets are generated by a broadcast from B, using

(a) reverse path forwarding?(b) the sink tree?

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 36

Broadcast Routing - ExerciseB

A

F

K

C

D I J

H

L

G M

G H I D J I E N

OMH

L H

2

4

10

8

L E F O4

Sink tree – 14Reverse Forwarding - 28

Page 19: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

19

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 37

Congestion Control Algorithms

Warning bitChock packetHop-by-hop chock packet

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 38

Warning Bit

Signal the warning state by setting a special bit in the packet’s header

When packet arrived at its destination, transport entity copied the bit into the next ack sent back to the sourceThe source then cut back on trafficEvery router along the path could set the warning bit, traffic increases only when no router is in trouble

Page 20: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

20

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 39

Choke Packets

Tell the source directly to reduce trafficEach router monitors utilization of each of its output linesWhen utilization becomes greater than threshold, output line enters warning stateFor each newly arriving packet, check if output line in warning stateIf so, router sends choke packet back to source giving it the destination found in the packetPacket is tagged so does not generate any more choke packets and forwarded as usualWhen source receives choke packet, it must reduce traffic to specific destination

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 40

Hop-by-Hop Choke PacketsThe router that receives a choke packet must reduce the flow to its downstream router

This is achieved by allocating more buffer to the incoming flowThe router also passes the choke packet to its upstream router

(a) A choke packet that affects only the source.

(b) A choke packet that affects each hop it passes through.

Page 21: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

21

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 41

Load Shedding

RED - Random Early DetectionHaving routers drop packets before situation becomes hopelessRouters maintain a running average of their queue lengthsWhen average queue length on some line exceeds a threshold, the line is said to be congested and action is takenJust discard selected packet and not report it.Sender respond to lost packets by slowing down transmission rateAppropriate for wired networks

The Leaky Bucket AlgorithmNo matter what rate water enters the bucket, water flows out of the bucket at constant rate ρ (provided bucket is not empty)

When bucket is full, water slops over sides and is lostAnalogous to finite queue in network switch

Page 22: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

22

The Token Bucket AlgorithmThe bucket hosts tokens in stead of data packetsA token represents a packet or k bytesTokens are added into the bucket with a constant rateBucket has certain capacity. If bucket is full, new tokens are thrown awayA data packet can be transmitted only if enough tokens present in bucketToken bucket algorithm allows some burstinessbecause a full bucket of tokens can be saved used all at once

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 44

Token Bucket Algorithm - Exercise

A computer on a 6-Mbps network is regulated by a token bucket. The token bucket is filled at a rate of 1 Mbps. It is initially filled to capacity with 8 megabits. How long can the computer transmit at the full 6 Mbps?Solution: Using the formula S = C/(M − ρ), C=8, M=6, ρ =1, we get S = 8/(6 − 1) or 1.6 sec.

Page 23: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

23

Tunneling

Tunneling – common solution for interconnecting multiple heterogeneous networks when the source and destination hosts are on the same type of network

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 46

Internetworking - Exercise

Is fragmentation needed in concatenated virtual-circuit internets or only in datagram systems?

Needed in bothTunneling through a concatenated virtual-circuit subnet is straightforward: the multiprotocol router at one end just sets up a virtual circuit to the other end and passes packets through it. Can tunneling also be used in datagram subnets? If so, how?

Yes. Just encapsulate the packet in the payload field of a datagram belonging to the subnet being passed through and send it.

Page 24: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

24

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 47

The IP Protocol

The IPv4 (Internet Protocol) header.

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 48

The IPv4 HeaderIHL – length of header in 32-bit words

Min 5, max 15 – i.e., 60 bytesTotal length – header and data ≤ 65,535 (216-1) bytesIdentification – allows destination to determine which datagram a fragment belongs toDF – Don’t’ Fragment; MF – More Fragments Fragment offset – where in datagram this fragment belongs

All fragments (payload in the IP packet) except last must be multiples of 8 bytesThe number of 8 byte blocks is called Number of Fragment Blocks (NFB).The unit of the offset is NFB

Time to live – counter to limit packet lifetimesPacket is destroyed when counter becomes 0

Protocol – which transport layer protocols being usedHeader checksum – verifies header

Page 25: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

25

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 49

IP Fragmentation - Exercise

Suppose that host A is connected to a router R 1, R 1 is connected to another router, R 2, and R 2 is connected to host B. Suppose that a TCP message that contains 900 bytes of data and 20 bytes of TCP header is passed to the IP code at host A for delivery to B. Assume that no option is included in the IP header. Show the Total length, Identification, DF, MF, and Fragment offset fields of the IP header in each packet transmitted over the three links. Assume that link A-R1 can support a maximum frame size of 1024 bytes including a 14-byte frame header, link R1-R2 can support a maximum frame size of 512 bytes, including an 8-byte frame header, and link R2-B can support a maximum frame size of 512 bytes including a 12-byte frame header.

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 50

IP Fragmentation – Exercise Solution

The initial IP datagram will be fragmented into two IP datagrams at I1. No other fragmentation will occur.

Link A-R1:Length = 940; ID = x; DF = 0; MF = 0; Offset = 0

Link R1-R2:(1) Length = 500; ID = x; DF = 0; MF = 1; Offset = 0(2) Length = 460; ID = x; DF = 0; MF = 0; Offset = 60

Link R2-B:(1) Length = 500; ID = x; DF = 0; MF = 1; Offset = 0(2) Length = 460; ID = x; DF = 0; MF = 0; Offset = 60

Page 26: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

26

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 51

CIDR – Classless InterDomain Routing

Shortage of IP addresses caused by the classfuladdressingSolution – for the remaining IP addresses, CIDR is used

Allocate remaining IP addresses in variable-sized blocks, without regard to the classesThe starting address must fall on the boundary of the block sizeE.g., if a site needs, say, 2000 addresses, it is given a block of 2048 addresses on a 2048-byte boundary

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 52

CIDR – Exercise

A large number of consecutive IP address are available starting at 198.16.0.0. Suppose that four organizations, A, B, C, and D, request 4000, 2000, 4000, and 8000 addresses, respectively, and in that order. For each of these, give the first IP address assigned, the last IP address assigned, and the mask in the w.x.y.z/s notation.Solution: To start with, all the requests are rounded up to a power of two. The starting address, ending address, and mask are as follows: A: 198.16.0.0 – 198.16.15.255 written as 198.16.0.0/20B: 198.16.16.0 – 198.16.23.255 written as 198.16.16.0/21C: 198.16.32.0 – 198.16.47.255 written as 198.16.32.0/20D: 198.16.64.0 – 198.16.95.255 written as 198.16.64.0/19

Page 27: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

27

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 53

CIDR – Exercise

A router has just received the following new IP addresses: 57.6.96.0/21, 57.6.104.0/21, 57.6.112.0/21, and 57.6.120.0/21. If all of them use the same outgoing line, can they be aggregated? If so, to what? If not, why not?Solution: Rewrite the four IP addresses in binary form:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0

As can be seen, the first 19 bits are the same, so the four addresses can be aggregated to 57.6.96.0/19.

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 54

NAT – Network Address Translation

Temporary solution – network address translationEach company or family is assigned a single IP address (or a small number of them)Within the company, every computer gets a unique private IP address, which is used for routing intramural trafficWhen a packet exits the company and goes to the ISP, an address translation takes placeThree ranges of IP addresses have been declared as private:

10.0.0.0 – 10.255.255.255 (16,777,216 hosts)172.16.0.0 – 172.31.255.255/12 (1,048,576 hosts)192.168.0.0 – 192.168.255.255/16 (65,536 hosts)

Page 28: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

28

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 55

NAT – Network Address Translation

What about the incoming traffic?Solution is based on the assumption all traffic is TCP/UDPTCP/UDP has two port fields, one for source port, the other for destination port, each 16 bits wideThe source port is used as an index to an internal table maintained by the NAT boxThe internal sender’s private IP and original port info are stored in the tableWhen the reply comes back, it will carry the index as the destination port, the NAT box then translates the address backFor both outgoing and incoming address translations, the TCP/UDP and IP header checksums are recomputed

Internet Control ProtocolsICMP – Internet Control Message ProtocolARP – find the mapping of IP addresses to data link layer addressesRARP - This protocol allows a newly-booted diskless-workstation (e.g., X terminal) to broadcast its Ethernet address and ask forits IP address

RARP server responds to a RARP request with the assigned IP address

BOOTP– uses UDPDHCP - Allows both manual IP address assignment and automatic assignment. DHCP has largely replaced RARP and BOOTP

A DHCP relay agent is needed on each LAN. The only piece of information the relay agent needs is the IP address of the DHCP server.To find its IP address, a newly-booted machine broadcasts a DHCP DISCOVER packet. The DHCP relay agent on its LAN receives all DHCP broadcasts. When it finds a DHCP DISCOVER packet, it sends the packet as a unicast packet to the DHCP server, possibly on a distant networkIP address assignment is lease-based (to cope with client failure)

Page 29: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

29

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 57

Internet Routing Protocols

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 58

OSPFWithin area, each router has same link state databaseEach router periodically floods LINK STATE UPDATE packets to each of its adjacent routersEach router constructs the graph for its area and computes shortest pathBackbone router also does:

Accepts info from area border routersComputes best route from each area border router to every other area border routerThis info propagated back to area border routers which advertise it within their areas

Using this info, router about to send interarea packet selects best exit router to backbone

Page 30: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

30

The Exterior Gateway Routing Protocol

Border Gateway Protocol (BGP)Used between autonomous systems Main concerns: politics, security, economicUses distance vector routing except keeps track of exact path instead of cost to destination and periodically tells its neighbors that path

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 60

Transport Layer

Transport Entity - The hardware and/or software within the transport layer that does the work. The transport entity can be located in

Operating system kernel, a separate user process, a library package bound into network applications, or conceivably on the network interface card

The transport layer fulfills the key function of isolating the upper layers from the technology, design, and imperfections of the subnet

Transport service provider - The bottom four layers Transport service user - the upper layer(s)

Page 31: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

31

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 61

Berkeley SocketsSocket – an endpoint to which connections can be attached from bottom (OS) and to which processes can be established from topSocket primitives for TCP

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 62

UDP Header

The source port and destination port serve to identify the end points within the source and destination machines.

When a UDP packet arrives, its payload is handed to the process attached to the destination port. This attachment occurs when BIND primitive or something similar is used

The UDP length field includes the 8-byte header and the data. The UDP checksum is optional and stored as 0 if not computed (a true computed 0 is stored as all 1s)

Page 32: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

32

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 63

The TCP Service ModelRequires both sender and receiver to create socketEach socket has socket number (address) consisting of IP address of host and 16-bit port numberPort is TCP name for TSAPConnections are identified by the socket identifiers at both ends, i.e., (socket1, socket2)Port numbers below 1024 are called well-known ports and are reserved for standard services

E.g., 21 for FTP, 23 for TelnetFull-duplex, point-to-pointTCP connection is byte stream, not message stream, no message boundaries

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 64

TCP ProtocolSequence numbers used for ACKs and also for window mechanismSender and receiver TCP entities exchange data in the form of segmentsSegment – fixed 20 byte header + optional part followed by dataTCP software decides size of segments, accumulate data from several writes into 1 segment, or split data from one write over multiple segmentsTwo limits on segment size

Each segment including TCP header must fit into 65,535 byte IP payloadEach network has MAX Transfer Unit (MTU) and each segment must fit into MTU

Page 33: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

33

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 65

TCP Protocol

Uses sliding window for flow controlResembles go-back-n protocolNo selective ack, or nack, e.g., if 1-1024 and 2049-3072 are received, can only ack 1025RFC 1106 propose a solution, using TCP options

ExerciseWhy in UDP header there is a payload length field, but in TCP header there is not?

Page 34: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

34

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 67

TCP Connection Establishment and Release

TCP state transition diagram

Page 35: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

35

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 69

TCP Transmission Policy

Nagle’s algorithm: solution for the 1-byte-at-a-time sender problem

When sender application passes data to TCP one byte at a time

Send first byte Buffer the rest until first byte ACKedThen send all buffered bytes in one TCP segmentStart buffering again until all ACKed

Implemented widely in TCP, can be disabled/enabled by using socket optionsFor some application, it is necessary to disable the nagle’salgorithm, e.g, X Windows program over Internet, to avoid erratic mouse movement, etc.

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 70

TCP Transmission Policy

Clark’s algorithm (to avoid the silly window syndrome)Receiver should not send window update until it can handle max segment size it advertised when connection established or its buffer is half empty, whichever is smallerSender should wait until it has accumulated enough space in window to send full segment or one containing at least half of receiver’s buffer size

Nagle’s algorithm and Clark’s algorithm are complementary

Page 36: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

36

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 71

TCP Congestion Control

Slow start algorithmWhen connection is established, sender initializes congestion window size to size of max segment in use on connection, it then sends one max segmentIf segment is acked before timer goes off, it increases congestion window size by max segment size, it then sends two segmentsDoubling each time (congestion window size is increased exponentially) until timeout occurs or receiver’s window size is reached

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 72

TCP Congestion Control

Internet congestion control algorithmThree parameters

Receiver’s window sizeSender’s congestion window sizeThreshold, initially 64KB

When timeout occurs, threshold is set to half currentcongestion window size; congestion window size is set to one max segment sizeUse slow start algorithm but stop when threshold is reached, then increase congestion window size linearly

Page 37: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

37

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 73

TCP Timer Management

The algorithm generally used by TCP is due to Jacobson (1988)For each connection, TCP maintains a variable, RTT, that is the best current estimate of the round-trip time to the destination in questionRTT is updated according to formula RTT = αRTT + (1-α)M

M is the newly measured roundtrip timeα is a smoothing factor that determines how much weight is given to the old value. Typically α = 7/8

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 74

TCP Timer Management

Timeout = βRTTConstant value was inflexible because it failed to respond when the variance went upNeed another smoothed variable, D, the deviation. Whenever an acknowledgement comes in, the difference between the expected and observed values, | RTT - M |, is computed. A smoothed value of this is maintained in D by the formula D = αD + (1-α)|RTT – M|Time out is set to RTT + 4×D

How to update RTT if there is a timeout?Karn’s algorithm: do not update RTT on any segments that have been retransmitted. Instead, the timeout is doubled on each failure until the segments get through the first time

Page 38: EEC-682/782 Computer Networks I...EEC-682: Computer Networks I-Wenbnig Zhao 25 Network Layer Network layer Main concern: end-to-end transmission Perhaps over many hops at intermediate

38

Spring Semester 2005EEC-682: Computer Networks I

- Wenbing Zhao 75

TCP Timer Management

Persistence timer – used on the sending side. Designed to prevent the deadlock caused by the loss of window update packet when receiver’s window is 0Keepalive timer - when a connection has been idled for a long time, the keepalivetimer may go off to cause one side to check whether the other side is still there. If it fails to respond, the connection is terminated. The last timer used on each TCP connection is the one used in the TIMED WAIT state while closing. It runs for twice the maximum s m t lif tim t m k s th t h