
327851360d46c514eac67351848a913a.ppt
- Количество слайдов: 38
Networking Basics Appendix 1
Network q Includes o o o q Computers Servers Routers Wireless devices Etc. Purpose is to transmit data Appendix 2
Network Edge Network edge includes q Hosts q o o o Computers Laptops Servers Cell phones Etc. , etc. Appendix 3
Network Core q Network core consists of o Interconnected mesh of routers q Purpose is to move data from host to host Appendix 4
Packet Switched Network q Usual telephone network is circuit switched o For each call, a dedicated circuit is established o Dedicated bandwidth q Modern data networks are packet switched o o o Data is chopped up into discrete packets Packets are transmitted independently No real circuit is established More efficient bandwidth usage But more complex than circuit switched Appendix 5
Network Protocols Study of networking focused on protocols q Networking protocols precisely specify the communication rules q Details are given in RFCs q o RFC is essentially an Internet standard Stateless protocols don’t remember q Stateful protocols do remember q Many security problems related to state q Do. S easier against stateful protocols q Appendix 6
Protocol Stack q q Application layer protocols o HTTP, FTP, SMTP, etc. Transport layer protocols application o TCP, UDP transport o IP, routing protocols network q Network layer protocols q Link layer protocols q user space o Ethernet, PPP Physical layer Appendix OS link NIC card physical 7
Layering in Action data application router transport network host q q data application network link physical host At source, data goes down the protocol stack Each router processes packet up to network layer o That’s where routing info lives Router then passes packet down the protocol stack Destination processes up to application layer o That’s where the data lives Appendix 8
Encapsulation q q X = application data at the source As X goes down protocol stack, each layer adds header information: o o q q Application layer: (H, X) Transport layer: (H, X)) Network layer: (H, (H, X))) Link layer: (H, (H, X)))) Header has info required by layer Note that app header is on the inside data X application transport network link physical packet (H, (H, X)))) Appendix 9
Application Layer q Applications o Web browsing, email, P 2 P, etc. o Running on hosts o Hosts want network to be transparent q Application layer protocols o HTTP, SMTP, IMAP, Gnutella, etc. q Protocol is one part of an application o For example, HTTP only a part of web browsing Appendix 10
Client-Server Model q Client “speaks first” q Server tries to respond to request q Hosts are clients and/or servers q Example: Web browsing o You are the client (request web page) o Web server is the server Appendix 11
Peer-to-Peer Model Hosts act as clients and servers q For example, when sharing music q o You are client when requesting a file o You are a server when someone downloads a file from you In P 2 P model, more difficult for client to find a server q Many different P 2 P models q Appendix 12
HTTP Example HTTP request HTTP response HTTP --- Hyper. Text Transfer Protocol q Client (you) request a web page q Server responds to your request q Appendix 13
initial session cookie HTTP r HTTP cookie later session q q Web Cookies equest respon se, coo kie est, coo equ HTTP r se respon HTTP Cookie database HTTP is stateless --- cookies used to add state Initially, cookie sent from server to browser Browser manages cookie, sends it to server Server looks in cookie database to “remember” you Appendix 14
Web Cookies q Web cookies can be used for o Shopping carts o Recommendations, etc. o A weak form of authentication q Privacy concerns o Web site can learn a lot about you o Multiple web sites could learn even more Appendix 15
SMTP used to send email from sender to recipient’s mail server q Then use POP 3, IMAP or HTTP (Web mail) to get messages from server q As with many application protocols, SMTP commands are human readable q Recipient Sender SMTP Appendix SMTP POP 3 16
Spoofed email with SMTP User types the red lines: > telnet eniac. cs. sjsu. edu 25 220 eniac. sjsu. edu HELO ca. gov 250 Hello ca. gov, pleased to meet you MAIL FROM: <arnold@ca. gov> 250 arnold@ca. gov. . . Sender ok RCPT TO: <stamp@cs. sjsu. edu> 250 stamp@cs. sjsu. edu. . . Recipient ok DATA 354 Enter mail, end with ". " on a line by itself It is my pleasure to inform you that you are terminated. 250 Message accepted for delivery QUIT 221 eniac. sjsu. edu closing connection Appendix 17
Application Layer q DNS --- Domain Name Service o Convert human-friendly names such as www. google. com into 32 -bit IP address o A distributed hierarchical database q Only 13 “root” DNS servers worldwide o A single point of failure for Internet o Attacks on root servers have succeeded o Attacks have not lasted long enough (yet…) Appendix 18
Transport Layer The network layer offers unreliable, “best effort” delivery of packets q Any improved service must be provided by the hosts q Transport layer has two protocols q o TCP better service, more overhead o UDP minimal service, minimal overhead q TCP and UDP run on hosts, not routers Appendix 19
TCP q TCP assures that packets o Arrive at destination o Are processed in order o Are not sent too fast for receiver (flow control) q TCP also provides o Network-wide congestion control q TCP is “connection-oriented” o TCP contacts server before sending data o Orderly setup and take down of “connection” o But no true connection, only a logical connection Appendix 20
TCP Header Source and destination port q Sequence number q Flags (ACK, SYN, RST, etc. ) q 20 bytes (if no options) q Appendix 21
TCP Three Way Handshake SYN request SYN-ACK (and data) SYN: synchronization requested q SYN-ACK: acknowledge SYN request q ACK: acknowledge msg 2 and send data q Then TCP “connection” established q o Connection terminated by FIN or RST packet Appendix 22
Denial of Service Attack The TCP 3 -way handshake makes denial of service (Do. S) attacks possible q Whenever SYN packet is received, server must remember “half-open” connection q o Remembering consumes resources o Too many half-open connections and server resources will be exhausted o Then server can’t respond to new connections Appendix 23
UDP q UDP is minimalist, “no frills” service o No assurance that packets arrive o No assurance packets are in order, etc. q Why does UDP exist? o More efficient (smaller header) o No flow control to slow down sender o No congestion control to slow down sender q Packets sent too fast, they will be dropped o Either at intermediate router or at destination o But in some apps this is OK (audio/video) Appendix 24
Network Layer q Core of network/Internet q Purpose of network layer q Network layer protocol is IP o Interconnected mesh of routers o Route packets through this mesh o Follows a “best effort” approach IP runs in every host and every router q Routers also run routing protocols q o Used to determine the path to send packets o Routing protocols: RIP, OSPF, BGP, etc. Appendix 25
IP Addresses IP address is 32 bits q Every host has an IP address q Not enough IP addresses! q o Lots of tricks to extend address space q IP addresses given in dotted decimal notation o For example: 195. 72. 180. 27 o Each number is between 0 and 255 q Host’s IP address can change Appendix 26
Socket Each host has a 32 bit IP address q But many processes on one host q o You can browse web, send email at same time How to distinguish processes on a host? q Each process has a 16 bit port number q o Port numbers < 1024 are “well-known” ports (HTTP port 80, POP 3 port 110, etc. ) o Port numbers above 1024 are dynamic (as needed) q IP address and port number define a socket o Socket uniquely identifies a process Appendix 27
IP Header q IP header used by routers q Time to live (TTL) limits number of “hops” q Fragmentation information (see next slide) o Note source and destination IP addresses o So packets can’t circulate forever Appendix 28
IP Fragmentation fragmented re-assembled Each link limits maximum size of packets q If packet is too big, router fragments it q Re-assembly occurs at destination q Appendix 29
IP Fragmentation One packet becomes multiple packets q Packets reassembled at destination q o Prevents multiple fragment/re-assemble q Fragmentation is a security issue! o o Fragments may obscure real purpose of packet Fragments can overlap when re-assembled Must re-assemble packet to fully understand it Lots of work for firewalls, for example Appendix 30
IPv 6 Current version of IP is IPv 4 q IPv 6 is a new-and-improved version q IPv 6 provides q o Longer addresses: 128 bits o Real security (IPSec) But difficult to migrate from v 4 to v 6 q So IPv 6 has not taken hold yet q Appendix 31
Link Layer Link layer sends packet from one node to next q Each link can be different q o o Wired Wireless Ethernet Point-to-point… Appendix 32
Link Layer q Implemented in adapter known as network interface card, or NIC o Ethernet card o Wireless 802. 11 card, etc. q NIC is (mostly) out of host’s control o Implements both link and physical layers Appendix 33
Ethernet is a multiple access protocol q Many hosts access a shared media q o On a local area network, or LAN q In ethernet, two packets can collide o o q Then data is corrupted Packets must be resent How to be efficient in distributed environment? Many possibilities, ethernet is most popular We won’t discuss details here Appendix 34
Link Layer Addressing IP addresses live at network layer q Link layer also requires addresses q o MAC address (LAN address, physical address) q MAC address o 48 bits, globally unique o Used to forward packets over one link q Analogy o IP address is like home address o MAC address is like social security number Appendix 35
ARP Address resolution protocol, ARP q Used at link layer to find MAC address of given IP address q Each host has ARP table q o o Generated automatically Entries expire after some time (20 min) ARP used to find ARP table entries ARP table also known as ARP cache Appendix 36
ARP is stateless q ARP sends request and receives ARP reply q Replies used to fill ARP cache q IP: 111. 001 IP: 111. 002 LAN MAC: AA-AA-AA-AA 111. 002 BB-BB-BB -BB ARP cache Appendix MAC: BB-BB-BB-BB 111. 001 AA-AA-AA -AA ARP cache 37
ARP Cache Poisoning ARP is stateless q Accepts any reply, even if no request sent! q 111. 003 CC-CC-CC-CC ARP “reply” 111. 001 CC-CC-CC-CC 111. 002 CC-CC-CC-CC 111. 001 AA-AA-AA-AA 111. 002 CC-CC-CC-CC BB-BB-BB-BB ARP cache LAN 111. 002 BB-BB-BB-BB 111. 001 AA-AA-AA-AA CC-CC-CC-CC ARP cache Host CC-CC-CC-CC is “man-in-themiddle” Appendix q 38
327851360d46c514eac67351848a913a.ppt