1 Netcomm 2005 Communication Networks Recitation 3.

25
1 Netcomm 2005 Communication Networks Communication Networks Recitation 3 Recitation 3
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    216
  • download

    0

Transcript of 1 Netcomm 2005 Communication Networks Recitation 3.

Page 1: 1 Netcomm 2005 Communication Networks Recitation 3.

1Netcomm 2005

Communication NetworksCommunication Networks

Recitation 3Recitation 3

Page 2: 1 Netcomm 2005 Communication Networks Recitation 3.

2Netcomm 2005

DNS & ARPDNS & ARP

Page 3: 1 Netcomm 2005 Communication Networks Recitation 3.

3Netcomm 2005

• host names: convenient app-to-app communicationhost names: convenient app-to-app communication

• IP: efficient large-scale network communicationIP: efficient large-scale network communication

• MAC: quick-n-easy LAN forwardingMAC: quick-n-easy LAN forwarding

Addressing SchemesAddressing Schemes

medellin.cs.columbia.edu

128.119.40.7128.

119.

40.7

128.

119.

40.7

128.

119.

40.7

128.

119.

40.7

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

Page 4: 1 Netcomm 2005 Communication Networks Recitation 3.

4Netcomm 2005

Routing ExampleRouting Example

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

A

BE

Starting at A, given IP datagram Starting at A, given IP datagram addressed to B:addressed to B:

• look up network address of B, look up network address of B, find B on same network as Afind B on same network as A

• link layer sends datagram to B link layer sends datagram to B inside link-layer frameinside link-layer frame

B’s MACaddr

A’s MACaddr

A’s IPaddr

B’s IPaddr

IP payload

datagramframe

frame source,dest. address

datagram source,dest. address

Page 5: 1 Netcomm 2005 Communication Networks Recitation 3.

5Netcomm 2005

Translating between addressesTranslating between addressesHostname (medellin.cs.columbia.edu)

IP address (128.119.40.7)

MAC address (E6-E9-00-17-BB-4B)

DNS

ARP

Page 6: 1 Netcomm 2005 Communication Networks Recitation 3.

6Netcomm 2005

DNS ServersDNS Servers• Contacted by local name Contacted by local name

server when can not server when can not resolve nameresolve name

• Root name server:Root name server:– contacts authoritative contacts authoritative

name server if name name server if name mapping not knownmapping not known

– gets mappinggets mapping– returns mapping to returns mapping to

local name serverlocal name server

Page 7: 1 Netcomm 2005 Communication Networks Recitation 3.

7Netcomm 2005

DNS HierarchyDNS Hierarchy

edu com org jp

rpi albanyDNS Distributed DatabaseDNS Distributed Database

rpi.eduDNS DB

rpi.eduDNS DB

rpi.eduDNS DB

Page 8: 1 Netcomm 2005 Communication Networks Recitation 3.

8Netcomm 2005

Simple DNS exampleSimple DNS example

host host surf.eurecom.frsurf.eurecom.fr wants wants IP address of IP address of gaia.cs.umass.edugaia.cs.umass.edu

1.1. Contacts its local DNS server, Contacts its local DNS server, dns.eurecom.frdns.eurecom.fr

2.2. dns.eurecom.frdns.eurecom.fr contacts contacts root name server, if necessaryroot name server, if necessary

3.3. root name server contacts root name server contacts authoritative name server, authoritative name server, dns.umass.edu,dns.umass.edu, if if necessarynecessary

requesting hostsurf.eurecom.fr

gaia.cs.umass.edu

root name server

authorititive name serverdns.umass.edu

local name serverdns.eurecom.fr

1

23

4

5

6

Page 9: 1 Netcomm 2005 Communication Networks Recitation 3.

9Netcomm 2005

DNS exampleDNS example

Root name server:Root name server:• may not know may not know

authoritative name authoritative name serverserver

• may know may know intermediate name intermediate name server:server: who to who to contact to find contact to find authoritative name authoritative name serverserver

requesting hostsurf.eurecom.fr

gaia.cs.umass.edu

root name server

local name serverdns.eurecom.fr

1

23

4 5

6

authoritative name serverdns.cs.umass.edu

intermediate name serverdns.umass.edu

7

8

Page 10: 1 Netcomm 2005 Communication Networks Recitation 3.

10Netcomm 2005

DNS: iterated queriesDNS: iterated queriesrecursive query:recursive query:• puts burden of puts burden of

name resolution on name resolution on contacted name contacted name serverserver

• heavy loadheavy load

iterated query:iterated query:• contacted server contacted server

replies with name replies with name of server to contactof server to contact

• ““I don’t know this I don’t know this name, but ask this name, but ask this server”server”

requesting hostsurf.eurecom.fr

gaia.cs.umass.edu

root name server

local name serverdns.eurecom.fr

1

23

4

5 6

authoritative name serverdns.cs.umass.edu

intermediate name serverdns.umass.edu

7

8

iterated query

Page 11: 1 Netcomm 2005 Communication Networks Recitation 3.

11Netcomm 2005

DNS library functionsDNS library functions

struct hostent struct hostent *gethostbyname( const char *gethostbyname( const char *hostname);*hostname);

struct hostent struct hostent *gethostbyaddr( const char *addr*gethostbyaddr( const char *addr

size_t len,size_t len,

int family);int family);

Page 12: 1 Netcomm 2005 Communication Networks Recitation 3.

12Netcomm 2005

LAN Addresses and ARPLAN Addresses and ARP32-bit IP address:32-bit IP address: • network-layernetwork-layer address address• used to get datagram to destination networkused to get datagram to destination network

LAN (or MAC or physical) address: LAN (or MAC or physical) address: • used to get datagram from one interface to used to get datagram from one interface to

another physically-connected interface (same another physically-connected interface (same network)network)

• 48 bit MAC address (for most LANs) 48 bit MAC address (for most LANs) burned into the adapter’s ROMburned into the adapter’s ROM

Page 13: 1 Netcomm 2005 Communication Networks Recitation 3.

13Netcomm 2005

LAN Addresses and ARPLAN Addresses and ARPEach adapter on the LAN has a unique LAN address

Page 14: 1 Netcomm 2005 Communication Networks Recitation 3.

14Netcomm 2005

ARP: Address Resolution ProtocolARP: Address Resolution Protocol

• Each IP node (Host, Router) Each IP node (Host, Router) on LAN has on LAN has ARP ARP module and module and tabletable

• ARP Table: IP/MAC address ARP Table: IP/MAC address mappings for some LAN mappings for some LAN nodesnodes

< IP address; MAC address; < IP address; MAC address; TTL>TTL>

< ………………………….. < ………………………….. >>– TTL (Time To Live): time of TTL (Time To Live): time of

day after which address day after which address mapping will be forgotten mapping will be forgotten (typically 20 minutes)(typically 20 minutes)

Question: how to determineMAC address of Bgiven B’s IP address?

Page 15: 1 Netcomm 2005 Communication Networks Recitation 3.

15Netcomm 2005

ARP protocolARP protocol• A knows B's IP address, wants to learn A knows B's IP address, wants to learn

physical address of B physical address of B • A A broadcastsbroadcasts ARP query packet, containing ARP query packet, containing

B's IP address B's IP address – all machines on LAN receive ARP queryall machines on LAN receive ARP query

• B receives ARP packet, replies to A with its B receives ARP packet, replies to A with its (B's) physical layer address (B's) physical layer address

• A caches (saves) IP-to-physical address pairs A caches (saves) IP-to-physical address pairs until information becomes old (times out) until information becomes old (times out) – soft state: information that times out (goes soft state: information that times out (goes

away) unless refreshedaway) unless refreshed

Arp Arp!

Page 16: 1 Netcomm 2005 Communication Networks Recitation 3.

16Netcomm 2005

ARP ConversationARP Conversation

HEY - Everyone please listen! Will 128.213.1.5 please send me her Ethernet address?

not me

Hi Green! I’m 128.213.1.5, and my Ethernet address is 87:A2:15:35:02:C3

Page 17: 1 Netcomm 2005 Communication Networks Recitation 3.

17Netcomm 2005

Problem 1Problem 1

1.1. Calculate the Calculate the completioncompletion time of time of transferring a file of size 1KB over a link transferring a file of size 1KB over a link with speed 10Mb/s and length 3000km. with speed 10Mb/s and length 3000km. Propagation speed is 200,000Km/sPropagation speed is 200,000Km/s

Page 18: 1 Netcomm 2005 Communication Networks Recitation 3.

18Netcomm 2005

Solution 1Solution 1

The The completioncompletion time is calculated as follows: time is calculated as follows:

T = Prop. Delay + Trans. Time T = Prop. Delay + Trans. Time

We obtain that:We obtain that:• Prop. Delay = 3000 km /(0.2 km/usec) = 15msProp. Delay = 3000 km /(0.2 km/usec) = 15ms• Trans. Time = 1KB/1.25MB/s = 8.2 msTrans. Time = 1KB/1.25MB/s = 8.2 ms

T = 15ms + 8.2 ms = 23.2 msT = 15ms + 8.2 ms = 23.2 ms

Page 19: 1 Netcomm 2005 Communication Networks Recitation 3.

19Netcomm 2005

Problem Problem 2: 2: CRC bitsCRC bits

• Bits represent a polynomial over GF(2)Bits represent a polynomial over GF(2)

• Example: 100101 = xExample: 100101 = x55+x+x22+1+1

• Addition and subtraction are actually Addition and subtraction are actually XORsXORs

• Example: 1101 + 111 = Example: 1101 + 111 = 1010

Page 20: 1 Netcomm 2005 Communication Networks Recitation 3.

20Netcomm 2005

Calculating CRCCalculating CRC

• For data D and Generator G find bits R For data D and Generator G find bits R such that DR = n*G (over GF(2)).such that DR = n*G (over GF(2)).

• Same as D00…0 = n*G + R (over Same as D00…0 = n*G + R (over GF(2))GF(2))

• R will always be 1 bit shorter than G R will always be 1 bit shorter than G

• Use long Division with XORUse long Division with XOR

Page 21: 1 Netcomm 2005 Communication Networks Recitation 3.

21Netcomm 2005

Solution 2Solution 2

• D = 01011000, G=1101, R=D = 01011000, G=1101, R=??????• 0101100001011000000000 | 1101 | 1101

11011101 1100 1100 11011101 100 10000 11011011 10 101010 11110101 1 1110110 11101101 1111

R=011

n=1100111

DR=01011000011

Page 22: 1 Netcomm 2005 Communication Networks Recitation 3.

22Netcomm 2005

Solution 2 – In reverseSolution 2 – In reverse

• DR = 01011000011, G=1101• 01011000011 | 1101

1101 1100 1101 1000 1101 1011 1101 1101 1101 0

Page 23: 1 Netcomm 2005 Communication Networks Recitation 3.

23Netcomm 2005

CRC – Concluding RemarksCRC – Concluding Remarks

• If R has r bits, there are 2If R has r bits, there are 2rr different CRCs different CRCs

• A random string will not be detected as A random string will not be detected as an error in probability 2an error in probability 2-r-r..

• Robustness for common errors depends Robustness for common errors depends on G.on G.

• Some standards try to avoid trailing 0’s.Some standards try to avoid trailing 0’s.

Page 24: 1 Netcomm 2005 Communication Networks Recitation 3.

24Netcomm 2005

Problem 3Problem 3

2. 2. In CSMA/CD network there are two computers A In CSMA/CD network there are two computers A and B which collide in round 1. Give the table of and B which collide in round 1. Give the table of possible outcomes of the second round and their possible outcomes of the second round and their probabilities. Assume that the initial delay period probabilities. Assume that the initial delay period after the collision is D=1 (the hosts pick a after the collision is D=1 (the hosts pick a random number between 0 and D before trying random number between 0 and D before trying to re-transmit). to re-transmit).

Page 25: 1 Netcomm 2005 Communication Networks Recitation 3.

25Netcomm 2005

Solution 3Solution 3 Case A B Probability CommentCase A B Probability Comment

------------------------------------------------------------------------------------------------------------------------------

a 0 0 0.25 Collide in round 2a 0 0 0.25 Collide in round 2

b 0 1 0.25 A successful in round 2b 0 1 0.25 A successful in round 2

B successful in round 3B successful in round 3

c 1 0 0.25 B successful in round 2c 1 0 0.25 B successful in round 2

A successful in round 3A successful in round 3

d 1 1 0.25 Collide in round 3d 1 1 0.25 Collide in round 3