132
Introduction to computer networking 1

Introduction to computer networking 1. Internet Internet: the global communications network 2

Embed Size (px)

Citation preview

Page 1: Introduction to computer networking 1. Internet Internet: the global communications network 2

1

Introduction to computer networking

Page 2: Introduction to computer networking 1. Internet Internet: the global communications network 2

2

Internet

Internet: the global communications network

Page 3: Introduction to computer networking 1. Internet Internet: the global communications network 2

3

Text, audio, image and video: multimedia communications in the Internet

“www.youtube.com” server

Browser

bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits bits

and more bits…

Page 4: Introduction to computer networking 1. Internet Internet: the global communications network 2

4

Coding black and white images

pixel

grey level = luminance

Page 5: Introduction to computer networking 1. Internet Internet: the global communications network 2

5

Coding black and white images

1 bit/pixel21 levels

black = 0white = 1

2 bits/pixel22 levels

black = 00

dark grey = 01

light grey = 10

white = 11

Page 6: Introduction to computer networking 1. Internet Internet: the global communications network 2

6

Coding black and white images

3 bits/pixel23 levels

black = 0000

… = 0001

… = 0010

… = 0011

… = 0100

… = 0101

… = 0110

… = 0111

black = 000very very dark grey

= 001

very dark grey = 010dark grey = 011ligth grey = 100very light grey = 101very very light grey

= 110

white = 111

4 bits/pixel24 levels

… = 1000

… = 1001

… = 1010

… = 1011

… = 1100

… = 1101

… = 1110

white = 1111

Page 7: Introduction to computer networking 1. Internet Internet: the global communications network 2

7

Coding black and white images

luminance (8 bits/pixel = 256 grey levels)

576 lines X 720 columns = 414720 pixels

414720 pixels X 8 bits/pixel

= 3.318 Megabits

pixel

87 89 101

106

118 130 142 155

85 91 101

105

116 129 135 149

86 92 96 105

112 128 131 144

92 88 102

101

116 129 135 147

88 94 94 98 113 122 130 139

88 95 98 97 113 119 133 141

92 99 98 106

107 118 135 145

89 95 98 107

104 112 130 144

Page 8: Introduction to computer networking 1. Internet Internet: the global communications network 2

8

Luminance + (two) Chrominances = 576 X 720 + 2 X 576 X 360 = 829440 pixels

829440 pixels X 8 bits/pixel X 25 images/s =

166 Mbits/s

Colour and motion – video coding

Page 9: Introduction to computer networking 1. Internet Internet: the global communications network 2

9

Compression is needed… and possible!

Voice at 64 Kbits/s Music at 1.4 Mbit/s Video at 166 Mbit/s

Compression explores redundancy and

irrelevance in multimedia information

Page 10: Introduction to computer networking 1. Internet Internet: the global communications network 2

10

Compression is needed … and possible

Page 11: Introduction to computer networking 1. Internet Internet: the global communications network 2

11

Compression systems

Serviço Resolução espacial

Resolução temporal Bits/amostra Débito

binário (PCM)Débito binário

codificadoFactor de

compressão

Full HD1080p

1080 19201080 960

25 imagens/s

progressivas

8 bits/amostra 830 Mbit/s 8-10 Mbit/s 80-100

HD Ready720p

720 1280720 640

25 imagens/s

progressivas

8 bits/amostra 370 Mbit/s 6-8 Mbit/s 60

TV e DVD standard (MP4)

576 720576 360

25 imagens/s

entrelaçadas8

bits/amostra 166 Mbit/s 6 Mbit/s 27.5

Internet streaming (MP4)

288 360 144 180

25 imagens/s

progressivas8

bits/amostra 31 Mbit/s 150 kbit/s 200

Vídeo móveis (MP4)

144 180 72 90

25 imagens/s

progressivas

8 bits/amostra 7.8 Mbit/s 100 kbit/s 80

Música stereo (MP3) - 44000

amostras/s16

bits/amostra 1.4 Mbit/s 100 kbit/s 14

Voz (GSM) - 8000 amostras/s

8 bits/amostra 64 kbit/s 13 kbit/s 5

Page 12: Introduction to computer networking 1. Internet Internet: the global communications network 2

12

01100101

Internet: a packet switching network

1100

0101 Internet

packet

Page 13: Introduction to computer networking 1. Internet Internet: the global communications network 2

13

Internet

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

Packet“Surfing the net”

Page 14: Introduction to computer networking 1. Internet Internet: the global communications network 2

14

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

Routing packets

link

router

Page 15: Introduction to computer networking 1. Internet Internet: the global communications network 2

15

00001010100100101101101001101110 Routing packets

link

router

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

00001010100100101101101001101110

Page 16: Introduction to computer networking 1. Internet Internet: the global communications network 2

16

ISP

ISP

Domestic network

Organizational network

Mobile network

Internet structure: network of networks

Router

Internet

Page 17: Introduction to computer networking 1. Internet Internet: the global communications network 2

17

Internet structure: network of networks

roughly hierarchical at center: “tier-1” ISPs (e.g., Verizon, Sprint, AT&T,

Cable and Wireless), national/international coverage treat each other as equals

Tier 1 ISP

Tier 1 ISP

Tier 1 ISP

Tier-1 providers

interconnect (peer)

privately

Page 18: Introduction to computer networking 1. Internet Internet: the global communications network 2

18

Tier-1 ISP: e.g., Sprint

to/from customers

peering

to/from backbone

….

………

POP: point-of-presence

Page 19: Introduction to computer networking 1. Internet Internet: the global communications network 2

19

Internet structure: network of networks

“Tier-2” ISPs: smaller (often regional) ISPs Connect to one or more tier-1 ISPs, possibly other tier-2

ISPs

Tier 1 ISP

Tier 1 ISP

Tier 1 ISP

Tier-2 ISPTier-2 ISP

Tier-2 ISP Tier-2 ISP

Tier-2 ISP

Tier-2 ISP pays tier-1 ISP for

connectivity to rest of Internet tier-2 ISP is

customer oftier-1 provider

Tier-2 ISPs also peer

privately with each other.

Page 20: Introduction to computer networking 1. Internet Internet: the global communications network 2

20

Internet structure: network of networks

“Tier-3” ISPs and local ISPs last hop (“access”) network (closest to end systems)

Tier 1 ISP

Tier 1 ISP

Tier 1 ISP

Tier-2 ISPTier-2 ISP

Tier-2 ISP Tier-2 ISP

Tier-2 ISP

localISPlocal

ISPlocalISP

localISP

localISP Tier 3

ISP

localISP

localISP

localISP

Local and tier- 3 ISPs

are customers of

higher tier ISPs

connecting them to rest of Internet

Page 21: Introduction to computer networking 1. Internet Internet: the global communications network 2

21

Internet structure: network of networks

a packet passes through many networks!

Tier 1 ISP

Tier 1 ISP

Tier 1 ISP

Tier-2 ISPTier-2 ISP

Tier-2 ISP Tier-2 ISP

Tier-2 ISP

localISPlocal

ISPlocalISP

localISP

localISP Tier 3

ISP

localISP

localISP

localISP

Page 22: Introduction to computer networking 1. Internet Internet: the global communications network 2

22

Internet

128.45.233.8

128.45.233.7

192.26.1.29

192.26.1.30

192.26.5.83192.26.5.84

192.26.12.1128.45.233.6

Internet addressing

193 . 32 . 216 . 911000001 00100000 11011000 00001001

Rosário

Matilde

Teresa

Rui

Pedro

João

IP address

128.45.138.1

153.3.2.211.15.2.33

11.23.35.2

192.26.1.1192.26.5.1

153.3.2.1

153.4.2.2

153.4.2.1

15.54.18.20 20.18.3.1

20.18.3.2

192.26.12.1

15.53.19.21

Run ipconfig

232 = 4.294.967.296 addresses!

Page 23: Introduction to computer networking 1. Internet Internet: the global communications network 2

23

128.45.233.8

128.45.233.7

192.26.1.29

192.26.1.30

192.26.5.83192.26.5.84

192.26.12.1128.45.233.6

Internet names - DNS

128.45.138.1

153.3.2.211.15.2.33

11.23.35.2

192.26.1.1192.26.5.1

153.3.2.1

153.4.2.2

153.4.2.1

15.54.18.20 20.18.3.1

20.18.3.2

192.26.12.1

15.53.19.21

Run nslookup

www.ist.utl.pt

beethoven.ist.utl.pt

stravinsky.ist.utl.pt

ravel.ist.utl.pt

alameda.ist.utl.pt

hawai.com

taguspark.ist.utl.pt

praia.edu

bronze.praia.pt

surf.praia.pt

cromo.praia.pt

Page 24: Introduction to computer networking 1. Internet Internet: the global communications network 2

24

Testing Internet destinations: the ping command

ICMP Echo Request

ICMP Echo Reply

Run ping

Page 25: Introduction to computer networking 1. Internet Internet: the global communications network 2

25

Discovering Internet routes: traceroute

ICMP Echo Request

ICMP Echo Reply

Do a visual traceroute @

www.yougetsignal.com

ICMP Echo Request

ICMP Time Exceeded

ICMP Time Exceeded

ICMP Echo Request

Page 26: Introduction to computer networking 1. Internet Internet: the global communications network 2

26Internet crossing oceans

Page 27: Introduction to computer networking 1. Internet Internet: the global communications network 2

27

Internet crossing oceans

Page 28: Introduction to computer networking 1. Internet Internet: the global communications network 2

28

Internet paintings

www.visual complexity.com

Page 29: Introduction to computer networking 1. Internet Internet: the global communications network 2

29

Internet paintings

www.visual complexity.com

Page 30: Introduction to computer networking 1. Internet Internet: the global communications network 2

30

Internet paintings

Convergence, Jackson Pollock (1912-1956)

Page 31: Introduction to computer networking 1. Internet Internet: the global communications network 2

31

Internet access

Internet

24 Mbits/s

Download of: 2 Mbits/s 24 Mb/sWeb page (250 KB) 1 seg 0.083 seg

Music (5 MB) 20 seg 1.7 seg

Video clip (25 MB) 1 min e 40 seg 8.3 seg

Low quality movie (750 MB) 50 min 4 min e 10 seg

High quality movie (4 GB) 4 horas e 27 min

22 min e 13 seg

Download duration =

8X4X109 bits

24X106 bits/s

Page 32: Introduction to computer networking 1. Internet Internet: the global communications network 2

32

Internet access

Internet

24 Mbits/s

If after half an hour the download has not ended, what went

wrong?

“The Cry”, Edvard Munch (1863-1944)

Page 33: Introduction to computer networking 1. Internet Internet: the global communications network 2

33

Internet access

24 Mbits/s

2 Mbits/s

server’s access network

Internet

If after half an hour the download has not

ended, what went wrong?

Page 34: Introduction to computer networking 1. Internet Internet: the global communications network 2

34

Internet access

24 Mbits/s

24 Mbits/s

server’s access network

1 Mbits/s

Internet

If after half an hour the download has not ended, what went

wrong?

Page 35: Introduction to computer networking 1. Internet Internet: the global communications network 2

35

Internet access: p2p

24 Mbits/s

1 Mb/s1 Mb/s

1 Mb/s

1 Mb/s

Internet

1 Mb/s

24 Mbits/s

1 Mb/s

Internet

Page 36: Introduction to computer networking 1. Internet Internet: the global communications network 2

36

Packet-switching: store-and-forward

takes L/R seconds to transmit (push out) packet of L bits on to link at R bps

store and forward: entire packet must arrive at router before it can be transmitted on next link

delay = 3L/R (assuming zero propagation delay)

Example: L = 7.5 Mbits R = 1.5 Mbps transmission delay =

15 sec

R R RL

more on delay shortly …

Page 37: Introduction to computer networking 1. Internet Internet: the global communications network 2

37

Packet Switching: Message Segmenting

Now break up the message into 5000 packets Each packet 1,500

bits 1 msec to transmit

packet on one link pipelining: each link

works in parallel Delay reduced from

15 sec to 5.002 sec

Page 38: Introduction to computer networking 1. Internet Internet: the global communications network 2

5-38

Communication links

Two types of “links”: point-to-point

PPP for dial-up access point-to-point link between Ethernet switch and host

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 802.11 wireless LAN

shared wire (e.g., cabled Ethernet)

shared RF (e.g., 802.11 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air, acoustical)

Page 39: Introduction to computer networking 1. Internet Internet: the global communications network 2

39

Communication links – antenna transmission systems

Page 40: Introduction to computer networking 1. Internet Internet: the global communications network 2

40

Communication links – optical transmission systems

Page 41: Introduction to computer networking 1. Internet Internet: the global communications network 2

41

Errors in communication links

S/H

DECISION CIRCUIT

AMPLIFIER+

FILTER

V

c(t)

b(t)a(t)

SYNC

RECEIVER

1 0 1 1 0 1 0 0

A

A

A

V

0

1 0 0 1 0 1 1 0

error error

received signal

sampled signal (S/H)

regenerated signal

a(t)

b(t)

c(t)

transmitted signal

Signal degrade due to: Attenuation Distortion Noise Interference

Page 42: Introduction to computer networking 1. Internet Internet: the global communications network 2

42

What’s a protocol?

a human protocol and a computer network protocol:

Q: Other human protocols?

Hi

Hi

Got thetime?

2:00

time

Page 43: Introduction to computer networking 1. Internet Internet: the global communications network 2

What’s a protocol?

human protocols: “what’s the time?” “I have a question” introductions

… specific msgs sent … specific actions

taken when msgs received, or other events

network protocols: machines rather than

humans all communication

activity in Internet governed by protocols

43

protocols define format, order of msgs sent and

received among network entities, and actions taken on msg transmission, receipt

Page 44: Introduction to computer networking 1. Internet Internet: the global communications network 2

TFTP – an example of a network application protocol for file transfer

Internet standard defined in RFC (Request for Comment) by the IETF (Internet Engineering Task Force)

Includes an initial handshake Files are segmented into

messages It is not efficient to transfer a

large file in a single message

TFTP uses the Stop-and-Wait protocol for error control

Messages can be lost, corrupted or received out of order in the network

How is the end of a file transfer signaled?

44

Page 45: Introduction to computer networking 1. Internet Internet: the global communications network 2

45

Stop-and-wait (SW)

Operation without errors

Page 46: Introduction to computer networking 1. Internet Internet: the global communications network 2

46

Stop-and-wait (SW)

Error recovery

Page 47: Introduction to computer networking 1. Internet Internet: the global communications network 2

47

Stop-and-wait (SW)

DATA messages need to be numbered

Page 48: Introduction to computer networking 1. Internet Internet: the global communications network 2

48

Stop-and-wait (SW)

ACK messages need to be numbered

Page 49: Introduction to computer networking 1. Internet Internet: the global communications network 2

49

Stop-and-wait (SW)

Ok!

Page 50: Introduction to computer networking 1. Internet Internet: the global communications network 2

50

TFTP message format

READ REQ (1) FILENAME 0 MODE 0

2 bytes n bytes 1 byte n bytes 1 byte

WRITE REQ (2) FILENAME 0 MODE 0

2 bytes n bytes 1 byte n bytes 1 byte

DATA (3) BLOCK # data

2 bytes 2 bytes up to 512 bytes

ACK (4) BLOCK #

2 bytes 2 bytes

ERROR (5) ERROR CODE ERROR MESSAGE 0

2 bytes 2 bytes n bytes 1 byte

ERROR CODE:00 – Not defined01 – File not found02 – Access violation03 – Disk full04 – Invalid operation code05 – Unknown port number06 – File already exists07 – No such user

Page 51: Introduction to computer networking 1. Internet Internet: the global communications network 2

51

TFTP write

Host @ 192.168.8.227 sends request to write file f1268.txt (with 1268 bytes) in the server @ 192.168.8.226

The server and client applications are configured to use a maximum message size of 1024 bytes

The second DATA message (Block No. = 2) is detected as the last one because it has a size lower than 1024 bytes (1268 - 1024 = 244 bytes)

Page 52: Introduction to computer networking 1. Internet Internet: the global communications network 2

52

App-layer protocol defines

Types of messages exchanged, e.g., request, response

Message syntax: what fields in

messages & how fields are delineated

Message semantics meaning of information

in fields Rules for when and

how processes send & respond to messages

Public-domain protocols:

defined in RFCs allows for

interoperability e.g., HTTP, SMTP Click here for the main T

FTP RFC (RFC 1350)

Proprietary protocols: e.g., Skype

Page 53: Introduction to computer networking 1. Internet Internet: the global communications network 2

Application architectures

Client-server Peer-to-peer (P2P) Hybrid of client-server and P2P

53

Page 54: Introduction to computer networking 1. Internet Internet: the global communications network 2

54

Client-server architectureserver:

always-on host permanent IP address server farms for scaling

clients: communicate with

server may be intermittently

connected may have dynamic IP

addresses do not communicate

directly with each other

client/server

Page 55: Introduction to computer networking 1. Internet Internet: the global communications network 2

55

Pure P2P architecture

no always-on server arbitrary end systems

directly communicate peers are

intermittently connected and change IP addresses

example: Gnutella

Highly scalable but difficult to manage

peer-peer

Page 56: Introduction to computer networking 1. Internet Internet: the global communications network 2

56

Hybrid of client-server and P2PSkype

voice-over-IP P2P application centralized server: finding address of

remote party client-client connection: direct (not through

server) Instant messaging

chatting between two users is P2P centralized service: client presence

detection/location• user registers its IP address with central

server when it comes online• user contacts central server to find IP

addresses of buddies

Page 57: Introduction to computer networking 1. Internet Internet: the global communications network 2

57

Processes communicating

Process: program running within a host.

within same host, two processes communicate using inter-process communication (defined by OS).

processes in different hosts communicate by exchanging messages

Client process: process that initiates communication

Server process: process that waits to be contacted

Note: applications with P2P architectures have client processes & server processes

Page 58: Introduction to computer networking 1. Internet Internet: the global communications network 2

58

Sockets

process sends/receives messages to/from its socket

socket analogous to door sending process shoves

message out door sending process relies on

transport infrastructure on other side of door which brings message to socket at receiving process

process

TCP withbuffers,

variables

socket

host orserver

process

TCP withbuffers,

variables

socket

host orserver

Internet

controlledby OS

controlled byapp developer

API: (1) choice of transport protocol; (2) ability to fix a few parameters

Page 59: Introduction to computer networking 1. Internet Internet: the global communications network 2

59

Addressing processes to receive messages,

process must have identifier

host device has unique 32-bit IP address

Q: does IP address of host on which process runs suffice for identifying the process?

identifier includes both IP address and port numbers associated with process on host.

Example port numbers: HTTP server: 80 Mail server: 25

to send HTTP message to gaia.cs.umass.edu web server: IP address:

128.119.245.12 Port number: 80

more shortly…

A: No, many processes can be running on same host

Page 60: Introduction to computer networking 1. Internet Internet: the global communications network 2

60

What transport service does an app need?Data loss some apps (e.g., audio)

can tolerate some loss other apps (e.g., file

transfer, telnet) require 100% reliable data transfer

Timing some apps (e.g.,

Internet telephony, interactive games) require low delay to be “effective”

Bandwidth some apps (e.g., multimedia) require minimum amount of

bandwidth to be “effective”

other apps (“elastic apps”) make use of whatever bandwidth

they get

Page 61: Introduction to computer networking 1. Internet Internet: the global communications network 2

61

Transport service requirements of common apps

Application

file transfere-mail

Web documentsreal-time audio/video

stored audio/videointeractive gamesinstant messaging

Data loss

no lossno lossno loss

loss-tolerant

loss-tolerantloss-tolerant

no loss

Bandwidth

elasticelasticelastic

audio: 5kbps-1Mbpsvideo:10kbps-5Mbps

same as above few kbps up

elastic

Time Sensitive

nonono

yes, 100’s msec

yes, few secsyes, 100’s msec

yes and no

Page 62: Introduction to computer networking 1. Internet Internet: the global communications network 2

62

Protocol “Layers”Networks are

complex! many “pieces”:

hosts routers links of various

media applications protocols hardware,

software

Question: Is there any hope of organizing structure

of network?

Or at least our discussion of

networks?

Page 63: Introduction to computer networking 1. Internet Internet: the global communications network 2

63

Organization of air travel

a series of steps

ticket (purchase)

baggage (check)

gates (load)

runway takeoff

airplane routing

ticket (complain)

baggage (claim)

gates (unload)

runway landing

airplane routing

airplane routing

Page 64: Introduction to computer networking 1. Internet Internet: the global communications network 2

64

ticket (purchase)

baggage (check)

gates (load)

runway (takeoff)

airplane routing

departureairport

arrivalairport

intermediate air-trafficcontrol centers

airplane routing airplane routing

ticket (complain)

baggage (claim

gates (unload)

runway (land)

airplane routing

ticket

baggage

gate

takeoff/landing

airplane routing

Layering of airline functionality

Layers: each layer implements a service via its own internal-layer actions relying on services provided by layer below

Page 65: Introduction to computer networking 1. Internet Internet: the global communications network 2

65

Why layering?

Dealing with complex systems: explicit structure allows identification,

relationship of complex system’s pieces layered reference model for discussion

modularization eases maintenance, updating of system change of implementation of layer’s service

transparent to rest of system e.g., change in gate procedure doesn’t

affect rest of system layering considered harmful?

Page 66: Introduction to computer networking 1. Internet Internet: the global communications network 2

66

Internet protocol stack application: supporting network

applications FTP, SMTP, HTTP

transport: process-process data transfer TCP, UDP

network: routing of datagrams from source to destination IP, routing protocols

link: data transfer between neighboring network elements PPP, Ethernet

physical: bits “on the wire”

application

transport

network

link

physical

Page 67: Introduction to computer networking 1. Internet Internet: the global communications network 2

67

sourceapplicatio

ntransportnetwork

linkphysical

HtHn M

segment Ht

datagram

destination

application

transportnetwork

linkphysical

HtHnHl M

HtHn M

Ht M

M

networklink

physical

linkphysical

HtHnHl M

HtHn M

HtHn M

HtHnHl M

router

switch

Encapsulationmessage M

Ht M

Hn

frame

Page 68: Introduction to computer networking 1. Internet Internet: the global communications network 2

68

Internet transport protocols services

TCP service: connection-oriented: setup

required between client and server processes

reliable transport between sending and receiving process

flow control: sender won’t overwhelm receiver

congestion control: throttle sender when network overloaded

does not provide: timing, minimum bandwidth guarantees

UDP service: unreliable data transfer

between sending and receiving process

does not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee

Q: why bother? Why is there a UDP?

Page 69: Introduction to computer networking 1. Internet Internet: the global communications network 2

69

Internet apps: application, transport protocols

Application

e-mailremote terminal access

Web file transfer

streaming multimedia

Internet telephony

Applicationlayer protocol

SMTP [RFC 2821]Telnet [RFC 854]HTTP [RFC 2616]

FTP [RFC 959]proprietary

(e.g. RealNetworks)proprietary

(e.g., Vonage,Dialpad)

Underlyingtransport protocol

TCPTCPTCPTCP

TCP or UDP

typically UDP

Page 70: Introduction to computer networking 1. Internet Internet: the global communications network 2

70

Transport services and protocols provide logical

communication between app processes running on different hosts

transport protocols run in end systems send side: breaks app

messages into segments, passes to network layer

rcv side: reassembles segments into messages, passes to app layer

more than one transport protocol available to apps Internet: TCP and UDP

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

logical end-end transport

Page 71: Introduction to computer networking 1. Internet Internet: the global communications network 2

71

Multiplexing/demultiplexing

application

transport

network

link

physical

P1 application

transport

network

link

physical

application

transport

network

link

physical

P2P3 P4P1

host 1 host 2 host 3

= process= socket

delivering received segmentsto correct socket

Demultiplexing at rcv host:gathering data from multiplesockets, enveloping data with header (later used for demultiplexing)

Multiplexing at send host:

Page 72: Introduction to computer networking 1. Internet Internet: the global communications network 2

72

How demultiplexing works host receives IP datagrams

each datagram has source IP address, destination IP address

each datagram carries 1 transport-layer segment

each segment has source, destination port number

host uses IP addresses & port numbers to direct segment to appropriate socket

source port # dest port #

32 bits

applicationdata

(message)

other header fields

TCP/UDP segment format

Page 73: Introduction to computer networking 1. Internet Internet: the global communications network 2

73

Connectionless demultiplexing Create sockets with port

numbers:DatagramSocket mySocket1 = new

DatagramSocket(12534);DatagramSocket mySocket2 = new

DatagramSocket(12535);

UDP socket identified by two-tuple:

(dest IP address, dest port number)

When host receives UDP segment: checks destination port

number in segment directs UDP segment to

socket with that port number

IP datagrams with different source IP addresses and/or source port numbers directed to same socket

Page 74: Introduction to computer networking 1. Internet Internet: the global communications network 2

74

Connectionless demultiplexing

DatagramSocket serverSocket = new DatagramSocket(6428);

clientIP:B

P2

client IP: A

P1P1P3

serverIP: C

SP: 6428

DP: 9157

SP: 9157

DP: 6428

SP: 6428

DP: 5775

SP: 5775

DP: 6428

SP provides “return address”

Page 75: Introduction to computer networking 1. Internet Internet: the global communications network 2

75

TFTP read

Page 76: Introduction to computer networking 1. Internet Internet: the global communications network 2

76

TFTP read

Page 77: Introduction to computer networking 1. Internet Internet: the global communications network 2

77

UDP: User Datagram Protocol [RFC 768]

“no frills,” “bare bones” Internet transport protocol

“best effort” service, UDP segments may be: lost delivered out of order

to app connectionless:

no handshaking between UDP sender, receiver

each UDP segment handled independently of others

Why is there a UDP? no connection

establishment (which can add delay)

simple: no connection state at sender, receiver

small segment header no congestion control:

UDP can blast away as fast as desired

Page 78: Introduction to computer networking 1. Internet Internet: the global communications network 2

78

UDP: more often used for streaming

multimedia apps loss tolerant rate sensitive

other UDP uses DNS SNMP

reliable transfer over UDP: add reliability at application layer application-specific

error recovery!

source port # dest port #

32 bits

Applicationdata

(message)

UDP segment format

length checksumLength, in

bytes of UDPsegment,including

header

Page 79: Introduction to computer networking 1. Internet Internet: the global communications network 2

79

UDP checksum

Sender: treat segment contents

as sequence of 16-bit integers

checksum: addition (1’s complement sum) of segment contents

sender puts checksum value into UDP checksum field

Receiver: compute checksum of

received segment check if computed

checksum equals checksum field value: NO - error detected YES - no error detected.

But maybe errors nonetheless? More later ….

Goal: detect “errors” (e.g., flipped bits) in transmitted segment

Page 80: Introduction to computer networking 1. Internet Internet: the global communications network 2

80

Internet Checksum Example Note

When adding numbers, a carryout from the most significant bit needs to be added to the result

Example: add two 16-bit integers

1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 01 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1

1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 01 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1

wraparound

sumchecksum

Page 81: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-81

Network layer transport segment

from sending to receiving host

on sending side encapsulates segments into datagrams

on rcving side, delivers segments to transport layer

network layer protocols in every host, router

router examines header fields in all IP datagrams passing through it

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

networkdata linkphysical network

data linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysicalnetwork

data linkphysical

Page 82: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-82

Two Key Network-Layer Functions

forwarding: move packets from router’s input to appropriate router output

routing: determine route taken by packets from source to dest.

routing algorithms

analogy:

routing: process of planning trip from

source to dest

forwarding: process of getting through single interchange

Page 83: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-83

IP datagram format

ver length

32 bits

data (variable length,typically a TCP

or UDP segment)

16-bit identifier

header checksum

time tolive

32 bit source IP address

IP protocol versionnumber

header length (bytes)

max numberremaining hops

(decremented at each router)

for

fragmentation/reassembly

total datagramlength (bytes)

upper layer protocolto deliver payload to

head.len

type ofservice

“type” of data flgsfragment

offsetupper layer

32 bit destination IP address

Options (if any) E.g. timestamp,record route

taken, specifylist of routers

to visit.

how much overhead with

TCP? 20 bytes of TCP 20 bytes of IP = 40 bytes +

app layer overhead

Page 84: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-84

IP Addressing: introduction IP address: 32-bit

identifier for host, router interface

interface: connection between host/router and physical link router’s typically

have multiple interfaces

host typically has one interface

IP addresses associated with each interface

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 11

Page 85: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-85

IP addresses – decimal notation

Classe menor endereço maior endereço

A 1.0.0.0 126.0.0.0

B 128.1.0.0 191.255.0.0

C 192.0.1.0 223.255.255.0

D 224.0.0.0 239.255.255.255

E 240.0.0.0 255.255.255.254

10000000 00001010 00000010 00011110

128 . 10 . 2 . 30

Page 86: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-86

IP addresses – class-full addressing

hostid0 netid

hostid1 0 netid

hostid1 1 0 netid

0 7 15 23 31

1 1 1 endereço multicast0

Classe A

Classe B

Classe C

Classe D

Page 87: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-87

IP addresses – address space

Classe # bits no prefixo

# máximo de redes

# bits no sufixo

# máximo de hosts por rede

A 7 128 24 16,777,216

B 14 16,384 16 65,536

C 21 2,097,152 8 256

NOTE: Some of these IP addresses can not be used!

Page 88: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-88

IP addresses - example

Token-ring192.5.48.0

Ethernet 128.10.0.0

10.0.0.0

router

128.10.2.26

Ethernet host

token ring host

multi-homed host

Ethernet host

128.10.2.8

128.10.2.3

192.5.48.7router

192.5.48.6 10.0.0.37

192.5.48.1

192.5.48.3

128.10.2.70

Page 89: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-89

Special IP addresses

tudo 0s host

tudo 0s

tudo 1s

net tudo 1s

qualquer (em geral 1)127

ESTE HOST1

host NESTA REDE 1

BROADCAST LOCAL2

BROADCAST DIRIGIDO PARA net2

LOOPBACK 3

1 Permitido apenas na inicialização; nunca é endereço destino válido

2 Nunca é endereço origem válido

3 Nunca deve aparecer na rede

net tudo 0s ESTA net4

4 Reservado para designar a rede

Page 90: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-90

IP addressing – Mask

Iniatially IP addresses had fixed borders between netid and hostid (classes A, B and C)

Nowadays the border is defined by the network mask

endereço IP

máscara 255.

10. 0.0.1

0.0.0

00001010

11111111

00000000 00000000 00000001

00000000 00000000 00000000

rede hostrede host

decimal binário

Page 91: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-91

Subnets IP address:

subnet part (high order bits)

host part (low order bits)

What’s a subnet ? device interfaces

with same subnet part of IP address

can physically reach each other without intervening router

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

network consisting of 3 subnets

subnet

Page 92: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-92

Subnets 223.1.1.0/24223.1.2.0/24

223.1.3.0/24

Recipe To determine the

subnets, detach each interface from its host or router, creating islands of isolated networks. Each isolated network is called a subnet.

Subnet mask: /24

Page 93: Introduction to computer networking 1. Internet Internet: the global communications network 2

93

Configuration of IP address

DHCP

manual

Page 94: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-94

IP Fragmentation & Reassembly network links have MTU

(max.transfer size) - largest possible link-level frame. different link types,

different MTUs large IP datagram divided

(“fragmented”) within net one datagram becomes

several datagrams “reassembled” only at

final destination IP header bits used to

identify, order related fragments

fragmentation: in: one large datagram

out: 3 smaller datagrams

reassembly

Page 95: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-95

IP Fragmentation and Reassembly

ID=x

offset=0

fragflag=0

length=4000

ID=x

offset=0

fragflag=1

length=1500

ID=x

offset=185

fragflag=1

length=1500

ID=x

offset=370

fragflag=0

length=1040

One large datagram becomesseveral smaller datagrams

Example 4000 byte

datagram MTU = 1500

bytes

1480 bytes in data field

offset =1480/8

Page 96: Introduction to computer networking 1. Internet Internet: the global communications network 2

96

Fragmentation example (I)

Router>enableRouter#conf tRouter(config)#hostname Router1Router1(config)#interface ethernet 1Router1(config-if)#mtu 100Router1(config-if)#exitRouter1(config)#endRouter1#writeBuilding configuration...[OK]

Configuração do MTU do interface 1 do router 1

C:\>ping -l 300 12.0.0.2 Pinging 12.0.0.2 with 300 bytes of data: Reply from 12.0.0.2: bytes=300 time=223ms TTL=116Reply from 12.0.0.2: bytes=300 time=223ms TTL=116Reply from 12.0.0.2: bytes=300 time=223ms TTL=116Reply from 12.0.0.2: bytes=300 time=223ms TTL=116

Router1

10.0.0.0

10.0.0.2Default Gatew ay: 10.0.0.1

11.0.0.0

Router2

12.0.0.0

12.0.0.2Default Gatew ay:12.0.0.1

11.0.0.3

Eth0 Eth0Eth1 Eth1

10.0.0.1 11.0.0.1 11.0.0.2 12.0.0.1

Page 97: Introduction to computer networking 1. Internet Internet: the global communications network 2

97

Fragmentation example (II)

Packets captured in network 11.0.0.0

Router1

10.0.0.0

10.0.0.2Default Gatew ay: 10.0.0.1

11.0.0.0

Router2

12.0.0.0

12.0.0.2Default Gatew ay:12.0.0.1

11.0.0.3

Eth0 Eth0Eth1 Eth1

10.0.0.1 11.0.0.1 11.0.0.2 12.0.0.1

Page 98: Introduction to computer networking 1. Internet Internet: the global communications network 2

98

Fragmentation example (III)

Packet nº 1 captured in network 11.0.0.0

Page 99: Introduction to computer networking 1. Internet Internet: the global communications network 2

99

Fragmentation example (IV)

Packet nº 2 captured in network 11.0.0.0

Page 100: Introduction to computer networking 1. Internet Internet: the global communications network 2

100

Fragmentation example (V)

Packet nº 4 captured in network 11.0.0.0

Page 101: Introduction to computer networking 1. Internet Internet: the global communications network 2

101

From source to 1st router

When a node wants to send an IP datagram to a node that is in another subnet, it must send the datagram to the default gateway Configured by the user (or through DHCP) IP address of one of the routers of the source node’s subnet,

namely the IP address of the router interface attached to the subnet

Router

Router

origem

Router

destino

default gateway

Page 102: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-102

ICMP: Internet Control Message Protocol

used by hosts & routers to communicate network-level information error reporting: unreachable host, network, port, protocol echo request/reply (used by ping)

network-layer “above” IP: ICMP msgs carried in IP datagrams

ICMP message: type, code plus first 8 bytes of IP datagram causing error

Type Code description0 0 echo reply (ping)3 0 dest. network unreachable3 1 dest host unreachable3 2 dest protocol unreachable3 3 dest port unreachable3 6 dest network unknown3 7 dest host unknown4 0 source quench (congestion control - not used)8 0 echo request (ping)9 0 route advertisement10 0 router discovery11 0 TTL expired12 0 bad IP header

Page 103: Introduction to computer networking 1. Internet Internet: the global communications network 2

4-103

ICM P

ICMP – Encapsulation

Fields common to all ICMP messages

type

code

checksum

1

1

2

cabeçalhoIP

dados IP

cabeçalhoMAC

dados MAC

Page 104: Introduction to computer networking 1. Internet Internet: the global communications network 2

104

Ping

The source sends a message of type Echo Request

The destination answers with a message of type Echo Reply

Tests (i) the protocol stack of the source up to ICMP (ii) the same for the receiver (iii) the connectivity between source and destination in both directions

Router

Echo Request

Echo Reply

Echo Request

Echo Reply

type = 0 ou 8

code = 0

checksum

identifier

sequence number

optional data

1

1

2

2

2

Page 105: Introduction to computer networking 1. Internet Internet: the global communications network 2

105

Ping optionsC:\>ping Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [[-j host-list] | [-k host-list]] [-w timeout] destination-list Options: -t Ping the specifed host until stopped. To see statistics and continue - type Control-Break; To stop - type Control-C. -a Resolve addresses to hostnames. -n count Number of echo requests to send. -l size Send buffer size. -f Set Don't Fragment flag in packet. -i TTL Time To Live. -v TOS Type Of Service. -r count Record route for count hops. -s count Timestamp for count hops. -j host-list Loose source route along host-list. -k host-list Strict source route along host-list. -w timeout Timeout in milliseconds to wait for each reply.

Page 106: Introduction to computer networking 1. Internet Internet: the global communications network 2

106

Ping example192.168.8.224

Router

192.168.8.0

192.168.8.1

Ping enviado pela estação:

C:\>ping 192.168.8.1 Pinging 192.168.8.1 with 32 bytes of data: Reply from 192.168.8.1: bytes=32 time<10ms TTL=126Reply from 192.168.8.1: bytes=32 time<10ms TTL=126Reply from 192.168.8.1: bytes=32 time<10ms TTL=126Reply from 192.168.8.1: bytes=32 time<10ms TTL=126

type = 0 ou 8

code = 0

checksum

identifier

sequence number

optional data

1

1

2

2

2

Page 107: Introduction to computer networking 1. Internet Internet: the global communications network 2

107

Traceroute

Discovers the routers in the path from source to destination Uses the TTL field and the ICMP time exceeded message

C:\>tracert Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name Options: -d Do not resolve addresses to hostnames. -h maximum_hops Maximum number of hops to search for target. -j host-list Loose source route along host-list. -w timeout Wait timeout milliseconds for each reply.

Router

Router

Router

TTL = 1

ICM P tim e exceeded

TTL = 2

TTL = 3

TTL = 4

ICM P tim e exceeded

Page 108: Introduction to computer networking 1. Internet Internet: the global communications network 2

108

Traceroute exampleC:\>tracert -d 193.136.173.30

Tracing route to 193.136.173.30 over a maximum of 30 hops

1 <10 ms <10 ms <10 ms 193.136.92.1 2 <10 ms <10 ms <10 ms 193.137.172.254 3 <10 ms <10 ms <10 ms 193.136.173.30

Trace complete.

Page 109: Introduction to computer networking 1. Internet Internet: the global communications network 2

5-109

Link Layer: IntroductionSome terminology: hosts and routers are nodes communication channels

that connect adjacent nodes along communication path are links wired links wireless links LANs

layer-2 packet is a frame, encapsulates datagram

data-link layer has responsibility of transferring datagram from one node

to adjacent node over a link

Page 110: Introduction to computer networking 1. Internet Internet: the global communications network 2

5-110

Where is the link layer implemented?

in each and every host link layer implemented

in “adaptor” (aka network interface card NIC) Ethernet card, PCMCI

card, 802.11 card implements link,

physical layer attaches into host’s

system buses combination of

hardware, software, firmware

controller

physicaltransmission

cpu memory

host bus

(e.g., PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

Page 111: Introduction to computer networking 1. Internet Internet: the global communications network 2

5-111

Adaptors Communicating

sending side: encapsulates datagram

in frame adds error checking

bits, rdt, flow control, etc.

receiving side looks for errors, rdt, flow

control, etc extracts datagram,

passes to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

Page 112: Introduction to computer networking 1. Internet Internet: the global communications network 2

112

Local Area Networks (LANs)

Interconnect nodes that are relatively close through broadcast links

Many technologies Ethernet, Token Ring, 802.11, FDDI, …

LAN

ROUTER

Internet

ServidorWeb

estações

estações

Page 113: Introduction to computer networking 1. Internet Internet: the global communications network 2

113

Ethernet

The MAC protocol is in geral CSMA/CD Supports technologies with different transmission media

and transfer rate 10 Mb/s, 100 Mb/s, 1 Gb/s, 10 Gb/s Coaxial cable , twisted pair, optical fiber 10BASE5, 10BASE2, 10BASET, 100BASET, ...

Segments are interconnected through hubs or receivers

Repetidor

Router

Page 114: Introduction to computer networking 1. Internet Internet: the global communications network 2

5-114

LAN AddressesEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

Page 115: Introduction to computer networking 1. Internet Internet: the global communications network 2

5-115

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(to assure uniqueness) See http://standards.ieee.org/regauth/ for

obtaining addresses analogy: (a) MAC address: like Social Security Number (b) IP address: like postal address MAC flat address ➜ portability

can move LAN card from one LAN to another IP hierarchical address NOT portable

address depends on IP subnet to which node is attached

Page 116: Introduction to computer networking 1. Internet Internet: the global communications network 2

116

Ethernet frame format Dois tipos de tramas: Ethernet II e 802.3 Endereços

Endereços IEEE (6 bytes) Se NIC recebe trama com endereço destino igual ao endereço do NIC

ou com endereço de broadcast (e.g. ARP Request), então envia trama ao módulo de software identificado no campo Protocol; caso contrário, NIC descarta trama

Protocol: indica o tipo de protocolo transportado na trama (IP, ARP, IPX, ...)

Length: comprimemto da trama (campo dados) LLC: vários campos incluindo tipo de protocolo Frame Check Sequence (FCS): usado para detecção de erros

destination source protocol data FCS

6 6 2 46 - 1500 4

destination source length FCS

6 6 2 43 - 1497 4

LLC data

3

Ethernet II

802.3

> 1500

1500

Page 117: Introduction to computer networking 1. Internet Internet: the global communications network 2

117

Encapsulation TFTP – the complete story

message

TFTPheader

TFTPmessage

buildsTFTP

header

message

TFTPheader

UDPheader

UDPdata

UDPsegment

buildsUDP

header calls IP

message

TFTPheader

UDPheader

IPheader

IPdata

IPdatagram

buildsIP

headercalls driver

Ethernet

message

TFTPheader

UDPheader

IPheader

Ethernetheader

Ethernetdata

Ethernetframe

buildsEthernet header

Sends bits to “the wire”

calls UDP

Page 118: Introduction to computer networking 1. Internet Internet: the global communications network 2

5-118

ARP: Address Resolution Protocol

Each IP node (host, router) on LAN has ARP table

ARP table: IP/MAC address mappings for some LAN nodes

< IP address; MAC address; TTL>

TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min)

Question: how to determineMAC address of B

knowing B’s IP address?

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137.196.7.23

137.196.7.78

137.196.7.14

137.196.7.88

Page 119: Introduction to computer networking 1. Internet Internet: the global communications network 2

5-119

ARP protocol: Same LAN (network) A wants to send

datagram to B, and B’s MAC address not in A’s ARP table.

A broadcasts ARP query packet, containing B's IP address dest MAC address =

FF-FF-FF-FF-FF-FF all machines on LAN

receive ARP query B receives ARP packet,

replies to A with its (B's) MAC address frame sent to A’s MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state: information that times out (goes away)

unless refreshed ARP is “plug-and-play”:

nodes create their ARP tables without intervention from net administrator

Page 120: Introduction to computer networking 1. Internet Internet: the global communications network 2

120

ARP protocol

4.1.1.11500- 10- 4B- 4E- 74- 25

4.1.1.100- 60- 97- D4- 9F- A0

4.1.1.11500- 10- 4B- 4E- 74- 25

4.1.1.100- 60- 97- D4- 9F- A0

ARP Request

ARP Response

Page 121: Introduction to computer networking 1. Internet Internet: the global communications network 2

121

ARP Request

ARP Request enviado pela estação 4.1.1.115 para saber o endereço MAC da estação 4.1.1.1.

Page 122: Introduction to computer networking 1. Internet Internet: the global communications network 2

122

ARP Response

Resposta da estação 4.1.1.1 enviada através de ARP Response: o endereço MAC é 00-60-97-d4-9f-a0

Page 123: Introduction to computer networking 1. Internet Internet: the global communications network 2

123

ARP commandARP -a [inet_addr] [-N if_addr]  -a Displays current ARP entries by interrogating the current protocol data. If inet_addr is specified, the IP and Physical addresses for only the specified computer are displayed. If more than one network interface uses ARP, entries for each ARP table are displayed. -g Same as -a. inet_addr Specifies an internet address. -N if_addr Displays the ARP entries for the network interface specified by if_addr. -d Deletes the host specified by inet_addr. -s Adds the host and associates the Internet address inet_addr with the Physical address eth_addr. The Physical address is given as 6 hexadecimal bytes separated by hyphens. The entry is permanent. eth_addr Specifies a physical address. if_addr If present, this specifies the Internet address of the interface whose address translation table should be modified. If not present, the first applicable interface will be used.Example: > arp -s 157.55.85.212 00-aa-00-62-c6-09 .... Adds a static entry. > arp -a .... Displays the arp table.

Page 124: Introduction to computer networking 1. Internet Internet: the global communications network 2

124

ARP example

Estação A192.168.8.224

Estação B192.168.8.220

192.168.8.0

C:\>arp -a Interface: 192.168.8.224 on Interface 0x1000002 Internet Address Physical Address Type 192.168.8.220 00-60-97-d4-9f-a0 dynamic

1º ping

2º ping

3º ping

C:\>arp -d 192.168.8.220C:\>arp -aNo ARP Entries Found

Page 125: Introduction to computer networking 1. Internet Internet: the global communications network 2

5-125

Addressing: routing to another LAN

R

1A-23-F9-CD-06-9B

222.222.222.220111.111.111.110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111.111.111.112

111.111.111.111

A74-29-9C-E8-FF-55

222.222.222.221

88-B2-2F-54-1A-0F

B222.222.222.222

49-BD-D2-C7-56-2A

walkthrough: send datagram from A to B via R assume A knows B’s IP address

two ARP tables in router R, one for each IP network (LAN)

Page 126: Introduction to computer networking 1. Internet Internet: the global communications network 2

5-126

A creates IP datagram with source A, destination B A uses ARP to get R’s MAC address for 111.111.111.110 A creates link-layer frame with R's MAC address as dest,

frame contains A-to-B IP datagram A’s NIC sends frame R’s NIC receives frame R removes IP datagram from Ethernet frame, sees its

destined to B R uses ARP to get B’s MAC address R creates frame containing A-to-B IP datagram sends to

B

R

1A-23-F9-CD-06-9B

222.222.222.220

111.111.111.110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111.111.111.112

111.111.111.111

A74-29-9C-E8-FF-55

222.222.222.221

88-B2-2F-54-1A-0F

B222.222.222.222

49-BD-D2-C7-56-2A

This is a really importantexample – make sure you

understand!

Page 127: Introduction to computer networking 1. Internet Internet: the global communications network 2

127

Routing from A to B

Host A verifies that B is on its subnet, when applying mask 255.255.255.0 to 223.1.2.2

Does ARP to 223.1.2.2, if required

Sends datagram to B, encapsulated in MAC frame

MAC dest addr = MAC of B

223.1.2.6

223.1.2.1 223.1.2.2

223.1.8.1 223.1.8.2

223.1.3.27

223.1.3.1 223.1.3.2

223.1.9.1

223.1.9.2

223.1.1.3

223.1.1.1 223.1.1.2 223.1.1.4

223.1.7.1

223.1.7.5

223.1.7.3

A B

C

223.1.1.0/24

223.1.8.0/24

223.1.3.0/24223.1.2.0/24

223.1.9.0/24223.1.7.0/24

i1i2

i3

i1i2

i3

i1 i2

i3

R1 R2

R3

MAC heade

r

several IP 223.1.2.1 data223.1.2.2

Page 128: Introduction to computer networking 1. Internet Internet: the global communications network 2

128

Routing from A to C

Initially... Host A verifies that C is on

another subnet, when applying mask 255.255.255.0 to 223.1.1.4

Does ARP to the default gateway (223.1.2.6), if required

Sends datagram to R1, encapsulated in MAC frame

MAC dest addr = MAC of 223.1.2.6

223.1.2.6

223.1.2.1 223.1.2.2

223.1.8.1 223.1.8.2

223.1.3.27

223.1.3.1 223.1.3.2

223.1.9.1

223.1.9.2

223.1.1.3

223.1.1.1 223.1.1.2 223.1.1.4

223.1.7.1

223.1.7.5

223.1.7.3

A B

C

223.1.1.0/24

223.1.8.0/24

223.1.3.0/24223.1.2.0/24

223.1.9.0/24223.1.7.0/24

i1i2

i3

i1i2

i3

i1 i2

i3

R1 R2

R3

MAC heade

r

several IP 223.1.2.1 data223.1.1.4

Page 129: Introduction to computer networking 1. Internet Internet: the global communications network 2

129

Routing from A to C

223.1.1.0/24

223.1.2.0/24

Subnet

223.1.8.2

direct

Next hop

i2

i1

Interface

223.1.3.0/24

223.1.7.0/24

223.1.8.2

223.1.8.2

i2

i2

223.1.8.0/24 direct i2

223.1.9.0/24 direct i3

When datagram arrives at R1...

Search routing table Interface = i2 Next hop = 223.1.8.2

Send datagram to R2 via i2, encapsulated in PPP frame

223.1.2.6

223.1.2.1 223.1.2.2

223.1.8.1 223.1.8.2

223.1.3.27

223.1.3.1 223.1.3.2

223.1.9.1

223.1.9.2

223.1.1.3

223.1.1.1 223.1.1.2 223.1.1.4

223.1.7.1

223.1.7.5

223.1.7.3

A B

C

223.1.1.0/24

223.1.8.0/24

223.1.3.0/24223.1.2.0/24

223.1.9.0/24223.1.7.0/24

i1i2

i3

i1i2

i3

i1 i2

i3

R1 R2

R3

Routing table of R1

PPP heade

r

several IP 223.1.2.1 data223.1.1.4

Page 130: Introduction to computer networking 1. Internet Internet: the global communications network 2

130

Routing from A to C

223.1.1.0/24

223.1.2.0/24

Subnet

223.1.7.3

223.1.8.1

Next hop

i3

i2

Interface

223.1.3.0/24

223.1.7.0/24

direct

direct

i1

i3

223.1.8.0/24 direct i2

223.1.9.0/24 223.1.7.3 i3

When datagram arrives at R2... Search routing table

Interface = i3 Next hop = 223.1.7.3

Does ARP to 223.1.7.3, if required

Sends datagram to R3 via i3, encapsulated in MAC frame

MAC dest addr = MAC of 223.1.7.3

223.1.2.6

223.1.2.1 223.1.2.2

223.1.8.1 223.1.8.2

223.1.3.27

223.1.3.1 223.1.3.2

223.1.9.1

223.1.9.2

223.1.1.3

223.1.1.1 223.1.1.2 223.1.1.4

223.1.7.1

223.1.7.5

223.1.7.3

A B

C

223.1.1.0/24

223.1.8.0/24

223.1.3.0/24223.1.2.0/24

223.1.9.0/24223.1.7.0/24

i1i2

i3

i1i2

i3

i1 i2

i3

R1 R2

R3

Routing table of R2

MAC heade

r

severalIP 223.1.2.1 223.1.1.4 data

Page 131: Introduction to computer networking 1. Internet Internet: the global communications network 2

131

Routing from A to C

223.1.1.0/24

223.1.2.0/24

Rede

direct

223.1.9.1

Next hop

i3

i1

Interface

223.1.3.0/24

223.1.7.0/24

223.1.7.1

direct

i2

i2

223.1.8.0/24 223.1.7.1 i2

223.1.9.0/24 direct i1

When datagram arrives at R3... Search routing table

Interface = i3 Next hop = directo

Does ARP to 223.1.1.4, if required

Sends datagram to C via i3, encapsulated in MAC frame

MAC dest addr = MAC of 223.1.1.4

223.1.2.6

223.1.2.1 223.1.2.2

223.1.8.1 223.1.8.2

223.1.3.27

223.1.3.1 223.1.3.2

223.1.9.1

223.1.9.2

223.1.1.3

223.1.1.1 223.1.1.2 223.1.1.4

223.1.7.1

223.1.7.5

223.1.7.3

A B

C

223.1.1.0/24

223.1.8.0/24

223.1.3.0/24223.1.2.0/24

223.1.9.0/24223.1.7.0/24

i1i2

i3

i1i2

i3

i1 i2

i3

R1 R2

R3

Routing table of R3

MAC heade

r

several IP 223.1.2.1 223.1.1.4 data

Page 132: Introduction to computer networking 1. Internet Internet: the global communications network 2

132

Bibliography

James Kurose, Keith Ross, “Computer Networking – A Top-Down Approach”, 4th edition, 2007, Addison Wesley Chapter 1 – “Computer Networks and the Internet” Section 4.1 – “Introduction” Section 4.4 – “The Internet Protocol (IP): Forwarding and

Addressing in the Internet” Section 5.1 – “Link Layer: Introduction and Services” Section 5.4 – “Link-Layer Addressing” Section 5.5 – “Ethernet”