DOC PREVIEW
CMU CS 15213 - Lecture

This preview shows page 1-2-3-25-26-27-28-50-51-52 out of 52 pages.

Save
View full document
Premium Document
Do you want full access? Go Premium and unlock all 52 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Carnegie Mellon Introduction to Computer Systems 15 213 fall 2009 21st Lecture Nov 9th Instructors Majd Sakr and Khaled Harras Carnegie Mellon Today Programmer s view of the internet Sockets interface Carnegie Mellon A Programmer s View of the Internet Hosts are mapped to a set of 32 bit IP addresses 128 2 203 179 The set of IP addresses is mapped to a set of identifiers called Internet domain names 128 2 203 179 is mapped to www cs cmu edu A process on one Internet host can communicate with a process on another Internet host over a connection Carnegie Mellon IP Addresses 32 bit IP addresses are stored in an IP address struct IP addresses are always stored in memory in network byte order big endian byte order True in general for any integer transferred in a packet header from one machine to another E g the port number used to identify an Internet connection Internet address structure struct in addr unsigned int s addr network byte order big endian Useful network byte order conversion functions htonl convert long int from host to network byte order htons convert short int from host to network byte order ntohl convert long int from network to host byte order ntohs convert short int from network to host byte order Carnegie Mellon Dotted Decimal Notation By convention each byte in a 32 bit IP address is represented by a string decimal values for bytes separated by a period Blackboard IP address 0x8002C2F2 128 2 194 242 Carnegie Mellon Dotted Decimal Notation By convention each byte in a 32 bit IP address is represented by a string decimal values for bytes separated by a period IP address 0x8002C2F2 128 2 194 242 Functions for converting between binary IP addresses and dotted decimal strings inet aton dotted decimal string IP address in network byte order inet ntoa IP address in network byte order dotted decimal string n denotes network representation a denotes application representation Carnegie Mellon IP Address Structure IP V4 Address space divided into classes Class A 0123 8 0 Net ID 16 24 Class B 10 Class C 110 Class D 1110 Multicast address Class E 1111 Reserved for experiments 31 Host ID Net ID Host ID Net ID Host ID Network ID written in form w x y z n n number of bits in net id yellow part above E g CMU written as 128 2 0 0 16 Which class is that Unrouted private IP addresses 10 0 0 0 8 172 16 0 0 12 192 168 0 0 16 Nowadays CIDR Classless interdomain routing Carnegie Mellon Internet Domain Names unnamed root net edu mit cmu cs gov berkeley ece First level domain names com amazon www 208 216 181 15 cmcl pdl kittyhawk imperial 128 2 194 242 128 2 189 40 Second level domain names Third level domain names Carnegie Mellon Domain Naming System DNS The Internet maintains a mapping between IP addresses and domain names in a huge worldwide distributed DNS database Conceptually programmers can view the DNS database as a collection of millions of host entry structures DNS host entry structure struct hostent char h name char h aliases int h addrtype int h length char h addr list official domain name of host null terminated array of domain names host address type AF INET length of an address in bytes null terminated array of in addr structs Functions for retrieving host entries from DNS gethostbyname query key is a DNS domain name gethostbyaddr query key is an IP address Carnegie Mellon Properties of DNS Host Entries Each host entry is an equivalence class of domain names and IP addresses Each host has a locally defined domain name localhost which always maps to the loopback address 127 0 0 1 Different kinds of mappings are possible Simple case one to one mapping between domain name and IP address kittyhawk cmcl cs cmu edu maps to 128 2 194 242 Multiple domain names mapped to the same IP address eecs mit edu and cs mit edu both map to 18 62 1 6 Multiple domain names mapped to multiple IP addresses aol com and www aol com map to multiple IP addresses Some valid domain names don t map to any IP address for example cmcl cs cmu edu Carnegie Mellon A Program That Queries DNS int main int argc char argv argv 1 is a domain name char pp or dotted decimal IP addr struct in addr addr struct hostent hostp if inet aton argv 1 addr 0 hostp Gethostbyaddr const char addr sizeof addr AF INET else hostp Gethostbyname argv 1 printf official hostname s n hostp h name for pp hostp h aliases pp NULL pp printf alias s n pp for pp hostp h addr list pp NULL pp addr s addr struct in addr pp s addr printf address s n inet ntoa addr Carnegie Mellon Querying DNS from the Command Line Domain Information Groper dig provides a scriptable command line interface to DNS linux dig short kittyhawk cmcl cs cmu edu 128 2 194 242 linux dig short x 128 2 194 242 KITTYHAWK CMCL CS CMU EDU linux dig short aol com 205 188 145 215 205 188 160 121 64 12 149 24 64 12 187 25 linux dig short x 64 12 187 25 aol v5 websys aol com Carnegie Mellon Internet Connections Clients and servers communicate by sending streams of bytes over connections Point to point full duplex 2 way communication and reliable A socket is an endpoint of a connection Socket address is an IPaddress port pair A port is a 16 bit integer that identifies a process Ephemeral port Assigned automatically on client when client makes a connection request Well known port Associated with some service provided by a server e g port 80 is associated with Web servers A connection is uniquely identified by the socket addresses of its endpoints socket pair cliaddr cliport servaddr servport Carnegie Mellon Putting it all Together Anatomy of an Internet Connection Client socket address 128 2 194 242 51213 Client Server socket address 208 216 181 15 80 Connection socket pair 128 2 194 242 51213 208 216 181 15 80 Client host address 128 2 194 242 51213 is an ephemeral port allocated by the kernel Server port 80 Server host address 208 216 181 15 80 is a well known port associated with Web servers Carnegie Mellon Clients Examples of client programs Web browsers ftp telnet ssh How does a client find the server The IP address in the server socket address identifies the host more precisely an adapter on the host The well known port in the server socket address identifies the service and thus implicitly identifies the server process that performs that service Examples of well know ports Port 7 Echo server Port 23 Telnet server Port 25 Mail server Port 80 Web server Carnegie Mellon Using Ports to Identify Services Server host 128 2 194 242 Client host Client Service request for 128 2 194


View Full Document

CMU CS 15213 - Lecture

Documents in this Course
lecture

lecture

14 pages

lecture

lecture

46 pages

Caches

Caches

9 pages

lecture

lecture

39 pages

Lecture

Lecture

36 pages

Lecture

Lecture

45 pages

Lecture

Lecture

56 pages

lecture

lecture

11 pages

lecture

lecture

9 pages

Lecture

Lecture

36 pages

Lecture

Lecture

37 pages

Exam

Exam

16 pages

Lecture

Lecture

10 pages

Lecture

Lecture

43 pages

Lecture

Lecture

8 pages

Lecture

Lecture

8 pages

Lecture

Lecture

36 pages

Lecture

Lecture

43 pages

Lecture

Lecture

12 pages

Lecture

Lecture

37 pages

Lecture

Lecture

6 pages

Lecture

Lecture

40 pages

coding

coding

2 pages

Exam

Exam

17 pages

Exam

Exam

14 pages

Lecture

Lecture

29 pages

Lecture

Lecture

34 pages

Exam

Exam

11 pages

Lecture

Lecture

9 pages

Lecture

Lecture

37 pages

Lecture

Lecture

36 pages

lecture

lecture

46 pages

Lecture

Lecture

33 pages

Lecture

Lecture

57 pages

Lecture

Lecture

32 pages

Lecture

Lecture

46 pages

Lecture

Lecture

40 pages

Lecture

Lecture

11 pages

Lecture

Lecture

6 pages

Lecture

Lecture

43 pages

Lecture

Lecture

12 pages

Lecture

Lecture

18 pages

Exam

Exam

10 pages

Lecture

Lecture

45 pages

Lecture

Lecture

37 pages

Exam

Exam

24 pages

class09

class09

21 pages

class22

class22

37 pages

class20

class20

30 pages

class27

class27

33 pages

class25

class25

21 pages

class04

class04

31 pages

Lecture

Lecture

59 pages

class01a

class01a

14 pages

class12

class12

45 pages

class29

class29

33 pages

Lecture

Lecture

39 pages

Lecture

Lecture

6 pages

class03

class03

34 pages

lecture

lecture

42 pages

Lecture

Lecture

40 pages

Lecture

Lecture

47 pages

Exam

Exam

19 pages

R06-B

R06-B

25 pages

class17

class17

37 pages

class25

class25

31 pages

Lecture

Lecture

15 pages

final-f06

final-f06

17 pages

Lecture

Lecture

9 pages

lecture

lecture

9 pages

Exam

Exam

15 pages

Lecture

Lecture

22 pages

class11

class11

45 pages

lecture

lecture

50 pages

Linking

Linking

37 pages

Lecture

Lecture

64 pages

Integers

Integers

40 pages

Exam

Exam

11 pages

Lecture

Lecture

37 pages

Lecture

Lecture

44 pages

Lecture

Lecture

37 pages

Lecture

Lecture

9 pages

Lecture

Lecture

37 pages

Lecture

Lecture

45 pages

Final

Final

25 pages

lecture

lecture

9 pages

Lecture

Lecture

30 pages

Lecture

Lecture

16 pages

Final

Final

17 pages

Lecture

Lecture

8 pages

Exam

Exam

11 pages

Lecture

Lecture

47 pages

Lecture

Lecture

9 pages

lecture

lecture

39 pages

Exam

Exam

11 pages

lecture

lecture

41 pages

lecture

lecture

37 pages

Lecture

Lecture

59 pages

Lecture

Lecture

45 pages

Exam 1

Exam 1

18 pages

Lecture

Lecture

41 pages

Lecture

Lecture

32 pages

Lecture

Lecture

30 pages

Lecture

Lecture

9 pages

Lecture

Lecture

9 pages

Lecture

Lecture

15 pages

Lecture

Lecture

11 pages

Lecture

Lecture

9 pages

Lecture

Lecture

34 pages

Lecture

Lecture

40 pages

Lecture

Lecture

4 pages

Lecture

Lecture

46 pages

Lecture

Lecture

8 pages

Lecture

Lecture

65 pages

Lecture

Lecture

38 pages

Lecture

Lecture

35 pages

Lecture

Lecture

8 pages

Lecture

Lecture

34 pages

Lecture

Lecture

8 pages

Exam

Exam

13 pages

Lecture

Lecture

43 pages

Lecture

Lecture

9 pages

Lecture

Lecture

12 pages

Lecture

Lecture

9 pages

Lecture

Lecture

34 pages

Lecture

Lecture

43 pages

Lecture

Lecture

7 pages

Lecture

Lecture

45 pages

Lecture

Lecture

24 pages

Lecture

Lecture

47 pages

Lecture

Lecture

12 pages

Lecture

Lecture

20 pages

Lecture

Lecture

9 pages

Exam

Exam

11 pages

Lecture

Lecture

52 pages

Lecture

Lecture

20 pages

Exam

Exam

11 pages

Lecture

Lecture

35 pages

Lecture

Lecture

47 pages

Lecture

Lecture

18 pages

Lecture

Lecture

30 pages

Lecture

Lecture

59 pages

Lecture

Lecture

37 pages

Lecture

Lecture

22 pages

Lecture

Lecture

35 pages

Exam

Exam

23 pages

Lecture

Lecture

9 pages

Lecture

Lecture

22 pages

class12

class12

32 pages

Lecture

Lecture

8 pages

Lecture

Lecture

39 pages

Lecture

Lecture

44 pages

Lecture

Lecture

38 pages

Lecture

Lecture

69 pages

Lecture

Lecture

41 pages

Lecture

Lecture

12 pages

Lecture

Lecture

59 pages

Lecture

Lecture

39 pages

Lecture

Lecture

83 pages

Lecture

Lecture

59 pages

class01b

class01b

17 pages

Exam

Exam

21 pages

class07

class07

47 pages

Lecture

Lecture

11 pages

Odyssey

Odyssey

18 pages

multicore

multicore

66 pages

Lecture

Lecture

6 pages

lecture

lecture

41 pages

lecture

lecture

55 pages

lecture

lecture

52 pages

lecture

lecture

33 pages

lecture

lecture

46 pages

lecture

lecture

55 pages

lecture

lecture

17 pages

lecture

lecture

49 pages

Exam

Exam

17 pages

lecture

lecture

56 pages

Exam 2

Exam 2

16 pages

Exam 2

Exam 2

16 pages

Notes

Notes

37 pages

Lecture

Lecture

40 pages

Lecture

Lecture

36 pages

Lecture

Lecture

43 pages

Lecture

Lecture

25 pages

Exam

Exam

13 pages

Lecture

Lecture

32 pages

Lecture

Lecture

12 pages

Lecture

Lecture

58 pages

Lecture

Lecture

29 pages

Lecture

Lecture

59 pages

Lecture

Lecture

41 pages

Lecture

Lecture

50 pages

Exam

Exam

17 pages

Lecture

Lecture

29 pages

Lecture

Lecture

44 pages

Lecture

Lecture

41 pages

Lecture

Lecture

52 pages

Lecture

Lecture

40 pages

Lecture

Lecture

33 pages

lecture

lecture

10 pages

Lecture

Lecture

27 pages

Lecture

Lecture

29 pages

Lecture

Lecture

39 pages

Lecture

Lecture

9 pages

Lecture

Lecture

29 pages

Lecture

Lecture

8 pages

Lecture

Lecture

43 pages

Lecture

Lecture

43 pages

Lecture

Lecture

75 pages

Lecture

Lecture

55 pages

Exam

Exam

12 pages

Lecture

Lecture

43 pages

Lecture

Lecture

35 pages

lecture

lecture

36 pages

Exam

Exam

33 pages

lecture

lecture

56 pages

lecture

lecture

64 pages

lecture

lecture

8 pages

Exam

Exam

14 pages

Lecture

Lecture

43 pages

Lecture

Lecture

36 pages

lecture

lecture

56 pages

lecture

lecture

75 pages

lecture

lecture

36 pages

Lecture

Lecture

50 pages

Lecture

Lecture

45 pages

Lecture

Lecture

13 pages

Exam

Exam

23 pages

Lecture

Lecture

10 pages

Lecture

Lecture

48 pages

Lecture

Lecture

83 pages

lecture

lecture

57 pages

Lecture

Lecture

33 pages

Lecture

Lecture

39 pages

Lecture

Lecture

33 pages

lecture

lecture

54 pages

Lecture

Lecture

30 pages

Exam

Exam

13 pages

Lecture

Lecture

36 pages

Lecture

Lecture

40 pages

Exam

Exam

17 pages

Lecture

Lecture

9 pages

Exam

Exam

15 pages

Lecture

Lecture

44 pages

Lecture

Lecture

34 pages

Lecture

Lecture

24 pages

Lecture

Lecture

29 pages

class12

class12

43 pages

lecture

lecture

43 pages

class22

class22

22 pages

R06-B

R06-B

25 pages

class01b

class01b

19 pages

lecture

lecture

29 pages

lab1

lab1

8 pages

Caches

Caches

36 pages

lecture

lecture

55 pages

Lecture,

Lecture,

37 pages

Integers

Integers

40 pages

Linking

Linking

38 pages

lecture

lecture

45 pages

Lecture

Lecture

61 pages

Linking

Linking

33 pages

lecture

lecture

40 pages

lecture

lecture

40 pages

Lecture

Lecture

32 pages

lecture

lecture

48 pages

lecture

lecture

44 pages

Exam

Exam

11 pages

Lecture

Lecture

31 pages

Lecture

Lecture

46 pages

Lecture

Lecture

40 pages

Lecture

Lecture

40 pages

Exam

Exam

12 pages

Lecture

Lecture

42 pages

Lecture

Lecture

36 pages

Lecture

Lecture

45 pages

Lecture

Lecture

41 pages

Lecture

Lecture

13 pages

Lecture

Lecture

35 pages

Lecture

Lecture

20 pages

Final

Final

19 pages

Lecture

Lecture

33 pages

Lecture

Lecture

50 pages

Lecture

Lecture

33 pages

Lecture

Lecture

27 pages

Lecture

Lecture

6 pages

Exam

Exam

15 pages

Lecture

Lecture

24 pages

Lecture

Lecture

23 pages

Lecture

Lecture

43 pages

Lecture

Lecture

32 pages

Lecture

Lecture

52 pages

Lecture

Lecture

37 pages

Lecture

Lecture

36 pages

Lecture

Lecture

34 pages

Lecture

Lecture

40 pages

Lecture

Lecture

15 pages

lecture

lecture

21 pages

Lecture

Lecture

58 pages

Lecture

Lecture

49 pages

Lecture

Lecture

36 pages

Lecture

Lecture

11 pages

Lecture

Lecture

12 pages

Lecture

Lecture

58 pages

Lecture

Lecture

33 pages

Exam

Exam

15 pages

Lecture

Lecture

35 pages

Lecture

Lecture

10 pages

Lecture

Lecture

25 pages

Lecture

Lecture

31 pages

Lecture

Lecture

24 pages

Lecture

Lecture

34 pages

Lecture

Lecture

50 pages

lecture

lecture

35 pages

Lecture

Lecture

11 pages

Lecture

Lecture

39 pages

Lecture

Lecture

45 pages

Lecture

Lecture

41 pages

exam1-f05

exam1-f05

11 pages

Lecture

Lecture

4 pages

Lecture

Lecture

17 pages

Exam

Exam

17 pages

malloc()

malloc()

12 pages

Lecture

Lecture

57 pages

Lecture

Lecture

30 pages

Lecture

Lecture

30 pages

Lecture

Lecture

47 pages

Lecture

Lecture

33 pages

Exam

Exam

12 pages

Lecture

Lecture

43 pages

Lectures

Lectures

33 pages

Lecture

Lecture

36 pages

lecture

lecture

33 pages

Exam

Exam

14 pages

Lecture

Lecture

43 pages

Lecture

Lecture

25 pages

Load more
Download Lecture
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?