Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 3: Hardware and physical links Chap 1.4, 2 of [PD]

Similar presentations


Presentation on theme: "Lecture 3: Hardware and physical links Chap 1.4, 2 of [PD]"— Presentation transcript:

1 Lecture 3: Hardware and physical links Chap 1.4, 2 of [PD]
Based partly on lecture notes by Xiaowei Yang, Rodrigo Fonseca, David Mazières, Phil Levis, John Jannotti

2 Overview Sockets Programming Revisited Network Architectures
Examples of Networking Principles Hardware and physical layer Nuts and bolts of networking Nodes Links Bandwidth, latency, throughput, delay-bandwidth product Physical links

3 IPs V. Ports : Server V. App.
Plus: 43 Server has .. Gmail: 23 The Internet Google Client has .. Bing: 43 Server has .. Xbox: 23 microsoft

4 The University of Adelaide, School of Computer Science
21 April 2017 Socket What is a socket? The point where a local application process attaches to the network An interface between an application and the network An application creates the socket The interface defines operations for Creating a socket Attaching a socket to the network Sending and receiving messages through the socket Closing the socket Chapter 2 — Instructions: Language of the Computer

5 The University of Adelaide, School of Computer Science
21 April 2017 Creating a Socket int sockfd = socket(address_family, type, protocol); The socket number returned is the socket descriptor for the newly created socket int sockfd = socket (PF_INET, SOCK_STREAM, 0); int sockfd = socket (PF_INET, SOCK_DGRAM, 0); The combination of PF_INET and SOCK_STREAM implies TCP Chapter 2 — Instructions: Language of the Computer

6 The University of Adelaide, School of Computer Science
21 April 2017 Socket Socket Family PF_INET denotes the Internet family PF_UNIX denotes the Unix pipe facility PF_PACKET denotes direct access to the network interface (i.e., it bypasses the TCP/IP protocol stack) Socket Type SOCK_STREAM is used to denote a byte stream SOCK_DGRAM is an alternative that denotes a message oriented service, such as that provided by UDP Chapter 2 — Instructions: Language of the Computer

7 Client-Server Model with TCP
The University of Adelaide, School of Computer Science 21 April 2017 Client-Server Model with TCP Server Passive open Prepares to accept connection, does not actually establish a connection Server invokes int bind (int socket, struct sockaddr *address, int addr_len) int listen (int socket, int backlog) int accept (int socket, struct sockaddr *address, int *addr_len) Chapter 2 — Instructions: Language of the Computer

8 Client-Server Model with TCP
The University of Adelaide, School of Computer Science 21 April 2017 Client-Server Model with TCP Bind Binds the newly created socket to the specified address i.e. the network address of the local participant (the server) Address is a data structure which combines IP and port Listen Defines how many connections can be pending on the specified socket Chapter 2 — Instructions: Language of the Computer

9 Client-Server Model with TCP
The University of Adelaide, School of Computer Science 21 April 2017 Client-Server Model with TCP Accept Carries out the passive open Blocking operation Does not return until a remote participant has established a connection When it does, it returns a new socket that corresponds to the new established connection and the address argument contains the remote participant’s address Chapter 2 — Instructions: Language of the Computer

10 Client-Server Model with TCP
The University of Adelaide, School of Computer Science 21 April 2017 Client-Server Model with TCP Client Application performs active open It says who it wants to communicate with Client invokes int connect (int socket, struct sockaddr *address, int addr_len) Connect Does not return until TCP has successfully established a connection at which application is free to begin sending data Address contains remote machine’s address Chapter 2 — Instructions: Language of the Computer

11 Client-Serve Model with TCP
The University of Adelaide, School of Computer Science 21 April 2017 Client-Serve Model with TCP In practice The client usually specifies only remote participant’s address and let’s the system fill in the local information Whereas a server usually listens for messages on a well-known port A client does not care which port it uses for itself, the OS simply selects an unused one Chapter 2 — Instructions: Language of the Computer

12 Client-Server Model with TCP
The University of Adelaide, School of Computer Science 21 April 2017 Client-Server Model with TCP Once a connection is established, the application process invokes two operation int send (int socket, char *msg, int msg_len, int flags) int recv (int socket, char *buff, int buff_len, Chapter 2 — Instructions: Language of the Computer

13 Overview Sockets Programming Revisited Network Architectures
Examples of Networking Principles Hardware and physical layer Nuts and bolts of networking Nodes Links Bandwidth, latency, throughput, delay-bandwidth product Physical links

14 Network architectures
Layering is an abstraction that captures important aspects of the system, provides service interfaces, and hides implementation details

15 Protocols Layer N Layer N-1 Layer N+1 Layer N+1 Layer N Layer N-1 The abstract objects that make up the layers of a network system are called protocols Each protocol defines two different interfaces Service interface Peer interface

16 Network architectures
A protocol graph represents protocols that make up a system Nodes are protocols Links are depend-on relations Set of rules governing the form and content of a protocol graph are called a network architecture Standard bodies such as IETF govern procedures for introducing, validating, and approving protocols

17 The protocol graph of Internet
Applicatoin layer Transport layer Network layer Link layer No strict layering. One can do cross-layer design Hourglass shaped: IP defines a common method for exchanging packets among different networks To propose a new protocol, one must produce both a spec and one/two implementations

18 Functions of the Layers
Data Link Layer: Service: Reliable transfer of frames over a link Media Access Control on a LAN Functions: Framing, media access control, error checking Network Layer: Service: Move packets from source host to destination host Functions: Routing, addressing Transport Layer: Service: Delivery of data between hosts Functions: Connection establishment/termination, error control, flow control, congestion control Application Layer: Service: Application specific (delivery of , retrieval of HTML documents, reliable transfer of file) Functions: Application specific

19 The Open Systems Interconnection (OSI) architecture
Seven-layer

20 Physical layer: handles raw bits
International Telecommunications Union (ITU) publishes protocol specs based on the OSI reference model X dot series Physical layer: handles raw bits Data link layer: aggregate bits to frames. Network adaptors implement it Network layer: handles host-to-host packet delivery. Data units are called packets Transport: implements process channel. Data units are called messages Session layer: handles multiple transport streams belong to the same applications Presentation layer: data format, e.g., integer format, ASCII string or not Application layer: application specific protocols

21 Encapsulation Upper layer sends a message using the service interface
A header, a small data structure, to add information for peer-to-peer communication, is attached to the front message Sometimes a trailer is added to the end Message is called payload or data This process is called encapsulation

22

23 Multiplexing & Demultiplexing
Same ideas apply up and down the protocol graph

24 Overview Sockets Programming Revisited Network Architectures
Examples of Networking Principles Hardware and physical layer Nuts and bolts of networking Nodes Links Bandwidth, latency, throughput, delay-bandwidth product Physical links

25 An Example

26 A simple TCP/IP Example
argon.tcpip-lab.edu ("Argon") neon.tcpip-lab.edu ("Neon") Web request Web page Web client Web server A user on host argon.tcpip-lab.edu (“Argon”) makes web access to URL tcpip-lab.edu/index.html. What actually happens in the network?

27 HTTP Request and HTTP response
Web server runs an HTTP server program HTTP client Web browser runs an HTTP client program sends an HTTP request to HTTP server HTTP server responds with HTTP response

28 HTTP Request GET /example.html HTTP/1.1 Accept: image/gif, */*
Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 Host: Connection: Keep-Alive

29 HTTP Response How does the HTTP request get from Argon to Neon?
HTTP/ OK Date: Sat, 25 May :10:32 GMT Server: Apache/ (Unix) Last-Modified: Sat, 25 May :51:33 GMT ETag: " ceff955" Accept-Ranges: bytes Content-Length: 81 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html <HTML> <BODY> <H1>Internet Lab</H1> Click <a href=" for the Internet Lab webpage. </BODY> </HTML> How does the HTTP request get from Argon to Neon?

30 From HTTP to TCP To send request, HTTP client program establishes an TCP connection to the HTTP server Neon. The HTTP server at Neon has a TCP server running

31 Resolving hostnames and port numbers
Since TCP does not work with hostnames and also would not know how to find the HTTP server program at Neon, two things must happen: 1. The name “neon.tcpip-lab.edu” must be translated into a 32-bit IP address. 2. The HTTP server at Neon must be identified by a 16-bit port number.

32 Translating a hostname into an IP address
The translation of the hostname neon.tcpip-lab.edu into an IP address is done via a database lookup gethostbyname(host) The distributed database used is called the Domain Name System (DNS) All machines on the Internet have an IP address: argon.tcpip-lab.edu neon.tcpip-lab.edu

33 Finding the port number
Note: Most services on the Internet are reachable via well-known ports. E.g. All HTTP servers on the Internet can be reached at port number “80”. So: Argon simply knows the port number of the HTTP server at a remote machine. On most Unix systems, the well-known ports are listed in a file with name /etc/services. The well-known port numbers of some of the most popular services are: ftp 21 finger 79 telnet 23 http 80 smtp 25 nntp 119

34 Requesting a TCP Connection
connect(s, (struct sockaddr*)&sin, sizeof(sin)) The HTTP client at argon.tcpip-lab.edu requests the TCP client to establish a connection to port 80 of the machine with address

35 Invoking the IP Protocol
ip_output() The TCP client at Argon sends a request to establish a connection to port 80 at Neon This is done by asking its local IP module to send an IP datagram to (The data portion of the IP datagram contains the request to open a connection)

36 Sending the IP datagram to the default router
Argon sends the IP datagram to its default router The default gateway is an IP router The default gateway for Argon is Router137.tcpip-lab.edu ( ).

37 Invoking the device driver
ether_output The IP module at Argon, tells its Ethernet device driver to send an Ethernet frame to address 00:e0:f9:23:a8:20 Ethernet address of the default router is found out via ARP

38 The route from Argon to Neon
Note that the router has a different name for each of its interfaces.

39 Sending an Ethernet frame
The Ethernet device driver of Argon sends the Ethernet frame to the Ethernet network interface card (NIC) The NIC sends the frame onto the wire

40 Forwarding the IP datagram
The IP router receives the Ethernet frame at interface recovers the IP datagram determines that the IP datagram should be forwarded to the interface with name The IP router determines that it can deliver the IP datagram directly

41 Invoking the Device Driver at the Router
The IP protocol at Router71, tells its Ethernet device driver to send an Ethernet frame to address 00:20:af:03:98:28

42 Sending another Ethernet frame
The Ethernet device driver of Router71 sends the Ethernet frame to the Ethernet NIC, which transmits the frame onto the wire.

43 Data has arrived at Neon
Neon receives the Ethernet frame The payload of the Ethernet frame is an IP datagram which is passed to the IP protocol. The payload of the IP datagram is a TCP segment, which is passed to the TCP server

44 Overview Sockets Programming Revisited Network Architectures
Examples of Networking Principles Hardware and physical layer Nuts and bolts of networking Nodes Links Bandwidth, latency, throughput, delay-bandwidth product Physical links

45 Layers, Services, Protocols
Application Transport Network Link Physical Service: move bits to other node across link

46 Physical Layer (Layer 1)
Responsible for specifying the physical medium Type of cable, fiber, wireless frequency Responsible for specifying the signal (modulation) Transmitter varies something (amplitude, frequency, phase) Receiver samples, recovers signal Responsible for specifying the bits (encoding) Bits above physical layer -> chips

47 Modulation Specifies mapping between digital signal and some variation in analog signal Why not just a square wave (1v=1; 0v=0)? Not square when bandwidth limited Bandwidth – frequencies that a channel propagates well Signals consist of many frequency components Attenuation and delay frequency-dependent

48 Components of a Square Wave
Graphs from Dr. David Alciatore, Colorado State University

49 Approximation of a Square Wave
Graphs from Dr. David Alciatore, Colorado State University

50 ASK: Amplitude Shift Keying
Idea: Use Carriers Only use frequencies that transmit well Modulate the signal to encode bits OOK: On-Off Keying ASK: Amplitude Shift Keying

51 FSK: Frequency Shift Keying PSK: Phase Shift Keying
Idea: Use Carriers Only use frequencies that transmit well Modulate the signal to encode bits FSK: Frequency Shift Keying PSK: Phase Shift Keying

52 How Fast Can You Send? Encode information in some varying characteristic of the signal. If B is the maximum frequency of the signal C = 2B bits/s (Nyquist, 1928) Intuition: 2B comes from Nyquist’s

53 Can we do better? So we can only change 2B/second, what if we encode more bits per sample? Baud is the frequency of changes to the physical channel Not the same thing as bits! Suppose channel passes 1KHz to 2KHz 1 bit per sample: alternate between 1KHz and 2KHz 2 bits per sample: send one of 1, 1.33, 1.66, or 2KHz Or send at different amplitudes: A/4, A/2, 3A/4, A n bits: choose among 2n frequencies! What is the capacity if you can distinguish M levels?

54 Example Amplitude Phase Used for some forms of digital TV

55 Hartley’s Law C = 2B log2(M) bits/s Great. By increasing M, we can have as large a capacity as we want! Or can we?

56 The channel is noisy!

57 The channel is noisy! Noise prevents you from increasing M arbitrarily! This depends on the signal/noise ratio (S/N) Shannon: C = B log2(1 + S/N) C is the channel capacity in bits/second B is the bandwidth of the channel in Hz S and N are average signal and noise power Signal-to-noise ratio is measured in dB = 10log10(S/N)

58 Putting it all together
Noise limits M! 2B log2(M) ≤ B log2(1 + S/N) M ≤ √1+S/N Example: Telephone Line 3KHz b/w, 30dB S/N = 10ˆ(30/10) = 1000 C = 3KHz log2(1001) ≈ 30Kbps From Hartley and Shannon, we have ….

59 Encoding Now assume that we can somehow modulate a signal: receiver can decode our binary stream How do we encode binary data onto signals? One approach: 1 as high, 0 as low! Called Non-return to Zero (NRZ) 1 NRZ (non-return to zero) Clock Low is not necessarily 0V, (or rest), could be -1, for example; hence the name. Assume we can change the value once per clock cycle.

60 Drawbacks of NRZ No signal could be interpreted as 0 (or vice-versa)
Consecutive 1s or 0s are problematic Baseline wander problem How do you set the threshold? Could compare to average, but average may drift Clock recovery problem For long runs of no change, could miscount periods

61 Alternative Encodings
Non-return to Zero Inverted (NRZI) Encode 1 with transition from current signal Encode 0 by staying at the same level At least solve problem of consecutive 1s 1 Clock NRZI (non-return to zero intverted)

62 Manchester Map 0  chips 01 Maps 1  chips 10
Transmission rate now 1 bit per two clock cycles Solves clock recovery, baseline wander But cuts transmission rate in half 1 Clock Manchester 50% efficiency Maps transition from

63 4B/5B Can we have a more efficient encoding?
Every 4 bits encoded as 5 chips Need 16 5-bit codes: selected to have no more than one leading 0 and no more than two trailing 0s Never get more than 3 consecutive 0s Transmit chips using NRZI Other codes used for other purposes E.g., 11111: line idle; 00100: halt Achieves 80% efficiency

64 4B/5B Table

65 Encoding Goals DC Balancing (same number of 0 and 1 chips)
Clock synchronization Can recover some chip errors Constrain analog signal patterns to make signal more robust Want near channel capacity with negligible errors Shannon says it’s possible, doesn’t tell us how Codes can get computationally expensive In practice More complex encoding: fewer bps, more robust Less complex encoding: more bps, less robust

66 Last Example: 802.15.4 Standard for low-power, low-rate wireless PANs
Must tolerate high chip error rates Uses a 4B/32B bit-to-chip encoding

67 Questions so far? Photo: Lewis Hine

68 Layers, Services, Protocols
Service: user-facing application. Application-defined messages Application Service: multiplexing applications Reliable byte stream to other node (TCP), Unreliable datagram (UDP) Transport Service: move packets to any other node in the network IP: Unreliable, best-effort service model Network Service: move frames to other node across link. May add reliability, medium access control Link Physical Service: move bits to other node across link

69 Framing Given a stream of bits, how can we represent boundaries?
Break sequence of bits into a frame Typically done by network adaptor

70 Representing Boundaries
Approaches Characteristics Sentinels Length counts Clock-based Bit- or byte oriented Fixed or variable length Data-dependent or independent

71 Sentinel-based Framing
Byte-oriented protocols (e.g. BISYNC, PPP) Place special bytes (SOH, ETX,…) in the beginning, end of messages What if ETX appears in the body? Escape ETX byte by prefixing DEL byte Escape DEL byte by prefixing DEL byte Technique known as character stuffing

72 Bit-Oriented Protocols
View message as a stream of bits, not bytes Can use sentinel approach as well (e.g., HDLC) HDLC begin/end sequence Use bit stuffing to escape Always append 0 after five consecutive 1s in data After five 1s, receiver uses next two bits to decide if stuffed, end of frame, or error. USB uses bit stuffing for a different reason: it uses NRZI with 0:transition, 1:stay => 1’s are a problem. USB stuffs a 0 after every six consecutive 1’s Go through 4 cases.

73 Representing Boundaries
Approaches Characteristics Sentinels Length counts Clock-based Bit- or byte oriented Fixed or variable length Data-dependent or independent

74 Length-based Framing Drawback of sentinel techniques
Length of frame depends on data Alternative: put length in header (e.g., DDCMP) Danger: Framing Errors What if high bit of counter gets corrupted? Adds 8K to length of frame, may lose many frames CRC checksum helps detect error DDCMP -> DECNet point-to-point, original VAX, PDP-11 Variable length.

75 Representing Boundaries
Approaches Characteristics Sentinels Length counts Clock-based Bit- or byte oriented Fixed or variable length Data-dependent or independent

76 Clock-based Framing E.g., SONET (Synchronous Optical Network)
Each frame is 125μs long Look for header every 125μs Encode with NRZ, but first XOR payload with 127-bit string to ensure lots of transitions Fixed length Must have clock synch and frame synch

77 Representing Boundaries
Approaches Characteristics Sentinels Length counts Clock-based Bit- or byte oriented Fixed or variable length Data-dependent or independent

78 Error Detection Basic idea: use a checksum Good checksum algorithms
Compute small checksum value, like a hash of packet Good checksum algorithms Want several properties, e.g., detect any single-bit error Details in a later lecture

79 Summary Network architectures Application Programming Interface
Hardware and physical layer Nuts and bolts of networking Nodes Links Bandwidth, latency, throughput, delay-bandwidth product Physical links


Download ppt "Lecture 3: Hardware and physical links Chap 1.4, 2 of [PD]"

Similar presentations


Ads by Google