1 / 75

Networking Overview: “Everything” you need to know, in 50 minutes

Networking Overview: “Everything” you need to know, in 50 minutes. Network Security Prof. Haojin Zhu Adopted from David Wagner @ UC Berkeley May 1 1 , 201 8. Lo ca l -Area Ne t w o rks. A. C. poin t-to-point. shared. How does compu ter A send a message to compu ter C?.

tmick
Download Presentation

Networking Overview: “Everything” you need to know, in 50 minutes

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Networking Overview: “Everything” you need to know, in 50minutes Network Security Prof. Haojin Zhu Adopted from David Wagner @ UC Berkeley May11,2018

  2. Local-AreaNetworks A C point-to-point shared HowdoescomputerAsenda messagetocomputerC?

  3. Local-AreaNetworks:Packets From:A To:C Message:Helloworld!

  4. Wide-AreaNetworks A router C HowdoweconnecttwoLANs?

  5. Wide-AreaNetworks A A R A.com C.com Hello world! HowdoweconnecttwoLANs? router C R C A.com C.com Helloworld! 5

  6. KeyConcept#1:Protocols • Aprotocolisanagreementonhowto communicate • Includessyntaxand semantics • Howacommunicationisspecified&structured • oFormat,ordermessagesaresentandreceived • Whatacommunicationmeans • oActionstakenwhentransmitting,receiving,ortimerexpires • Example:makingacommentinlecture? • Raiseyourhand. • Waittobecalledon. • Or:waitforspeakertopause andvocalize 4.Ifunrecognized(aftertimeout):say“excuseme” 6

  7. KeyConcept#2:DumbNetwork • OriginalInternetdesign:interiornodes (“routers”) havenoknowledge*ofongoingconnectionsgoing throughthem • Nothowyoupicturethetelephonesystemworks • Whichinternallytracksalloftheactivevoicecalls • Instead:thepostalsystem! • EachInternetmessage (“packet”)self-contained * Today’s Internet is full of hacks that violate this 7

  8. Self-ContainedIPPacketFormat IP=InternetProtocol 8-bit TypeofService (TOS) 4-bit Header Length 4-bit Version 16-bitTotal Length(Bytes) 3-bit Flags 13-bitFragmentOffset 16-bitIdentification Headerislikea letter envelope: containsall info neededfor delivery 8-bitTime to Live(TTL) 8-bitProtocol 16-bitHeaderChecksum 32-bitSourceIPAddress 32-bitDestinationIPAddress Payload(remainderofmessage) . . . . .

  9. KeyConcept#2:DumbNetwork • OriginalInternetdesign:interiornodes (“routers”) havenoknowledge*ofongoingconnectionsgoing throughthem • Not:howyoupicturethetelephonesystemworks • Whichinternallytracksalloftheactivevoicecalls • Instead:thepostalsystem! • EachInternetmessage (“packet”)self-contained • Interiorrouterslookatdestinationaddresstoforward • Ifyouwantsmarts,buildit“end-to-end”, not “hop-by-hop” • Buyssimplicity&robustnessatthecostofshifting complexityintoendsystems * Today’s Internet is full of hacks that violate this 9

  10. KeyConcept#3:Layering • Internetdesignisstronglypartitionedintolayers • Eachlayerreliesonservicesprovidedbynextlayer below… • …andprovidesservicestolayeraboveit • Analogy: –Considerstructureofan applicationyou’vewritten andthe“services”each layerrelieson/provides SystemCalls } DeviceDrivers Fully isolated VoltageLevels/ MagneticDomains fromuser programs

  11. InternetLayering(“ProtocolStack”) Note onapoint of potential confusion: these diagrams arealwaysdrawnwith lowerlayers below higherlayers… But diagramsshowing the layouts of packets are often the opposite, with the lowerlayers at thetopsince their headersprecede those for higherlayers 7 4 3 2 1

  12. HorizontalViewofaSinglePacket Firstbittransmitted Link Layer Header (Inter)Network Layer Header (IP) Transport Layer Header ApplicationData:structure dependsontheapplication …

  13. VerticalViewofaSinglePacket Link Layer Header Firstbittransmitted (Inter)NetworkLayer Header(IP) TransportLayerHeader ApplicationData: structuredependsonthe application . . . . . . . 13

  14. InternetLayering(“Protocol Stack”) 7 4 3 2 1

  15. Layer1:PhysicalLayer 7 4 3 2 Encodingbitstosendthem overasinglephysical link e.g.patternsof voltagelevels/ photonintensities/ RFmodulation 1

  16. Layer2:LinkLayer Framingandtransmissionofa collectionofbitsintoindividual messagessentacrossa single“subnetwork”(one physicaltechnology) Mightinvolvemultiplephysical links(e.g.,modernEthernet) Oftentechnologysupports broadcasttransmission (every “node”connectedtosubnet receives) 7 4 3 2 1

  17. Layer3:(Inter)NetworkLayer(IP) • Bridgesmultiple“subnets”to provideend-to-endinternet connectivitybetweennodes • Providesglobaladdressing 7 4 3 2 Worksacrossdifferentlink technologies } Differentforeach Internet“hop” 1

  18. Layer4:TransportLayer End-to-endcommunication betweenprocesses Differentservicesprovided: TCP=reliablebytestream UDP=unreliabledatagrams (Datagram=singlepacket message) 7 4 3 2 1

  19. Layer7:ApplicationLayer Communicationofwhatever youwish Canusewhatever transport(s)isconvenient Freelystructured E.g.: Skype,SMTP(email), HTTP(Web),Halo,BitTorrent 7 4 3 2 1

  20. InternetLayering(“Protocol Stack”) } 7 4 3 2 Implementedonlyathosts, notatinteriorrouter (“dumb network”) 1

  21. InternetLayering(“Protocol Stack”) 7 4 3 2 } Implementedeverywhere 1

  22. InternetLayering(“Protocol Stack”) 7 4 3 2 }~SameforeachInternet“hop” }” Differentforeach Internet“hop 1

  23. Hop-By-Hopvs.End-to-EndLayers HostAcommunicateswithHostD HostC HostA Router 1 HostD Router 2 Router 3 Router 5 HostB Router 4 HostE Router 7 Router 6

  24. Hop-By-Hopvs.End-to-EndLayers HostAcommunicateswithHostD HostC HostA Router 1 E.g.,Wi-Fi HostD E.g.,Ethernet Router 3 Router 2 Router 5 HostB Router 4 HostE Router 7 Router 6 DifferentPhysical&LinkLayers(Layers1&2)

  25. Hop-By-Hopvs.End-to-EndLayers HostAcommunicateswithHostD HostC HostA Router 1 HostD Router 2 Router 3 Router 5 E.g.,HTTPoverTCPoverIP HostB Router 4 HostE Router 7 Router 6 SameNetwork/Transport/ApplicationLayers(3/4/7) (RoutersignoreTransport&Applicationlayers)

  26. Layer3:(Inter)NetworkLayer(IP) • Bridgesmultiple“subnets”to provideend-to-endinternet connectivitybetweennodes • Providesglobaladdressing • Worksacrossdifferentlink technologies 7 4 3 2 1 26

  27. IPPacketStructure

  28. IPPacketStructure 8-bit TypeofService (TOS) 4-bit Header Length 4-bit Version 16-bitTotal Length(Bytes) 3-bit 16-bit Identification 13-bit Fragment Offset Fla gs 16-bit HeaderChecksum Specifiesthelengthoftheentire IPpacket:bytesinthisheader plusbytesinthePayload 8-bitTime to Live(TTL) 8-bitProtocol 32-bitSourceIPAddress 32-bitDestinationIPAddress Options (if any) Payload

  29. IPPacketStructure 8-bit TypeofService (TOS) 4-bit Header Length 4-bit Version 16-bitTotal Length(Bytes) 3-bit 16-bit Identification gs 13-bit Fragment Offset 16-bit HeaderChecksum Fla Specifieshowtointerpretthe startofthePayload,whichis theheaderofaTransport ProtocolsuchasTCP orUDP 8-bitTime to Live(TTL) 8-bitProtocol 32-bitSourceIPAddress 32-bitDestinationIPAddress Options (if any) Payload

  30. IPPacketStructure 8-bit TypeofService (TOS) 4-bit Header Length 4-bit Version 16-bitTotal Length(Bytes) 3-bit Flags 16-bit Identification 13-bit Fragment Offset 8-bitTime to Live(TTL) 8-bitProtocol 16-bit HeaderChecksum 32-bitSourceIPAddress 32-bitDestinationIPAddress Options (if any) Payload

  31. IPPacketHeader(Continued) • TwoIPaddresses • –SourceIPaddress(32bits) • –DestinationIPaddress(32bits) • Destinationaddress • –Uniqueidentifier/locatorforthereceivinghost • –Allowseachnodetomakeforwardingdecisions • Sourceaddress • –Uniqueidentifier/locatorforthesendinghost • –Recipientcandecidewhethertoacceptpacket • –Enablesrecipienttosendareplybacktosource 31

  32. PostalEnvelopes: (Postoffice doesn’t look at the letter inside the envelope) 32

  33. AnalogyofIPtoPostalEnvelopes: IPsource address IPdestination address (Routers don’t lookat the payload beyond the IPheader)

  34. IP:“BestEffort”PacketDelivery • Routersinspectdestinationaddress,locate“next hop”inforwardingtable • Address=~uniqueidentifier/locatorforthereceivinghost • Onlyprovidesa“I’llgiveitatry”deliveryservice: • Packetsmaybelost • Packetsmaybecorrupted • Packetsmaybedeliveredoutoforder source destination IPnetwork

  35. “BestEffort”isLame! Whattodo? • It’sthejobofourTransport(layer4)protocolsto buildservicesourappsneedoutofIP’smodest layer-3service

  36. Layer4:TransportLayer End-to-endcommunication betweenprocesses Differentservicesprovided: TCP=reliablebytestream UDP=unreliabledatagrams (Datagram=singlepacket message) 7 4 3 2 1

  37. “BestEffort”isLame! Whattodo? • It’sthejobofourTransport(layer4)protocolsto buildservicesourappsneedoutofIP’smodest layer-3service • #1workhorse:TCP (TransmissionControlProtocol) • ServiceprovidedbyTCP: • Connectionoriented(explicitset-up/tear-down) • oEndhosts(processes)canhavemultipleconcurrentlong-lived communication • Reliable,in-order,byte-streamdelivery • oRobustdetection&retransmissionoflostdata

  38. TCP “Bytestream”Service Process A onhost H1 Byte3 Byte2 Byte1 Byte0 Byte80 Hostsdon’teverseepacketboundaries,lost orcorruptedpackets,retransmissions,etc. Process B on host H2 Byte80

  39. Bidirectionalcommunication: Process B onhost H2 Byte3 Byte2 Byte1 Byte0 Byte73 Therearetwoseparatebytestreams, one in eachdirection Process A on host H1 Byte73

  40. TCPHeader

  41. TCPHeader Portsare associated with OS processes

  42. (LinkLayerHeader) TCPHeader (IPHeader) Portsare associated with OS processes Sourceport Destinationport Sequencenumber Acknowledgment IPsource&destination addresses plusTCP source anddestination ports uniquelyidentifies aTCPconnection Advertisedwindow HdrLen Flags 0 Checksum Urgentpointer Options(variable) Data

  43. TCPHeader Portsare associated with OS processes IPsource&destination addresses plusTCP source anddestination ports uniquelyidentifies aTCPconnection Someport numbersare “wellknown” / reserved e.g. port 80=HTTP

  44. TCPHeader Starting sequence number(byte offset)ofdata carriedinthis packet

  45. TCPHeader Starting sequence number(byte offset)ofdata carriedinthis packet Bytestreams numbered independentlyin eachdirection

  46. TCPHeader Sourceport Destinationport Starting sequence number(byte offset)ofdata carriedinthis packet Sequencenumber Acknowledgment Advertisedwindow HdrLen Flags 0 Checksum Urgentpointer Bytestream numbered independentlyin eachdirection Options(variable) Data Sequencenumberassignedtostart ofbytestreamispickedwhen connectionbegins;doesn’t startat0 46

  47. TCPHeader Acknowledgment givesseq#just beyond highest seq.receivedin order. Ifsendersends Nbytestream bytesstartingat seqSthen “ack”foritwillbeS+N.

  48. SequenceNumbers Host A ISN(initialsequencenumber) Sequence ACKsequence TCPHDR TCP Data numberfromA numberfromB =1stbyte of data =next expected byte TCPHDR TCP Data Host B

  49. TCPHeader Sourceport Destinationport Sequencenumber Usesinclude: Acknowledgment acknowledging data (“ACK”) Advertisedwindow HdrLen Flags 0 Checksum Urgentpointer settingup (“SYN”) andclosing connections (“FIN” and “RST”) Options(variable) Data

  50. EstablishingaTCPConnection B A SYN EachhosttellsitsInitial SequenceNumber (ISN)totheotherhost. (Specsaystopickbased onlocalclock) SYN+A ACK Data Data • Three-wayhandshaketoestablishconnection • HostAsendsaSYN(open;“synchronizesequence numbers”)tohostB • HostBreturnsaSYNacknowledgment (SYN+ACK) • HostAsendsanACKtoacknowledgetheSYN+ACK 50

More Related