chapter 7: internet at work

32
1 7: Internet at work 1 Chapter 7: Internet at Work Silvia Giordano ICA-EPFL

Upload: others

Post on 12-Sep-2021

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 7: Internet at Work

1

7: Internet at work 1

Chapter 7:Internet at Work

Silvia Giordano

ICA-EPFL

Page 2: Chapter 7: Internet at Work

2

7: Internet at work 2

IntroductionChapter goal:r understand how networks support the

applications with an example:mapplication data generationmprocess-to-process data transfermend-to-end data transferm local data transfer

rInteractive: do it together!

Now that we introduced the basics of computer networks, and how they make distributed applications communicating, we give a practical example of how this works.

We will give in this chapter an example of a distributed application at work. This should help you to understand how the communication networks transport the application data.

Page 3: Chapter 7: Internet at Work

3

7: Internet at work 3

Overview

rWe assume to have two hosts A and E belonging to two different LANs interconnected by a router. rWe will follow the steps done by a

data packet that A sends to E. rOur path will move from the

application down to the datalink layer and up again to the application.

We will make, as example, a web communication between two hosts A and E. We will start by examining the functions and the requirements at the application layer and we will move down to see how the transport layer offer to the application layer the required service, and so on, until we reach the physical layer.

Page 4: Chapter 7: Internet at Work

4

7: Internet at work 4

Chapter goals:q understand how network applications use

(Internet) in practice with real example that covers all layers

q cover issues and problems that are not clear

q answer to possible questions

This practical example should help you in understanding the complex process of the application communication in the Internet, with a clear view of all layers role and functions.

Page 5: Chapter 7: Internet at Work

5

7: Internet at work 5

Example: the Internet at workr We assume to have two users working at hosts A and E,

which belongs to two different LANs interconnected by a router.

r We will follow the steps done by a data packet that A sends to E.

r Our path will move from the application down to the datalink layer and up again to the application.A

BE

LAN2LAN1

LAN3

This is our network. We have three LANs interconnected by a router and we have a web server running at host E. The user at host A wants to access a web page and starts the web client at host A.

Page 6: Chapter 7: Internet at Work

6

7: Internet at work 6

Application Layer services:q all services to the user (e.g. web, email,

etc…)q evolution with new applicationsq in this example: web page access

A

BE

LAN2LAN1

LAN3

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

`C

S

user interface

user interface

Let’s start with the application layer. As previously introduced, at this layer we have all the “users” services, e.g. all the services that are directly used by the users as applications. The services at application layer are in continuous evolution, as they do follow the current trend in the people life. In this example we assume that the service is a web service: a user working at the host A wants to access a web page maintained by the web server running at E. We have already illustrated the step done for accessing a web page. From the users point of view this consists in simply clicking on the link for the wished page and waiting until the browser displays it. At the server side, the application, once it receives the request, it does a search in its database for finding the page and it sends it back to the user. But how this works? How the application can obtain from the transport the service (mainly: no losses) from the transport. How the request can be routed to the right destination? How the data are transferred?

Page 7: Chapter 7: Internet at Work

7

7: Internet at work 7

Application functions

qapplication program: web browser and serverq access the transport layer:qAPIqspecify of transport services required (mainly the transport service model (UDP or TCP)

qapplication protocol: HTTP

The functions implemented at the application layer are (1) the programs that run remotely and that implement the application, (2) the access to the transport layer, which is done through the sockets, (3) the protocol that describes the set of messages exchanged by the distributed processes and by the application and the underlying transport entity, as well as the consequent actions.

Page 8: Chapter 7: Internet at Work

8

7: Internet at work 8

Application functions: access TCP

webbrowser

transportlayer

socket

controlled byapplication

controlled byoperating

system

host orserver

webserver

transportlayer

socket

controlled byapplication

controlled byoperatingsystem

host orserver

internet

q access through socketsq port number (and IP address)

A fundamental function implemented at the application layer is the access to the transport layer. In Internet this is done through the socket, specified with the IP address of the host where the application runs, and with the port number used by the application. Here, the web browser at A reads a line from its standard input (keyboard) that correspond to the page requested by the user. It sends the line out its socket to the web server at E. As the application is HTTP, the underlying transport layer is TCP. The only information passed to TCP from the application is the address of the destination: the port number of the web server at E (port 80) and the IP address of E (128.178.2.2). In reality, the web application passes the name of the web server (www.urlE.ch) and then this is converted by contacting the DNS. But we will skip this step in our example.

Page 9: Chapter 7: Internet at Work

9

7: Internet at work 9

Application functions: httpSuppose user enters URL to a page at E

www.urlE.ch/something/home.index

1a. http client initiates TCP connection to http server (process) at www.urlE.ch. Port 80 is default for http server.

2. http client sends http request message (containing URL) into TCP connection socket

1b. http server at host www.urlE.chwaiting for TCP connection at port 80. “accepts” connection, notifying client

3. http server receives request message, forms response message containing requested object (something/home.index ), sends message into socket

time

5. http client receives response message containing html file,

displays html.

4. http server closes TCP connection.

Let’s see how the communication between peer application entities and how the interaction between application and transport layers work in this case: the HTTP protocol.

The page consists of a base HTML file, and the URL for the base HTML file is www.urlE.ch/something/home.index. From the application point of view, we have the following steps:

1. The HTTP client initiates a TCP connection to the server www.urlE.ch. Port number 80 is used as the default port number at which the HTTP server will be listening for HTTP clients that want to retrieve documents using HTTP.

2. The HTTP client sends a HTTP request message to the server via the socket associated with the TCP connection that was established in step 1. The request message includes the path name /something/home.index.

3. The HTTP server receives the request message via the socket associated with the connection that was established in step 1, retrieves the object /something/home.index from its storage (RAM or disk), encapsulates the object in an HTTP response message, and sends the response message to the client via the socket.

4. The HTTP server tells TCP to close the TCP connection. (But TCP doesn't actually terminate the connection until the client has received the response message intact.)

5. The HTTP client receives the response message. The TCP connection terminates. The message indicates that the encapsulated object is an HTML file. The client extracts the file from the response message.

As the browser receives the Web page, it displays the page to the user.

Page 10: Chapter 7: Internet at Work

10

7: Internet at work 10

Application Layer requirements:q data transfer with no losses

A

BE

LAN2LAN1

LAN3

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

`C

S

?applicationtransportnetworkdata linkphysical

As this is a simple data transfer, we assume that the only requirement from the application is to transfer the data without losses, regardless any quality of the service. This is automatically done by TCP. Thus the application has only to choose TCP as transport service model.

Now, let’s examine what happens to the first data packet (the http request) sent from A to E. As said, the packet is passed down from the application peer entity at A to the transport peer entity at A through the local socket at A.

Page 11: Chapter 7: Internet at Work

11

7: Internet at work 11

HTTP data requestq the application has concludedqTCP starts

HTTPreq

ATCP

The http data request created by the application peer entity at A moves down to the transport peer entity at A through the local TCP socket at A. The fact that the socket was opened as a TCP socket already establish the “service contract” between the application and the transport layer. Once the http data request is passed through the socket, the application layer at A concludes its task, and now it is the turn of the TCP transport entity at A to work. It has to ensure that a connection oriented and reliable service is offered to this application session.

Page 12: Chapter 7: Internet at Work

12

7: Internet at work 12

Transport Layer servicesqTCPq connection-orientedq reliable data transferq flow and congestion control (not in the example)

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

A

BE

LAN2LAN1

LAN3

logical end -end transport

P

P

The transport peer entity at A is a TCP entity. Thus it will set up a logical connection to the transport peer entity at E for transferring the application’s data. As it is TCP transport service, the data will be transferred in order and with no losses.

Page 13: Chapter 7: Internet at Work

13

7: Internet at work 13

Transport Layer functionsq connection management: 3 way handshakeq data transfer

Now the packet is with TCP entity at A that will logically send it in a reliable way to the peer entity at E. In order to do that, it starts the three-way handshake with the peer entity at E. This will establish the logical connection between the peer entities at A and E. In practice, this will set up some resources (window variables, buffers) for this connection. These will be used for recording the data (bytes) that have already been sent, the ones waiting for the acknowledge, for discovering data that needs to be retransmitted, as well as for buffering the data that cannot be transmitted because the network or the receiver are busy.

Page 14: Chapter 7: Internet at Work

14

7: Internet at work 14

Transport Layer functionsq connection managementq reliability

2222 80

32 bits

http request)

sequence numberacknowledgement number

rcvr window sizeptr urgent datachecksum

FSRPAUheadlen

notused

Options

The information

Page 15: Chapter 7: Internet at Work

15

7: Internet at work 15

q routing data to destination (end system E)Transport Layer requirements:

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

?TCP

packet

TCP

TCPstate

IP

Now the transport entity at A passes down the data to the network entity at A. as opposite to the application layer behavior, which in our example left all the duties to the transport layer, the TCP cannot do the same with IP. This because IP is unreliable, and thus TCP has to maintain a lot of information for this connection to ensure a reliable service to the application. This information (that is logically a stream of data at the application layer) is passed as a TCP packet, where the information of the communicating sockets (source and destination port numbers) are specified. In addition, the TCP entity “tells” the IP entity about the identity of the end system on which the peer entity runs (the IP address of E).

Note that, before sending down the packet containing the application data, TCP will send to the network layer the transport packets for the 3-way handshake, which we do not consider here.

Page 16: Chapter 7: Internet at Work

16

7: Internet at work 16

Routing Layer services:q Routing: path discoveryr Packet forwardingr IP: packet switching

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

1. Send data 2. Receive data

Page 17: Chapter 7: Internet at Work

17

7: Internet at work 17

Routing Layer functions:

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

r transport packet from sending to receiving hosts

r network layer protocols in every host, router

three important functions:r path determination: route

taken by packets from source to dest. Routing algorithms

r switching: move packets from router’s input to appropriate router output

r call setup: some network architectures require router call setup along path before data flows

Page 18: Chapter 7: Internet at Work

18

7: Internet at work 18

Getting a datagram from source to dest.

IP datagram:

128.178.1.1

128.178.1.2

128.178.1.3

128.178.1.4128.178.2.9

128.178.2.2

128.178.2.1

128.178.3.2128.178.3.1

128.178.3.27

A

BE

miscfields

sourceIP addr

destIP addr data

r datagram remains unchanged, as it travels source to destination

r addr fields of interest here

r How do you know A and E are on different subnets?

routing table in ADest. Net. next router Nhops128.178.1 1128.178.2 128.178.1.4 2128.178.3 128.178.1.4 2

Every IP datagram has a source address field and a destination address field. The source host fills a datagram's source address field with its own 32-bit IP address. It fills the destination address field with the 32-bit IP address of the final destination host to which the datagram is being sent. The data field of the datagram is typically filled with a TCP or UDP segment. The IP datagram travels inside the network remaining unchanged. For routing purpose, the fields of main interest (e.g. the fields that are read and used) are the two addresses: source and destination.The way the network transports the datagram from the source to the destination depends on whether the source and destination reside on the same subnetwork.

Page 19: Chapter 7: Internet at Work

19

7: Internet at work 19

Getting a datagram from source to dest.: different subnetworks

128.178.1.1

128.178.1.2

128.178.1.3

128.178.1.4128.178.2.9

128.178.2.2

128.178.2.1

128.178.3.2128.178.3.1

128.178.3.27

A

BE

Starting at A, dest. E:r look up network address of Er E on different network

m A, E not directly attachedr routing table: next hop

router to E is 128.178.1.4 r link layer sends datagram to

router 128.178.1.4 inside link-layer frame

r datagram arrives at 128.178.1.4

r continued…..

Dest. Net. next router Nhops128.178.1 1128.178.2 128.178.1.4 2128.178.3 128.178.1.4 2

miscfields128.178.1.1 128.178.2.3 data

P

P

P

Host A wants to send a datagram to another host, say E, that is on a different network. Host A again consults its routing table and finds an entry, 128.178.2.0/24, whose network address matches the leading bits in the IP address of host E. Because the number of hops to the destination is 2, host Aknows that the destination is on another network and thus an intervening router will necessarily be involved. The routing table also tells host A that in order to get the datagram to host E, host A should first send the datagram to IP address 128.178.1.4, the router interface to which A's own interface is directly connected. IP in host A then passes the datagram down to the link layer and indicates to the link layer that it should send the datagram to IP address 128.178.1.4. It's important to note here that although the datagram is being sent (via the link layer) to the router's interface, the destination address of the datagram remains that of the ultimate destination (host E,) not that of the intermediate router interface.

Page 20: Chapter 7: Internet at Work

20

7: Internet at work 20

128.178.1.1

128.178.1.2

128.178.1.3

128.178.1.4128.178.2.9

128.178.2.2

128.178.2.1

128.178.3.2128.178.3.1

128.178.3.27

A

BE

Arriving at 128.178.1.4, destined for 128.178.2.2

r look up network address of Er E on same network as router’s

interface 128.178.2.9m router, E directly attached

r link layer sends datagram to 128.178.2.2 inside link -layer frame via interface 128.178.2.9

r datagram arrives at 128.178.2.2!!! (hooray!)

network router Nhops interface

128.178.1 - 1 128.178.1.4128.178.2 - 1 128.178.2.9

128.178.3 - 1 128.178.3.27

Dest. next

Getting a datagram from source to dest.: different subnetworks

miscfields128.178.1.1 128.178.2.3 data

P

P

P

P

The datagram is now in the router, and it is the job of the router to move the datagram toward its ultimate destination. The router consults it own routing table and finds an entry, 128.178.2.0/24, whose network address matches the leading bits in the IP address of host E. The routing table indicates that the datagram should be forwarded on router interface 128.178.2.9. Since the number of hops to the destination is 1, the router knows that destination host Eis on the same network as its own interface, 128.178.2.9. The router thus moves the datagram to this interface, which then transmits the datagram to host E.

Page 21: Chapter 7: Internet at Work

21

7: Internet at work 21

Routing Layer requirements:

q local transportation (connected devices)qmapping of network addresses to physical

addresses

Page 22: Chapter 7: Internet at Work

22

7: Internet at work 22

DataLink Layer functions:qmultiple accessr local data transferr local address translation

Page 23: Chapter 7: Internet at Work

23

7: Internet at work 23

Link Layer ServicesEthernet + ARPr Framing, link access:m encapsulate datagram into frame, adding

header, trailerm implement channel access

rAddress Resolution Protocolmmapping between IP addresses and MAC

addressesr Error Detection:m receiver detects presence of errors with CRC

Possible services that can be offered by a link-layer protocol include:

•Framing and link access. Almost all link-layer protocols encapsulate each network-layer datagram within a network-layer datagram is inserted, and a number of header fields. A data-link protocol specifies the structure of the frame, as well as a channel access protocol that specifies the rules by which a frame is transmitted onto the link. For point-to-point links that have a single sender on one end of the link and a single receiver at the other end of the link, the link-access protocol is simple (or non-existent)--the sender can send a frame whenever the link is idle. The more interesting case is when multiple nodes share a single broadcast link--the so-called multiple access problem. Here, the channel access protocol serves to coordinate the frame transmissions of the many nodes link-layer frame before transmission onto the link. A frame consists of a data field, in which the. The frame headers also often include fields for a node's so-called physical address, which is completely distinct from the node's network layer (for example, IP) address.

•Reliable delivery. When a link-layer protocol provides reliable-delivery service, it guarantees to move each network-layer datagram across the link without error. This is achieved with acknowledgments and retransmissions. A link-layer reliable-delivery service is often used for links that are prone to high error rates, such as a wireless link, with the goal of correcting an error locally, on the link where the error occurs, rather than forcing an end-to-end retransmission of the data by a transport- or application-layer protocol. However, link-layer reliable delivery can be considered an unnecessary overhead for low bit-error links, including fiber, coax, and many twisted-pair copper links. For this reason, many of the most popular link-layer protocols do not provide a reliable-delivery service.

Page 24: Chapter 7: Internet at Work

24

7: Internet at work 24

Routing to another LAN (1)

walkthrough: routing from A to E via R

r In routing table at source Host, find router 111.111.111.110

r In ARP table at source, find MAC address E6-E9-00-17-BB-4B, etc

A

RE

ARP operates when a node wants to send a datagram to another node on the same LAN. The situation is more complex when a node on a LAN wants to send a network-layer datagram to a node off the LAN. All of the interfaces connected to LAN 1 have addresses of the form 111.111.111.xxx and all of the interfaces connected to LAN 2 have the form 222.222.222.xxx. Now suppose that host 111.111.111.111 wants to send an IP datagram to host 222.222.222.222. The sending host passes the datagram to its adapter, as usual. However, it is not able to indicate an appropriate destination LAN address.Even if known, the MAC address of the destination cannot be used in this case: none of the adapters on LAN 1 would bother to pass the IP datagram up to its network layer, since the frame's destination address would not match the LAN address of any adapter on LAN 1. And the datagram would die. Indeed, the route of the datagram is decided at network layer. It has to pass through the router R, that will the forward it to the LAN2. Therefore, the MAC address that has to be used is the one of the next step, that is the one of the interface on LAN1 of R. In R the packet is passed up to the network layer, where the next routing step is considered. When in the LAN2 (e.g. at the interface of R on LAN2) R uses ARP to get the destination physical layer address. Finally, R creates the frame containing source-to-destination IP datagram sends to destination.

Page 25: Chapter 7: Internet at Work

25

7: Internet at work 25

Address translation (1)

128.178.1.1

128.178.1.2

128.178.1.3

128.178.1.4128.178.2.9

128.178.2.2

128.178.2.1

128.178.3.2128.178.3.1

128.178.3.27

A

BE

Starting at A, given IP datagram addressed to E:

r look up net. address of E, find E on another net. via router R

r link layer send datagram to R inside link-layer frame

A’s MACaddr

B’s MACaddr

A’s IPaddr

B’s IPaddr IP payload

datagramframe

frame source,dest address

datagram source,dest address

Because there are both network-layer addresses (for example, Internet IP addresses) and link-layer addresses (that is, LAN addresses), there is a need to translate between them. The IP datagram contains the IP addresses of source and destination. Once the datagram is passed to the link-layer, it is necessary to specify the MAC address of the destination, in order to transmit the link-layer frame.

Page 26: Chapter 7: Internet at Work

26

7: Internet at work 26

Routing to another LAN (2)

walkthrough: routing from R to E

r In routing table at router R, find host Er In ARP table at source, find MAC address 49-BD-

D2-C7-5B-2A, etc

A

RE

ARP operates when a node wants to send a datagram to another node on the same LAN. The situation is more complex when a node on a LAN wants to send a network-layer datagram to a node off the LAN. All of the interfaces connected to LAN 1 have addresses of the form 111.111.111.xxx and all of the interfaces connected to LAN 2 have the form 222.222.222.xxx. Now suppose that host 111.111.111.111 wants to send an IP datagram to host 222.222.222.222. The sending host passes the datagram to its adapter, as usual. However, it is not able to indicate an appropriate destination LAN address.Even if known, the MAC address of the destination cannot be used in this case: none of the adapters on LAN 1 would bother to pass the IP datagram up to its network layer, since the frame's destination address would not match the LAN address of any adapter on LAN 1. And the datagram would die. Indeed, the route of the datagram is decided at network layer. It has to pass through the router R, that will the forward it to the LAN2. Therefore, the MAC address that has to be used is the one of the next step, that is the one of the interface on LAN1 of R. In R the packet is passed up to the network layer, where the next routing step is considered. When in the LAN2 (e.g. at the interface of R on LAN2) R uses ARP to get the destination physical layer address. Finally, R creates the frame containing source-to-destination IP datagram sends to destination.

Page 27: Chapter 7: Internet at Work

27

7: Internet at work 27

Address translation (2)

128.178.1.1

128.178.1.2

128.178.1.3

128.178.1.4128.178.2.9

128.178.2.2

128.178.2.1

128.178.3.2128.178.3.1

128.178.3.27

A

BE

Now at R, given IP datagram addressed to E:

r look up net. address of E, find E on same net. as R

r link layer send datagram to E inside link-layer frame

R’s MACaddr

E’s MACaddr

A’s IPaddr

E’s IPaddr IP payload

datagramframe

frame source,dest address

datagram source,dest address

Because there are both network-layer addresses (for example, Internet IP addresses) and link-layer addresses (that is, LAN addresses), there is a need to translate between them. The IP datagram contains the IP addresses of source and destination. Once the datagram is passed to the link-layer, it is necessary to specify the MAC address of the destination, in order to transmit the link-layer frame.

Page 28: Chapter 7: Internet at Work

28

7: Internet at work 28

DataLink Layer requirements:q physical technology that physically

transfer the bit on the physical media

Page 29: Chapter 7: Internet at Work

29

7: Internet at work 29

The way back

rNow data are at link layer at Er Each layer uses its header to act and

passes the content to the layer abover Eventually, the data arrives at application

layer at ErThis is web server that processes the

request and sends back requested datar E’s data go to Ar…

Page 30: Chapter 7: Internet at Work

30

7: Internet at work 30

Chapter 7: Summary

r example of an application with Internet at work to understand:m principles behind communication networksm layer functions and servicesm how layers “interact”

r how data application are transferred from the source to the destination

rQuestions?????

Page 31: Chapter 7: Internet at Work

31

7: Internet at work 31

Consider sending a large file of F=M*L bits over a path of Q links. Suppose that the network is uncongested (that is, no queuing delays), and that the link rate is R bps for each link. When a form of packet switching is used, the M*L bits are broken up into M packets, each packet of L bits. Propagation delay is negligible. How long it takes to send the file from source to destination in the following four cases?1) Suppose the network is packet-switched virtual circuit network. Denote the VC set-up time by ts seconds. Suppose the sending layers add a total of h bits of header for each packet.2) Suppose the network is packet-switched datagram network and a connectionless service is used. Suppose each packet has 2h bits of header. 3) Suppose the network is message-switched network and a connectionless service is used. Suppose the message (that is not segmented) has 2h bits of header. 4) Suppose the network is circuit-switched network and the transmission rate of the circuit between the source and the destination is R bps. Assuming a set-up time of ts seconds, and h bits of header appended to the entire file.

Page 32: Chapter 7: Internet at Work

32

7: Internet at work 32

Solutionr a) The time to transmit one packet onto a link is (L

+ h)/R. The time to deliver the first of the M packets to the destination is Q(L + h)/R. Every (L + h)/R seconds a new packet from the M- 1 remaining packets arrives at the destination. Thus the total latency ists + (Q+M - 1)(L + h)/R:

r b) (Q + M- 1)(L + 2h)/R.r c) The time required to transmit the message over

one link is (LM + 2h)/R. The time required to transmit the message over Q links is Q(LM + 2h)/R.

r d) Because there is no store-and-forward delays at the links, the total delay is ts + (h+ML)/R.