Download - Network concepts
![Page 1: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/1.jpg)
Fundamental Concepts
OWASP HyderabadOct 10th, 2009
Marc-André Laverdière
![Page 2: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/2.jpg)
Agenda
● Network Basics● IP, TCP, UDP, DNS● Internet Architecture● Static Web architecture● HTTP features● REST-based architecture
(P.S. All images courtesy of Wikipedia)
![Page 3: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/3.jpg)
Network Basics
● OSI 7 Layer Model
![Page 4: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/4.jpg)
Network Topologies
● Point to point: using a switch or dedicated wiring
● Bus: common wire, like in cable internet
● Star: central hub● Ring: token ring● Mesh: redudancies● Tree: hierarchical
![Page 5: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/5.jpg)
Network Terms
● Client: computer that requests a service
● Server: computer that fulfills the request
● Gateway: point of contact to another network
● Proxy: intermediary for making requests to servers. Often caches resources
● Router: forwards information
● Hub: connects many network segments
● Switch: more efficient hub
● Link: connection between two points
![Page 6: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/6.jpg)
IP
● IP: Internet Protocol● Used to send
packets between point A and point B
● No delivery guarantee
● Two current versions: IPv4 and IPv6
![Page 7: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/7.jpg)
IPv4 vs IPv6
● IPv6 adds many features to IPv4:– Greater address space
– Supports autoconfiguration
– Multicast
– Mandatory IPSec (encryption, authentication, tunelling)
– Removed rare fields, redundant checksum
– Larger max packet size (4GB)
– Support for mobile devices
![Page 8: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/8.jpg)
NAT
● Network Address Translation, used with IP masquerading
● Used to make one IP address as front-end for many. E.g. Wireless hub+router
● Gateway rewrites the packets so that they look like they all originate from the gateway
● Breaks some applications, like SIP and some peer-to-peer clients
![Page 9: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/9.jpg)
TCP
● Transmission Control Protocol● Allows reliable transmissions● Error detection● Flow/congestion control● Add concept of port● Connection-based
![Page 10: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/10.jpg)
UDP
● User Datagram Protocol● Ports● Fast● No integrity checking/resending
![Page 11: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/11.jpg)
DNS
● Domain Name System
● UDP main● Some TCP● 13 root
clusters
![Page 12: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/12.jpg)
Internet Architecture
● Interconnected computer networks● TCP/IP● DNS● Lots of hardware● Supports many things
– WWW
– Usenet
– IRC
![Page 13: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/13.jpg)
![Page 14: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/14.jpg)
Static Web Architecture
● Www: portion of the Internet for retrieval of hyperdocuments
● Multiple clients, multiple servers● All resources are static● Documents can include or refer to other
resources● Resources are organized under websites● DNS, HTTP, HTML
![Page 15: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/15.jpg)
HTTP
● HyperText Transfer Protocol
● Text-based
● Binary content must be encoded (often Base64)
● One connection per request (HTTP 1.0) or one connection for many (HTTP 1.1)
● Stateless
● Verbs:– HEAD: get metadata
– GET: get a resource
– POST: submit data to a resource
– PUT: upload a resource
– DELETE
– TRACE: echo back the request
– OPTIONS: list supported methods
– CONNECT: create a tunnel
![Page 16: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/16.jpg)
HTTP Request● User-Agent Opera/9.64 (X11; Linux i686; U; en)
Presto/2.1.1
● Host www.wired.com
● Accept text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
● Accept-Language en-IN,en;q=0.9
● Accept-Charset iso-8859-1, utf-8, utf-16, *;q=0.1
● Accept-Encoding deflate, gzip, x-gzip, identity, *;q=0
● Cookie [cut]
● Cookie2 $Version=1
● Proxy-Connection Keep-Alive
![Page 17: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/17.jpg)
HTTP Response Header● HTTP/1.1 200 OK
● Date: Mon, 23 May 2005 22:38:34 GMT
● Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)
● Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
● Etag: "3f80f-1b6-3e1cb03b"
● Accept-Ranges: bytes
● Content-Length: 438
● Connection: close
● Content-Type: text/html; charset=UTF-8
![Page 18: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/18.jpg)
Cookies
● Cookies are values determined by the server that are stored by the client
● The client automatically sends the cookie value on every request to the server
![Page 19: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/19.jpg)
REST-Based Architecture
● Problem: what I described is static. We need to execute code to have Web Applications
● Principles: – Everything goes through the resources.
Resources are different than the representation given to the clients
– Resources can be manipulated through the representation
– Each message is self-descriptive
– Hypermedia contains the application state
![Page 20: Network concepts](https://reader034.vdocuments.mx/reader034/viewer/2022042813/546c45e2b4af9f8e2c8b50b7/html5/thumbnails/20.jpg)
Essentially
● Applications react to queries from the clients only. Nothing happens without a query.
● Resource access is free to trigger any processing