cse 331 introduction to networks and security n.
Skip this Video
Loading SlideShow in 5 Seconds..
CSE 331: Introduction to Networks and Security PowerPoint Presentation
Download Presentation
CSE 331: Introduction to Networks and Security

Loading in 2 Seconds...

play fullscreen
1 / 38

CSE 331: Introduction to Networks and Security - PowerPoint PPT Presentation

Download Presentation
CSE 331: Introduction to Networks and Security
An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. CSE 331: Introduction to Networks and Security Slide Set 5 Fall 2000 Instructor: Carl A. Gunter

  2. Application and Network

  3. IPv4 Packet Format • IPv4 (Version field set to “4”) Version Hlen TOS Length Ident Flags Offset TTL Protocol Checksum SourceAddr DestinationAddr Options(variable length) Pad DATA

  4. TCP and UDP packets • Protocols support O.S. “port numbers”: UDP TCP SrcPort DstPort SrcPort DstPort Checksum Length SequenceNum DATA Acknowledgment HL 0 Flags Advert.Wind. Checksum UrgPtr Options (variable) DATA

  5. UDP packet format • IP enhancement for Demux and checksum 0 15 31 SrcPort DstPort Checksum Length DATA

  6. UDP End-to-End Model • Multiplexing/Demultiplexing with Port number Application Application Application Application UDP Sender (Multiplexer) UDP Receiver (Demultiplexer)

  7. Port Numbers • O.S. Independent way to specify sender and receiver applications • Limited to 16 bits, so <65536 (64K) • Question: per-host or per-IP address? • Usually UNIX does per-host • “Well-known” ports for certain services • Ports used for rendezvous

  8. UDP also provides... • A simple checksum covering UDP header, data (message body), and pseudo-header (length, source IP, destination IP), using IP algorithm • Optional in IPv4, mandatory in IPv6 • No: flow control, reliability, ordering, etc. • Very little service enhancement over IP

  9. TCP • Need reliable, ordered delivery of data • No duplicates • Data units called segments • Transmission Control Protocol • Connection-oriented (thus full-duplex) • Also provides flow and congestion control

  10. TCP End-to-End Model • Buffering corrects errors but may introduce delays Application Application Application Application TCP Sender: Send Buffers TCP Receiver Receive Buffers segment segment segment segment

  11. TCP Provides • Ordering using sequence numbers • Each byte has a sequence number • Risk of overflow increases • Reliability using: • acknowledgements • checksums • sequence numbers

  12. Frame ACK Automatic Repeat Request Sender Receiver Timeout Time Timeout

  13. Frame ACK ARQ Continued Sender Receiver Frame Timeout Time Timeout

  14. Frame Frame ACK ARQ Continued Sender Receiver Timeout ACK Time Timeout

  15. Frame Frame ACK ARQ Continued Sender Receiver Timeout Time ACK Timeout

  16. Alternating Bit Protocol Sender Receiver Frame 0 Timeout ACK 0 Time Frame 1 Timeout ACK 1 Frame 0 Timeout ACK 0

  17. Sliding Window Protocol Sender Receiver Time

  18. SWP Endpoint States Send Window Size Sender Last Acknowledgement Received Last Frame Sent Receive Window Size Receiver Next Frame Expected Last Frame Acceptable

  19. End-to-End Issues for TCP • New issues when link is not point to point • Setup required • Variable capabilities of connections • Packet Delay • Congestion control required • Compare: X.25 approach

  20. Flags SYN FIN RESET PUSH URG ACK Fields 0 15 31 SrcPort DstPort SequenceNum Acknowledgment HL 0 Flags Advert.Wind. Checksum UrgPtr Options (variable) DATA Packet Format

  21. Three-Way Handshake

  22. TCP State Transitions

  23. TCP Receiver • Maintains a buffer from which application reads; advertises < buffer size as the window for sliding window • Responds with Acknowledge and AdvertisedWindow on each send; updates byte counts when data O.K. • Application blocked until read() O.K.

  24. TCP Sender • Maintains a buffer; sending application is blocked until room in the buffer for its write • Holds data until acknowledged by receiver as successfully received • Implement window expansion and contraction; note difference between flow and congestion control

  25. Flow vs. Congestion Control • Flow control protects the recipient from being overwhelmed. • Congestion control protects the network from being overwhelmed.

  26. TCP Congestion Control • Additive Increase / Multiplicative Decrease • Slow Start • Fast Retransmit and Fast Recovery

  27. Increase and Decrease • A value CongestionWindow is used to control the number of unacknowledged transmissions. • This value is increased linearly until timeouts for ACKs are missed. • When timeouts occur, CongestionWindow is decreased by half to reduce the pressure on the network quickly. • The strategy is called “additive increase / multiplicative decrease”.

  28. Slow Start • Sending the entire window immediately could cause a traffic jam in the network. • Begin “slowly” by setting the congestion window to one packet. • When acknowledgements arrive, double the congestion window. • Continue until ACKs do not arrive or flow control dominates.

  29. Retransmit and Recovery • Fast retransmit uses duplicate ACKs to anticipate dropped packets. • When an out-of-order packet arrives, the receiver sends the previous ACK a second time. • When the sender gets a repeat ACK three times, it anticipates that a packet was lost and retransmits. • Fast recovery exploits outstanding ACKs to avoid falling back into a full slow start after a timer expires.

  30. Remote Procedure Call • Model of communication • support distributed programming • in fact tries to hide communication! • Interface between programming language and communications system • Adopts procedure-call interface • e.g., remote_foo(arg_1, arg_2);

  31. RPC Blocking

  32. RPC client and server • RPC client host must know how to reach server and what service is required • RPC server host must know who is requesting the service, what service is requested, and how to reply • Usually built over UDP; issues include argument marshalling, transport, binding, etc. Example: name resolution

  33. RPC Stubs

  34. Simple RPC Stack Dispatches request messages to the right process Synchronizes request and reply messages Fragments and reassembles large messages

  35. The BSD “socket” API • Designed for UNIX, which had “pipes” • Socket provides a “handle” (descriptor) which can be used for system operations such as read() and write() • Other services must exist for rendezvous, synchronization, etc.

  36. Making a Socket • int socket(int domain, int type, int protocol) • Domains: PF_INET, PF_UNIX • Types: SOCK_STREAM, SOCK_DGRAM • Example, TCP Socket: • socket(PF_INET, SOCK_STREAM, UNSPEC)

  37. Passive Open /Active Connect • Server • int bind(int socket, struct sockaddr* address, int addr_len) • int listen(int socket,...) • int accept(int socket, struct sockaddr* address, ...) • Client • int connect(int socket, struct sockaddr* address, int addr_len)

  38. Write and Read • int write(int socket, char* message, int msg_len) • int read(int socket, char* buffer, int buf_len)