Tuesday, December 30, 2008

First Glance

Recently I started CCNA on American International University Bangladesh (AIUB). Although my first impression about CCNA was that it is a hard nut to crack, as I went through the course, it seemed that it’s quite interesting and a little careful understanding is all it takes, thanks to the wonderful online material that CISCO offers. When I was preparing for the final exam, I tried to make simple notes about the topics so that I need to remember very little of things and solve all the problems analytically. So here is my beginners guide to CCNA.

At this moment, CCNA is divided into two curricula:
• CCNA Discovery - for general computer users
• CCNA Exploration – for students in IT and networking
I will be discussing CCNA Exploration but as CCNA discovery deals with the same concepts with less technical and engineering stuff, so it should be equally appropriate.

CCNA Exploration is dived into four major parts:
• Network Fundamentals
• Routing Protocols and Concepts
• LAN Switching and Wireless
• Accessing the WAN

Network Fundamentals:

A network consists of some network devices and their interconnection using some media like copper wire or optical fiber or wireless link. The network devices can be classified into the following categories:

End devices:
These are the devices that provides with human interface like PC, Servers, Workstation, Network Printer, Closed Circuit cameras etc.
Intermidiary Devices: These devices are used to connect and control the flow of data, find the optimum route for destination. Most common are Router, Switch, Hub, Wireless access points
Security Devices: These provides security and filtering of data like Firewall

LAN & WAN:
LAN is the network of some private PCs usually located at the same geographic are. WANs are connection of several LANs.

Internet & Intranet:
Internet is the interconnection of a lot of WANs in which data is publicly accessible. Intranet is the interconnection of some WANs of a company that is accessible only by the employees and permitted users.

Protocols:
When we interact with someone we use some rules so that the person at the other end understands. Similarly the network devices when communicating with each other need to abide by some rules. These rules are called Protocols. Protocols specify the structure of the data, how the devices communicate to share different routes, the error and service message provided to the user and the start and termination of a data session. Usually IEEE, IETF, RFCs and other international society defines the protocols so that all over the world the communication is possible.
The important thing is that protocol only provides the rules, not the process by which they are implemented.

Layered Models:
The total network process is divided into several layers. Each layer works independently, so if a network switches from IPv4 to IPv6 only the network layer changes, the rest remains the same.

There are two basic types of models:
TCP/IP model
OSI reference model

OSI model consists of seven layers:
• Application
• Presentation
• Session
• Transport
• Network
• Data Link
• Physical
TCP/IP model has 4 layers:
• Application (Application, Presentation & Session layer of OSI model)
• Transport
• Internet (Network Layer)
• Network Access (Data Link & Physical layer)

Basic Communication Process:

At the source end an application has data that is to be sent. It sends data to presentation layer and then to the session layer. Then the data is passed to the transport layer where data is segmented and encapsulated with a port number. Afterwards it passes the data to network layer where the ip address are added and then it passes to the data link layer where physical address is added to the data. Then at the physical layer data is transmitted through physical media. When the receiver receives the data, it checks the destination physical address. If it matches then it passes the data to network later which checks the ip address. Then at the transport layer which application should use the data is found by the port number associated. When the application is found the data is presented to that application.

Application Layer:

The top layer at which human interacts with several applications.

Some Application layer Protocols are
DNS: resolves the website name into server ip, TCP/UDP Port 53
http: transfer webpage files, TCP Port 80
SMTP: sends mail from application to MUA like outlook express, TCP Port 25
POP: receives mail to outlook express, UDP Port 110
These protocols works on two processes
MTA: sends mail to another server
MDA: sends mail to host
Telnet: connect to remote device, TCP Port 23
FTP: shares file, TCP port 20, 21 (21 connects to remote device, 20 sends data)
DHCP: dynamically get ip from a pool from an ISP.
SMB: file sharing protocol, for linux it’s samba
P2P: works on gnutella protocol to share files

Presentation Layer:
It codes, compresses, and encrypt the application layer data

Session Layer:
Initiate, maintain and terminates session between two hosts.

Transport Layer:

It takes application layer data and. It enables more than one application to communicate simultaneously through the network and the data doesn’t get mixed. It segments data into segments so that if data lost then only that segment needs to be retransmitted. It controls data speed, if data is lost frequently then it slows down the communication. It assigns each application a port number and it is attached the segment so that the transport layer at the other end can determine which application will get the data.

The used port numbers are
Well known processes: like http, ftp etc that runs on server, 0-1023
Registered Ports: The applications that each host uses, 1024-49151
Dynamic or Private: The port number when using for initial connection, 49152-65535

When the destination device receives data at transport layer, it sees the sequence number and reassembles several segments, sees the port number and gives the data to the appropriate application layer apps.

The two common protocols are
TCP: uses sequence number, acknowledgments, flow control etc. so has large overhead usually used in application where data lost has severe effect like web pages, file transfers
UDP: connectionless, no acknowledgement, just stand and deliver. It has very low overhead so it’s best effort connection. Usually used in VOIP, or video chat.

Three way handshake:
It uses three way handshake when initializing a new connection.
Firstly, the sender sends a segment with SYN flag=1 with initial seq. number (ISN). Secondly, when the receiver gets it, it sends the transmitter a segment with ACK no= ISN+1; SYN flag=1, ACK flag=1.
Thirdly, the transmitter acknowledges a segment with SEQ=ack+1; ACK flag=1, SYN=0.

Network Layer:

The network layer gets transport layer segment, adds ip address of source and destination and creates a PDU called packet. The ip address is used to forward data at routers and distribute it among the users.
Network layer is connectionless, so it has no headache to see data is delivered or not. That’s the responsibility of the transport layer.

Two common protocols of network layer are
IPv4: Now used with 32bit ip address
IPv6: Limited usage, with 128 bit ip, it provides better security and supports more users than IPv4

Apart from ip address, some other information are added to network layer packet. They are TTL (time to live)= how many routers the packet can pass before they are dropped
TOS (Type of service)=the info that routers use to give priority to packets like VIPs
Transport layer Protocols: TCP: 06, UDP: 17
MF (More fragment): Several fragments need to be added to form the packet
DF (Don’t Fragment): Delicate packet, don’t make pieces.

A router is a layer 3 (network) device. When several networks are connected through routers, the routers exchanges information by routing protocol. So each router knows which network is connected to which router or the shortest path to a distant network. When a router gets a frame (layer 2 PDU) it decapsulates the frame and then checks the ip address in the packet and finds the network address by binary ANDing the ip address and the subnet mask. If the destined network is connected to the router it delivers the packet. Otherwise it encapsulates the packet again and resends the packet to another router which is the next hop for the desired network.

Data Link Layer:

The job of data link layer is divided into two sub-layers
Logical Link Control (LLC):
It communicates with the upper layer and finds the network layer protocol being used.
Encapsulating the packet from network layer with some header information it creates the data link layer PDU, frame.
Media Access Control (MAC):
It adds the host and destination MAC (physical address) to the frame.
The MAC is used in only inside the local network. So a network connected to a router uses its own MAC as source MAC and the MAC of the default gateway as destination MAC. The router uses the MAC of its fast Ethernet port as source MAC and the fast Ethernet port of another router as destination MAC, when transmitting the same data packet. So it’s important to note that MAC is valid inside the local network.

Media Access Control is done in two ways:
• Controlled: Each device connected to a network has its own time to send data like token passing.
• Contention based: The device senses if there is any data ion the media (physical wire), if there is not any device can communicate any time.

Two common contention based methods are:
CSMA/CD: Ethernet uses it
CSMA/CA: Wireless networks use it. It senses the media, if available then sends a signal that tells other devices that one device is transmitting.

If several device transmits at the same type then collision occurs. When collision occurs then the connected hosts send Jam signal so that the amplitude of the voltage increases and other hosts refrain from transmitting. Also all the hosts wait a random amount of time (called Back off time) after which they try to communicate again.

The data link layer PDU contains a field called Frame check sequence to determine if there’s any error in the data. It only detects error, not correct them. If error detected then the frame is dropped.

Data Link Layer Protocols:
Ethernet: 802.3
Wi-fi: 802.11
Wi-max: 802.16