Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Introduction to computer networking 1. Internet Internet: the global communications network 2."— Presentation transcript:

1 Introduction to computer networking 1

2 Internet Internet: the global communications network 2

3 Text, audio, image and video: multimedia communications in the Internet server Browser 3 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…

4 Coding black and white images pixel grey level = luminance 4

5 Coding black and white images 1 bit/pixel 2 1 levels black=0 white=1 2 bits/pixel 2 2 levels black=00 dark grey=01 light grey=10 white=11 5

6 Coding black and white images 3 bits/pixel 2 3 levels black=0000 … =0001 … =0010 … =0011 … =0100 … =0101 … =0110 … =0111 black=000 very very dark grey=001 very dark grey=010 dark grey=011 ligth grey=100 very light grey=101 very very light grey=110 white=111 4 bits/pixel 2 4 levels … =1000 … =1001 … =1010 … =1011 … =1100 … =1101 … =1110 white=1111 6

7 Coding black and white images luminance (8 bits/pixel = 256 grey levels) 576 lines X 720 columns = pixels pixels X 8 bits/pixel = Megabits 576 lines X 720 columns = pixels pixels X 8 bits/pixel = Megabits pixel

8 Luminance + (two) Chrominances = 576 X X 576 X 360 = pixels pixels X 8 bits/pixel X 25 images/s = 166 Mbits/s Luminance + (two) Chrominances = 576 X X 576 X 360 = pixels pixels X 8 bits/pixel X 25 images/s = 166 Mbits/s Colour and motion – video coding 8

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 9

10 Compression is needed … and possible 10

11 Compression systems 11

12 Internet: a packet switching network Internet packet 12

13 Internet Packet Surfing the net 13

14 Routing packets link router 14

15 Routing packets link router

16 ISP Domestic network Organizational network Mobile network Internet structure: network of networks Router 16 Internet

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 providers interconnect (peer) privately 17

18 18 Tier-1 ISP: e.g., Sprint … to/from customers peering to/from backbone ….…. … … … POP: point-of-presence

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-2 ISP Tier-2 ISP pays tier-1 ISP for connectivity to rest of Internet tier-2 ISP is customer of tier-1 provider Tier-2 ISPs also peer privately with each other. 19

20 Internet structure: network of networks Tier-3 ISPs and local ISPs last hop (access) network (closest to end systems) Tier 1 ISP Tier-2 ISP local ISP local ISP local ISP local ISP local ISP Tier 3 ISP local ISP local ISP local ISP Local and tier- 3 ISPs are customers of higher tier ISPs connecting them to rest of Internet 20

21 Internet structure: network of networks a packet passes through many networks! Tier 1 ISP Tier-2 ISP local ISP local ISP local ISP local ISP local ISP Tier 3 ISP local ISP local ISP local ISP 21

22 Internet Internet addressing Rosário Matilde Teresa Rui Pedro João IP address Run ipconfigipconfig Run ipconfigipconfig 2 32 = addresses! 22

23 Internet names - DNS Run nslookupnslookup Run nslookupnslookup 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 23

24 Testing Internet destinations: the ping command ICMP Echo Request ICMP Echo Reply Run pingping Run pingping 24

25 Discovering Internet routes: traceroute ICMP Echo Request ICMP Echo Reply Do a visual Do a visual ICMP Echo Request ICMP Time Exceeded ICMP Echo Request 25

26 Internet crossing oceans 26

27 Internet crossing oceans 27

28 Internet paintings complexity.com 28

29 Internet paintings complexity.com 29

30 Internet paintings Convergence, Jackson Pollock ( ) 30

31 Internet access Internet 24 Mbits/s Download of:2 Mbits/s24 Mb/s Web page (250 KB)1 seg0.083 seg Music (5 MB)20 seg1.7 seg Video clip (25 MB)1 min e 40 seg8.3 seg Low quality movie (750 MB)50 min4 min e 10 seg High quality movie (4 GB)4 horas e 27 min22 min e 13 seg Download duration = 8X4X10 9 bits 24X10 6 bits/s 31

32 Internet access Internet 24 Mbits/s If after half an hour the download has not ended, what went wrong? The Cry, Edvard Munch ( ) 32

33 Internet access 24 Mbits/s 2 Mbits/s servers access network Internet If after half an hour the download has not ended, what went wrong? 33

34 Internet access 24 Mbits/s servers access network 1 Mbits/s Internet If after half an hour the download has not ended, what went wrong? 34

35 Internet access: p2p 24 Mbits/s 1 Mb/s Internet 1 Mb/s 24 Mbits/s 1 Mb/s Internet 35

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 R L more on delay shortly … 36

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 sec 37

38 38 Communication links Two types of links: point-to-point m PPP for dial-up access m point-to-point link between Ethernet switch and host broadcast (shared wire or medium) m old-fashioned Ethernet m upstream HFC m wireless LAN shared wire (e.g., cabled Ethernet) shared RF (e.g., WiFi) shared RF (satellite) humans at a cocktail party (shared air, acoustical)

39 Communication links – antenna transmission systems 39

40 Communication links – optical transmission systems 40

41 Errors in communication links 41 Signal degrade due to: Attenuation Distortion Noise Interference Signal degrade due to: Attenuation Distortion Noise Interference

42 Whats a protocol? r a human protocol and a computer network protocol: 42 Q: Other human protocols? Hi Got the time? 2:00 time

43 Whats a protocol? r human protocols: whats the time? I have a question introductions r … specific msgs sent r … specific actions taken when msgs received, or other events r 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

44 TFTP – an example of a network application protocol for file transfer r Internet standard defined in RFC (Request for Comment) by the IETF (Internet Engineering Task Force) r Includes an initial handshake r Files are segmented into messages It is not efficient to transfer a large file in a single message r TFTP uses the Stop-and- Wait protocol for error control Messages can be lost, corrupted or received out of order in the network r How is the end of a file transfer signaled? 44

45 Stop-and-wait (SW) 45 Operation without errors

46 Stop-and-wait (SW) 46 Error recovery

47 Stop-and-wait (SW) 47 DATA messages need to be numbered

48 Stop-and-wait (SW) 48 ACK messages need to be numbered

49 Stop-and-wait (SW) 49 Ok!

50 TFTP message format 50 ERROR CODE: 00 – Not defined 01 – File not found 02 – Access violation 03 – Disk full 04 – Invalid operation code 05 – Unknown port number 06 – File already exists 07 – No such user

51 TFTP write sends request to write file f1268.txt (with 1268 bytes) in the 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 ( = 244 bytes)

52 52 App-layer protocol defines r Types of messages exchanged, e.g., request, response r Message syntax: what fields in messages & how fields are delineated r Message semantics meaning of information in fields r Rules for when and how processes send & respond to messages Public-domain protocols: r defined in RFCs r allows for interoperability r e.g., HTTP, SMTP r Click here for the main TFTP RFC (RFC 1350) Click here for the main TFTP RFC (RFC 1350) Proprietary protocols: r e.g., Skype

53 Application architectures r Client-server r Peer-to-peer (P2P) r Hybrid of client-server and P2P 53

54 54 Client-server architecture server: 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

55 55 Pure P2P architecture r no always-on server r arbitrary end systems directly communicate r peers are intermittently connected and change IP addresses r example: Gnutella Highly scalable but difficult to manage peer-peer

56 Hybrid of client-server and P2P Skype 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 56

57 57 Processes communicating Process: program running within a host. r within same host, two processes communicate using inter-process communication (defined by OS). r processes in different hosts communicate by exchanging messages Client process: process that initiates communication Server process: process that waits to be contacted rNote: applications with P2P architectures have client processes & server processes

58 58 Sockets r process sends/receives messages to/from its socket r 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 with buffers, variables socket host or server process TCP with buffers, variables socket host or server Internet controlled by OS controlled by app developer rAPI: (1) choice of transport protocol; (2) ability to fix a few parameters

59 59 Addressing processes r to receive messages, process must have identifier r host device has unique 32-bit IP address r Q: does IP address of host on which process runs suffice for identifying the process? r identifier includes both IP address and port numbers associated with process on host. r Example port numbers: HTTP server: 80 Mail server: 25 r to send HTTP message to gaia.cs.umass.edu web server: IP address: Port number: 80 r more shortly… A: No, many processes can be running on same host

60 60 What transport service does an app need? Data loss r some apps (e.g., audio) can tolerate some loss r other apps (e.g., file transfer, telnet) require 100% reliable data transfer Timing r some apps (e.g., Internet telephony, interactive games) require low delay to be effective Bandwidth rsome apps (e.g., multimedia) require minimum amount of bandwidth to be effective rother apps (elastic apps) make use of whatever bandwidth they get

61 61 Transport service requirements of common apps Application file transfer Web documents real-time audio/video stored audio/video interactive games instant messaging Data loss no loss loss-tolerant no loss Bandwidth elastic audio: 5kbps-1Mbps video:10kbps-5Mbps same as above few kbps up elastic Time Sensitive no yes, 100s msec yes, few secs yes, 100s msec yes and no

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? 62

63 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

64 64 ticket (purchase) baggage (check) gates (load) runway (takeoff) airplane routing departure airport arrival airport intermediate air-traffic control centers 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

65 65 Why layering? Dealing with complex systems: explicit structure allows identification, relationship of complex systems pieces layered reference model for discussion modularization eases maintenance, updating of system change of implementation of layers service transparent to rest of system e.g., change in gate procedure doesnt affect rest of system layering considered harmful?

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 66

67 67 source application transport network link physical HtHt HnHn M segment HtHt datagram destination application transport network link physical HtHt HnHn HlHl M HtHt HnHn M HtHt M M network link physical link physical HtHt HnHn HlHl M HtHt HnHn M HtHt HnHn M HtHt HnHn HlHl M router switch Encapsulation message M HtHt M HnHn frame

68 68 Internet transport protocols services TCP service: r connection-oriented: setup required between client and server processes r reliable transport between sending and receiving process r flow control: sender wont overwhelm receiver r congestion control: throttle sender when network overloaded r does not provide: timing, minimum bandwidth guarantees UDP service: r unreliable data transfer between sending and receiving process r does not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee Q: why bother? Why is there a UDP?

69 69 Internet apps: application, transport protocols Application remote terminal access Web file transfer streaming multimedia Internet telephony Application layer protocol SMTP [RFC 2821] Telnet [RFC 854] HTTP [RFC 2616] FTP [RFC 959] proprietary (e.g. RealNetworks) proprietary (e.g., Vonage,Dialpad) Underlying transport protocol TCP TCP or UDP typically UDP

70 70 Transport services and protocols r provide logical communication between app processes running on different hosts r transport protocols run in end systems m send side: breaks app messages into segments, passes to network layer m rcv side: reassembles segments into messages, passes to app layer r more than one transport protocol available to apps m Internet: TCP and UDP application transport network data link physical application transport network data link physical logical end-end transport

71 71 Multiplexing/demultiplexing application transport network link physical P1 application transport network link physical application transport network link physical P2 P3 P4 P1 host 1 host 2 host 3 = process= socket delivering received segments to correct socket Demultiplexing at rcv host: gathering data from multiple sockets, enveloping data with header (later used for demultiplexing) Multiplexing at send host:

72 72 How demultiplexing works r host receives IP datagrams m each datagram has source IP address, destination IP address m each datagram carries 1 transport-layer segment m each segment has source, destination port number r host uses IP addresses & port numbers to direct segment to appropriate socket source port #dest port # 32 bits application data (message) other header fields TCP/UDP segment format

73 73 Connectionless demultiplexing r Create sockets with port numbers: DatagramSocket mySocket1 = new DatagramSocket(12534); DatagramSocket mySocket2 = new DatagramSocket(12535); r UDP socket identified by two-tuple: ( dest IP address, dest port number) r When host receives UDP segment: m checks destination port number in segment m directs UDP segment to socket with that port number r IP datagrams with different source IP addresses and/or source port numbers directed to same socket

74 74 Connectionless demultiplexing DatagramSocket serverSocket = new DatagramSocket(6428); client IP:B P2 client IP: A P1 P3 server IP: C SP: 6428 DP: 9157 SP: 9157 DP: 6428 SP: 6428 DP: 5775 SP: 5775 DP: 6428 SP provides return address

75 TFTP read 75

76 TFTP read 76

77 77 UDP: User Datagram Protocol [RFC 768] r no frills, bare bones Internet transport protocol r best effort service, UDP segments may be: m lost m delivered out of order to app r connectionless: m no handshaking between UDP sender, receiver m each UDP segment handled independently of others Why is there a UDP? r no connection establishment (which can add delay) r simple: no connection state at sender, receiver r small segment header r no congestion control: UDP can blast away as fast as desired

78 78 UDP: more r often used for streaming multimedia apps m loss tolerant m rate sensitive r other UDP uses m DNS m SNMP r reliable transfer over UDP: add reliability at application layer m application-specific error recovery! source port #dest port # 32 bits Application data (message) UDP segment format length checksum Length, in bytes of UDP segment, including header

79 79 UDP checksum Sender: r treat segment contents as sequence of 16-bit integers r checksum: addition (1s complement sum) of segment contents r sender puts checksum value into UDP checksum field Receiver: r compute checksum of received segment r check if computed checksum equals checksum field value: m NO - error detected m YES - no error detected. But maybe errors nonetheless? More later …. Goal: detect errors (e.g., flipped bits) in transmitted segment

80 80 Internet Checksum Example r Note m When adding numbers, a carryout from the most significant bit needs to be added to the result r Example: add two 16-bit integers wraparound sum checksum

81 Network layer r transport segment from sending to receiving host r on sending side encapsulates segments into datagrams r on rcving side, delivers segments to transport layer r network layer protocols in every host, router r router examines header fields in all IP datagrams passing through it application transport network data link physical application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical 81

82 Two Key Network-Layer Functions r forwarding: move packets from routers input to appropriate router output r routing: determine route taken by packets from source to dest. m routing algorithms analogy: r routing: process of planning trip from source to dest r forwarding: process of getting through single interchange 82

83 IP datagram format ver length 32 bits data (variable length, typically a TCP or UDP segment) 16-bit identifier header checksum time to live 32 bit source IP address IP protocol version number header length (bytes) max number remaining hops (decremented at each router) for fragmentation / reassembly total datagram length (bytes) upper layer protocol to deliver payload to head. len type of service type of data flgs fragment offset upper layer 32 bit destination IP address Options (if any) E.g. timestamp, record route taken, specify list of routers to visit. how much overhead with TCP? r 20 bytes of TCP r 20 bytes of IP r = 40 bytes + app layer overhead 83

84 IP Addressing: introduction r IP address: 32-bit identifier for host, router interface r interface: connection between host/router and physical link m routers typically have multiple interfaces m host typically has one interface m IP addresses associated with each interface =

85 85 IP addresses – decimal notation Classemenor endereçomaior endereço A B C D E

86 86 IP addresses – class-full addressing

87 87 IP addresses – address space Classe# bits no prefixo # máximo de redes # bits no sufixo # máximo de hosts por rede A ,777,216 B1416, ,536 C212,097, NOTE: Some of these IP addresses can not be used!

88 88 IP addresses - example

89 Special IP addresses 89

90 90 IP addressing – Mask r Iniatially IP addresses had fixed borders between netid and hostid (classes A, B and C) r Nowadays the border is defined by the network mask

91 Subnets r IP address: m subnet part (high order bits) m host part (low order bits) r Whats a subnet ? m device interfaces with same subnet part of IP address m can physically reach each other without intervening router network consisting of 3 subnets subnet 91

92 Subnets / / /24 Recipe r 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 92

93 93 Configuration of IP address DHCP manual

94 IP Fragmentation & Reassembly r network links have MTU (max.transfer size) - largest possible link-level frame. m different link types, different MTUs r large IP datagram divided (fragmented) within net m one datagram becomes several datagrams m reassembled only at final destination m IP header bits used to identify, order related fragments fragmentation: in: one large datagram out: 3 smaller datagrams reassembly 94

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 becomes several smaller datagrams Example r 4000 byte datagram r MTU = 1500 bytes 1480 bytes in data field offset = 1480/8 95

96 96 Fragmentation example (I) Router>enable Router#conf t Router(config)#hostname Router1 Router1(config)#interface ethernet 1 Router1(config-if)#mtu 100 Router1(config-if)#exit Router1(config)#end Router1#write Building configuration... [OK] Configuração do MTU do interface 1 do router 1 C:\>ping -l Pinging with 300 bytes of data: Reply from : bytes=300 time=223ms TTL=116

97 97 Fragmentation example (II) Packets captured in network

98 98 Fragmentation example (III) Packet nº 1 captured in network

99 99 Fragmentation example (IV) Packet nº 2 captured in network

100 100 Fragmentation example (V) Packet nº 4 captured in network

101 From source to 1st router default gateway r 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 nodes subnet, namely the IP address of the router interface attached to the subnet 101

102 ICMP: Internet Control Message Protocol r used by hosts & routers to communicate network-level information m error reporting: unreachable host, network, port, protocol m echo request/reply (used by ping) r network-layer above IP: m ICMP msgs carried in IP datagrams r ICMP message: type, code plus first 8 bytes of IP datagram causing error Type Code description 0 0 echo reply (ping) 3 0 dest. network unreachable 3 1 dest host unreachable 3 2 dest protocol unreachable 3 3 dest port unreachable 3 6 dest network unknown 3 7 dest host unknown 4 0 source quench (congestion control - not used) 8 0 echo request (ping) 9 0 route advertisement 10 0 router discovery 11 0 TTL expired 12 0 bad IP header 102

103 103 ICMP – Encapsulation Fields common to all ICMP messages

104 Ping r The source sends a message of type Echo Request r The destination answers with a message of type Echo Reply r 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 104

105 105 Ping options C:\>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.

106 106 Ping example Ping enviado pela estação: C:\>ping Pinging with 32 bytes of data: Reply from : bytes=32 time<10ms TTL=126

107 Traceroute r Discovers the routers in the path from source to destination r 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. 107

108 108 Traceroute example C:\>tracert -d Tracing route to over a maximum of 30 hops 1 <10 ms <10 ms <10 ms <10 ms <10 ms <10 ms <10 ms <10 ms <10 ms Trace complete.

109 Link Layer: Introduction Some terminology: r hosts and routers are nodes r communication channels that connect adjacent nodes along communication path are links m wired links m wireless links m LANs r 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 109

110 Where is the link layer implemented? r in each and every host r link layer implemented in adaptor (aka network interface card NIC) m Ethernet card, PCMCI card, card m implements link, physical layer r attaches into hosts system buses r combination of hardware, software, firmware controller physical transmission cpu memory host bus (e.g., PCI) network adapter card host schematic application transport network link physical 110

111 Adaptors Communicating r sending side: m encapsulates datagram in frame m adds error checking bits, rdt, flow control, etc. r receiving side m looks for errors, rdt, flow control, etc m extracts datagram, passes to upper layer at receiving side controller sending host receiving host datagram frame 111

112 Local Area Networks (LANs) r Interconnect nodes that are relatively close through broadcast links r Many technologies Ethernet, Token Ring, , FDDI, … 112

113 Ethernet r The MAC protocol is in geral CSMA/CD r 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,... r Segments are interconnected through hubs or receivers 113

114 LAN Addresses Each adapter on LAN has unique LAN address Broadcast address = FF-FF-FF-FF-FF-FF = adapter 1A-2F-BB AD D7-FA-20-B0 0C-C4-11-6F-E F7-2B LAN (wired or wireless) 114

115 LAN Address (more) r MAC address allocation administered by IEEE r manufacturer buys portion of MAC address space (to assure uniqueness) r See for obtaining addresseshttp://standards.ieee.org/regauth/ r analogy: (a) MAC address: like Social Security Number (b) IP address: like postal address MAC flat address portability m can move LAN card from one LAN to another r IP hierarchical address NOT portable m address depends on IP subnet to which node is attached 115

116 Ethernet frame format r Dois tipos de tramas: Ethernet II e r 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 r Protocol: indica o tipo de protocolo transportado na trama (IP, ARP, IPX,...) r Length: comprimemto da trama (campo dados) r LLC: vários campos incluindo tipo de protocolo r Frame Check Sequence (FCS): usado para detecção de erros 116

117 Encapsulation TFTP – the complete story 117

118 ARP: Address Resolution Protocol r Each IP node (host, router) on LAN has ARP table r ARP table: IP/MAC address mappings for some LAN nodes m TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min) Question: how to determine MAC address of B knowing Bs IP address? 1A-2F-BB AD D7-FA-20-B0 0C-C4-11-6F-E F7-2B LAN

119 ARP protocol: Same LAN (network) r A wants to send datagram to B, and Bs MAC address not in As ARP table. r A broadcasts ARP query packet, containing B's IP address m dest MAC address = FF- FF-FF-FF-FF-FF m all machines on LAN receive ARP query r B receives ARP packet, replies to A with its (B's) MAC address m frame sent to As MAC address (unicast) r A caches (saves) IP-to- MAC address pair in its ARP table until information becomes old (times out) m soft state: information that times out (goes away) unless refreshed r ARP is plug-and-play: m nodes create their ARP tables without intervention from net administrator 119

120 120 ARP protocol ARP Request ARP Response

121 121 ARP Request ARP Request enviado pela estação para saber o endereço MAC da estação

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

123 123 ARP command ARP -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 aa c Adds a static entry. > arp -a.... Displays the arp table.

124 124 ARP example C:\>arp -a Interface: on Interface 0x Internet Address Physical Address Type d4-9f-a0 dynamic 1º ping 2º ping 3º ping C:\>arp -d C:\>arp -a No ARP Entries Found

125 Addressing: routing to another LAN R 1A-23-F9-CD-06-9B E6-E BB-4B CC-49-DE-D0-AB-7D A C-E8-FF B2-2F-54-1A-0F B BD-D2-C7-56-2A walkthrough: send datagram from A to B via R assume A knows Bs IP address r two ARP tables in router R, one for each IP network (LAN) 125

126 r A creates IP datagram with source A, destination B r A uses ARP to get Rs MAC address for r A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram r As NIC sends frame r Rs NIC receives frame r R removes IP datagram from Ethernet frame, sees its destined to B r R uses ARP to get Bs MAC address r R creates frame containing A-to-B IP datagram sends to B R 1A-23-F9-CD-06-9B E6-E BB-4B CC-49-DE-D0-AB-7D A C-E8-FF B2-2F-54-1A-0F B BD-D2-C7-56-2A This is a really important example – make sure you understand! 126

127 127 Routing from A to B r Host A verifies that B is on its subnet, when applying mask to r Does ARP to , if required r Sends datagram to B, encapsulated in MAC frame MAC dest addr = MAC of B MAC header several IP data

128 128 Routing from A to C Initially... r Host A verifies that C is on another subnet, when applying mask to r Does ARP to the default gateway ( ), if required r Sends datagram to R1, encapsulated in MAC frame MAC dest addr = MAC of MAC header several IP data

129 129 Routing from A to C When datagram arrives at R1... r Search routing table Interface = i2 Next hop = r Send datagram to R2 via i2, encapsulated in PPP frame Routing table of R1 PPP header several IP data

130 130 Routing from A to C When datagram arrives at R2... r Search routing table Interface = i3 Next hop = r Does ARP to , if required r Sends datagram to R3 via i3, encapsulated in MAC frame MAC dest addr = MAC of Routing table of R2 MAC header several IP data

131 131 Routing from A to C When datagram arrives at R3... r Search routing table Interface = i3 Next hop = directo r Does ARP to , if required r Sends datagram to C via i3, encapsulated in MAC frame MAC dest addr = MAC of Routing table of R3 MAC header several IP data

132 Bibliography r 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 132


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

Similar presentations


Ads by Google