OSI Model

 Data Networks week 1 slides notes:


OSI model, is a stack of protocols.


7 - Application Layer protocols: 

HTTP, FTP, SMTP, TELNET, POP3, ...


6 - Presentation Layer:

Performs

Translation (e.g. ASCII -> EBCDIC) (aka formatting)

Data Compression (lossless/lossy)

Encryption (SSL, a cryptographic protocol)


5 - Session Layer:

Authentication, 

authorization, 

session management (establish maintain terminate sessions)


4 - Transport layer

Segmentation (breaks data into small segments, each with seq. number, source and destination port number and address) (and reorganizing at destination)


Flow Control (controls amount of data being transmitted/received)

Error control (automatic repeat request for missing/corrupt data)


Uses Protocols either

TCP (connection-oriented) (used in emails, ftp, ...)

UDP (connectionless) (used in videos, games, ...) (aka just IP)

so TCP over IP (TCP/IP) becomes connection oriented)



3 - Network Layer (IP)

* Basic unit, packets (which build on top of segments from layer 4)

- Logical Addressing (added source/destination IP to segment to form Packet)

- Routing (using mask to first determine network, then device)

- Path determination (protocols like OSPF open shortest path first, Border Gateway Protocol (BGP), ...)

- Prioritization!

- and Device Location (for mobile networks)


From slides:

- Packetization, breaking data up into small packets, then add headers (source addr, designation addr, sequence #, error check)


--- needs hardware/software interface before last two hardware layers --- 


2 - Data Link Layer

Function 1: Framing (adding MAC address)


Unit: Frames (which are packets + source/destination MAC addresses)

note: packets are segments + source/destination IP addresses)



Function 2: Access control


From my understanding

Media here means medium for data linking, i.e. copper wire/optical fiber/air)

lots of frames are on the medium (when connected to same cable/air)

how do you know which frame is yours?

well, you look check if the destination MAC address is yours, then yes, it's yours. 

In other words, get the frame on and off the media. 


so IP addresses are to route from one network to another

and MAC is to "route" within a network (or switch)


To make sure no collisions occurs on the same media, protocol CSMA (carrier-sense multiple access), meaning it the carrier (sender) senses whether line is occupied or idle, and only sends when idle. 


note: collision detection is detected when signal almost double in case of physical wires, in which case, wait random time, defined by a relationship to other constants. 


CSMA/CD (with collision detection), was a protocol designed for wireless networks using some strategies because wireless collision only amplify signals by ~5-10%, not significant enough to confidently ascertain collision. So, we need some more coordinations, and randomness, to decrease chance of collision. 


Note: error bits are added as trailer in a frame (called Frame check sequence (FCS))



From slides:

Functions: error checking, notification, recovery


1 - Physical Layer

Agrees on the media (or plural of medium), ethernet cable/optical fiber, air, etc...


And signal, electrical signal, light, or radio (EM waves)





IN TCP/IP model, 


Data Link layer has two sublayers

1) MAC (media access control layer), which allows pushing and pulling off the media of transmission

and employing CSMA/CD, we can avoid collisions by randomly waiting a duration of time before resending (called contention)


In case of ring, use Token Passing instead of contention (CDMS/CD)


2) LLC (logical link layer), which performs 

- flow control (self explanatory), 

- error detections via Automatic Repeat Request (ARQ) which is 

basically, if no ACK received, will send again

-resizing of IP packets to fit into data link frames

- also message sequencing

(basically TCP for data link)



since transport layer (TCP in this case) already provides all three above functions, LLC is usually bypassed. 



Other layers pretty much same purpose


ARP module (address resolution protocol) which maps dynamic IP addresses o permanence physical machine addresses in a LAN. 


Note, in network layer, if devices are in the same network, will give IP address to ARP, which will return a MAC address, and send directly, as if connected on the same copper cable or bus. 


Why MAC address?

Technically, IP address of destination is known, but once it reaches router, router needs to use ARP (address resolution protocol) module to translate that into destination MAC address, since they use that to operation within LAN. It sounds like legacy system problems. 


Since routers and gateways usually take place at network layer (layer 3), they are sometimes just called Layer 3 switches (in comparison to actual LAN switches on layer 2)


Note, IP is just an underpaid delivery guy (logical addressing, routing, path determination), but does not guarantee delivery or check for error. 



Note, TCP can break up large data into TCP segments

UDP cannot, so can only transmit data that fit into one UDP datagram (max 65K or 2^16 bytes)


Discrepancy: user applications do not exist in application layer of OSI, but they use application layer protocols, like browsers use http/https, emails use POP3 (post office protocol) /SMTP (simple mail transfer protocol) / IMAP (internet messaging access protocol)



Popular application layer protocols

- DNS: (domain name system) converts between IP and Domain Name

- DHCP (Dynamic Host Configuration Protocol), automatically assigns IP addresses to connected devices, subnet masks, and gateway (which is the access point to another network)

- FTP (file transfer protocol)

- HTTP (send and receive webpages)

- IMAP (email messages)

- IRC (internet relay chat) (internet chat)

- POP3 (retrieve messages)

- SMTP (also email messages)



Router actually uses "port forwarding", NAPT (network address port translation) (sometimes also NAT network address translation to translate private to public IP addresses or PAT which is a subset of NAT which translates between public addresses and port numbers [not exactly sure how... not tested though]), 

meaning your computer send a connection via an internal IP address and a port A on your machine to router, router uses external IP address and a different port B to send to destination. When packet comes, router forwards packet coming from port B to your IP and your port A. 







Comments

Popular posts from this blog

How does Entropy work to split Decision Trees?

Idiosyncrasies of Modulo Arithmetic

Lumen Candela Lux Nits