Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save krishnamurthydasari/d843c17b276bb1519f5eb36c99d60c43 to your computer and use it in GitHub Desktop.
Save krishnamurthydasari/d843c17b276bb1519f5eb36c99d60c43 to your computer and use it in GitHub Desktop.
Network Architecture Models
Blueprint or set of instructions to communicate systems each other
Each layer has specific purpose or a job
Each layer uses specific protocols and standards
OSI Layers and Purpose:**************
========================
Layer 7 - Application Layer - Provides and interface between communication software and applications that need to communicate
Layer 6 - Presentation Layer - Defines and negotiates data formats such as ASCII, Binary, JPEG. Encryption also a presentation service
Layer 5 - Sessions Layer - Defines how to start, end and control sessions.
Layer 4 - Transport Layer - Provides data delivery, error recovery and flow control
Layer 3 - Network Layer - Defines addressing, forwarding and path determination
Layer 2 - Data link Layer - Defines rules that determine when device can send data over perticular medium
Layer 1 - Physical Layer - Refers to standards that deal with physical charectoristics of physical data transmission
Two types of models:
--------------------
TCP/IP New (Current) actual implementation
OSI (OLD) only reference theaory
OSI Model (Open Systems Interconnection Model):
===============================================
theoretical stack/set of 7 layers to be used as reference to understand how networks operate.
7) Applications Layer - Actual applications(SMTP, FTP, HTTP etc)
6) Presentation Layer - Format data, encryption
5) Session Layer - Start, control & Stop sessions
4) Transport Layer - TCP, UDP, Port Numbers
3) Network Layer - IP address, Routers
2) Data Link Layer - MAC address, Switches
1) Physical Layer - Cable, Network interface cards, Hubs etc
TCP/IP Model:
==============
Application Layer (Sessions layer, presentation layer and application layer merged)
Transport Layer - TCP, UDP (port numbers are added here)
Network Layer (Internet layer) IP, Routers
Data Link Layer - Ethernet, switches
Physical Layer - cables, network interface card, hubs
Network encapsulation process:
------------------------------
5 DATA --> Application data
SEGMENT 4 DATA + TCP --> transport information added (tcp header etc)
PACKET 3 DATA + TCP + IP --> Add IP header, contains source and destination ip details
FRAME 2 ETHERNET + DATA + TCP + IP + ETHERNET --> header and trailer added. header contains destination and source MAC address. and trailer contains error check infor whether data recieved correctly at receiving side
1 PHYSICAL TRANSMISSION
De-capsulation:
Once the data has been transmitted, the receiving computer de-capulates the information, then it will check the destination MAC address for that FRAME, if the FRAME is destined for that computer, its processed further. The computer then checks the IP address in the PACKET, again, if the IP is destined for that computer its processed further. The transport information is read and data is sent to the receiving application.
For example, when you are sending data to other networks over routes & gateways, this time, in the frame that client sends to router will have MAC address of router. Router checks destination IP, builds new frame with destination server MAC and then sends frame to destination server.
Notes:
======
Layer 5: Application Layer
---------------------------
- Provides interface between communications software and any applications that needed to communicate outside the computer which the application resides on
- Application layer is to be considered for our communication protocols
Protocols - HTTP, DNS, DHCP, FTP, BGP, SMTP etc.
Layer 4: Transport Layer
-------------------------
- host to host communications layer
- Error recovery
- Flow control
- TCP 3 way handshake *****
Ref - https://www.youtube.com/watch?v=xMtP5ZB3wSk
- Before TCP transmits data it will use 3 way handshake to establish connection
- For example, a client machine want to send some data to server. Before transmission, TCP must be established through 3 way handshake
Step 1: SYN - The client sends SYN segment to the server, asking for syncronization. Syncronization means a connection
Step 2: SYN-ACK - The server replies with SYN-ACK segment, means synchronization and acknowledged.This means the server acknowledges clients connection request. It also asks client to open connection too (SYN-ACK)
Step 3: ACK - the client replies with ACK, which is like YES
Little more deeper with sequence numbers:
Step 1: The client sends SYN segment with initial sequence #9001 with ACK set to 0 and SYN set to 1
Step 2: The server responds with SYN-ACK with SYN set to 1 and ACK set to 9002, which is client sequence number + 1. By adding 1 to the clients sequence number, the server simplay acknowledge the clients connection request. In this request, the server's segment will have its own sequence number, 5001 for example
Step 3: Client acknowledges the servers connection request by ACK number to 5002 by increasing servers sequence number by 1. and clients sequence number 5002.
The clients sequence number 5001 first and then 5002 that means client and server has established two-way communication channel.
The steps 1 and 2 establishes connection between client and server. and the steps 3 and 4 establishes connection between from the server to client
Protocols:
TCP:
Transmission Control Protocol
Connection oriented
Provides Reliability
UDP:
User Datagram Protocol
Connectionless
NO Reliability
Less overhead
Devices:
Hosts (PC's servers), Firewalls
Segment:
Layer 4 Data encapsulation
Uses source and destination Port information
Layer 3: Network Layer
-----------------------
- Defines ways to communicate devices across networks
- Logical addressing (ROUTED) - IP addresses
- Forwarding (ROUTING) - Routers or layer 3 switches which forwards packets to final destination
Protocols:
- Routed (IP, ICMP )
- Routing - Protocols between routers (BGP, OSPF etc.)
- IPSec, IGMP
Devices:
- Routers
Packets:
- The layer 3 encaptulation header
- Encapsulates all data above it in to a packet hader
- Use Source and destination IP addresses
Layer 2: Data-Link Layer
--------------------------
- Defines rules that determine when a device can send data over perticular medium
- Defines format of header and trailer that allows devices attached to the medium to successfully send or receive data
Protocols:
- Ethernet (MAC), PPP, WAP, ARP
- Ethernet - Physical addressing / MAC address - MAC made of 48 bit chars. First 24 is OUI (organization Unit Identifier), second 24 is vendor assigned random uniqueu number
- ARP - maps IP address to MAC
-
Devices:
- Switches
Frame:
- Encapsulates all data above it
- Header - Uses source and destination MAC addresses information in the header
- Trailer - FCS (Frame Check Sequence) - Uses to verify there are no transmissions issues. Trailer will be 4 bytes in size
Layer 1: Physical Layer
------------------------
- Physical device for transmitting data
- NIC, Ethernet, Hub, Repeater
- Sends bits of data
OSI Layers and Purpose:
========================
Layer 7 - Application Layer - Provides and interface between communication software and applications that need to communicate
Layer 6 - Presentation Layer - Defines and negotiates data formats such as ASCII, Binary, JPEG. Encryption also a presentation service
Layer 5 - Sessions Layer - Defines how to start, end and control sessions.
Layer 4 - Transport Layer - Provides data delivery, error recovery and flow control
Layer 3 - Network Layer - Defines addressing, forwarding and path determination
Layer 2 - Data link Layer - Defines rules that determine when device can send data over perticular medium
Layer 1 - Physical Layer - Refers to standards that deal with physical charectoristics of physical data transmission
OSI Benefits:
==============
- Less complex
- Standard interfaces
- Easier to learn
- Easier to develop
- Multi-vendor ineroperability
- Moduler engineering
Commom Protocols:
==================
ARP:
-----
- ARP - Map IP address to MAC addresses
- ARP Broadcast - used to find devices on a network that are not listed n ARP table
DNS:
----
- UDP
- port 53
- 13 root domains
- Top level domains TLD
- Authoritative Name server
HTTP:
-----
- Hypertext transfer protocol
- When you connect to website,
- Web browser will use Applciation layer 7, protocal HTTP
- DNS translates domain name to server IP address, DNS uses port 53
- HTTP, using TCP protocol, makes connection using port 80 on server, client port will be any port over 1024
- 3 way handshake, connection established
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment