Search My Techie Guy

Friday, September 9, 2011

The OSI Reference Model Explained

OSI stands for the Open Systems Interconnection
The OSI has seven different layers, divided into two groups. The top three layers define how the applications within the end stations will communicate with each other and with users. The bottom four layers define how data is transmitted from one host to the other.

·          _ Application layer (layer 7)
·          _ Presentation layer (layer 6)
·          _ Session layer (layer 5)
·          _ Transport layer (layer 4)
·          _ Network layer (layer 3)
·          _ Data Link layer (layer 2)
·          _ Physical layer (layer 1)
Each layer performs a specialized function to ensure that two hosts or devices effectively communicate, below are some of the functions performed by each layer of the OSI model:
The Application Layer (layer 7)
The application layer provides the user interface. I.e. it marks the spot where users actually communicate to the computer.  Examples of protocols that operate at the application layer include; HTTP (for examples internet browsers work at the application layer), SMTP (for example email clients), FTP (for example FTP clients) and TFTP.

The Presentation Layer (layer 6)
The Presentation layer gets its name from its purpose: It presents data to the Application layer and is responsible for data translation and code formatting. This layer is essentially a translator and provides coding and conversion functions.
Tasks like data compression, decompression, encryption, and decryption are associated with this layer.

The Session Layer (layer 5)
The Session layer is responsible for setting up, managing, and then tearing down sessions between Presentation layer entities. This layer also provides dialog control between communicating hosts. It coordinates communication between systems and serves to organize their communication by offering three different modes: simplex, half duplex, and full duplex.

The Transport Layer (layer 4)
The Transport layer provides end-to-end data transport services and can establish a logical connection between the sending host and destination host on an internetwork.
Examples of protocols operating at this layer include; TCP and UDP, Therefore the Transport layer can be connectionless (UDP) or connection-oriented (TCP).
TCP is considered a reliable mechanism of transport whereas UDP is considered unreliable. The term reliable networking means that acknowledgments, sequencing, and flow control are used. The Transport layer is responsible for providing mechanisms for multiplexing upper-layer applications, establishing sessions, and tearing down virtual circuits.

The Network Layer (layer 3)

The Network layer (also called layer 3) manages IP addressing, tracks the location of hosts on the network, and determines the best way to move data, which means that the Network layer must transport traffic between hosts that aren’t locally attached. Examples of Network layer devices are; Routers and Layer 3 Switches.

The Data Link Layer (layer 2)

The Data Link layer provides the physical transmission of the data, handles error notification, network topology, and flow control. This means that the Data Link layer will ensure that messages are delivered to the proper device on a LAN using hardware or MAC addresses and will translate messages from the Network layer into bits for the Physical layer to transmit. Switches and Bridges are examples of devices that operate at the data link layer.

The Physical Layer (layer 1)

The Physical layer does two things: It sends bits and receives bits. The Physical layer specifies the electrical, mechanical, procedural, and functional requirements for activating, maintaining, and deactivating a physical link between end systems. Examples of devices that operate at the physical layer include; Hubs, NIC (Network Interface card), cables.

Monday, September 5, 2011

What is the difference between classful and classless IP routing protocols?

Classful IP routing protocols

These are routing protocols that do not send subnet mask information when a route update is sent out. Examples are; RIP version 1 and IGRP (Interior Gateway Routing Protocol). Classful routing protocols don’t have a field for subnet information, so the subnet information gets dropped. What this means is that if a router running RIP version 1 or IGRP has a subnet mask of a certain value, it assumes that all interfaces within the classful address space have the same subnet mask.
If you mix subnet mask lengths in a network running RIP or IGRP, that network just won’t work!

Classful network designs are inefficient and wasteful of IP addresses because you have to use the same subnet mask everywhere including point to Point interfaces which would only require two IP addresses.

Another disadvantage of classful routing protocols is that they don’t support summarization of routes and hence the routing tables for such networks tend to grow very big which increase the time a router will take to forward a packet and eventually slows down the network.
Very big routing table are also a head ache to manage and troubleshoot.


Classless IP routing protocols

Classless routing protocols, however, do support the advertisement of subnet information. I.e. these routing protocols send subnet mask information in the routing updates.
Examples of classless routing protocols are; RIP version 2, EIGRP and OSPF.
Therefore, you can use Variable Length Subnet Masks (VLSM) with these routing protocols.
VLSM means we can have different subnet masks for different router interfaces.

This technique helps to save IP address space because you can use subnet masks of different lengths on the different interfaces.

Another advantage of classless routing protocols is that they support summarization of IP routes; this keeps the routing tables in such networks small and easy to manage.
Routers will also spend less time doing route lookups in such small routing tables and hence enhance the forwarding speeds.

Tips on network optimization

There are so many things that can be done by a network administrator to improve network (LAN) performance. I will try and list some from my own experience:

1.   Replace all hubs with switches; A Hub is known to be a single collision domain and floods every frame it receives out all interfaces. It’s up to the computer to select which packet has its MAC address in the header and discard the rest. In turn, switches separate collision domains and use MAC tables to intelligently forward frames to the destination MAC address.

2.   Watch out for loops! Loops in switched networks cause broadcast storms on the network, multiple frame copies which eventually slows down the network and increases the switch CPU utilization. Some techniques used to prevent loops on the network include; CISCO's STP, Extreme Networks's EAPS.

3.   Loose connections; lose connections cause switch ports to keep flapping, this increases network messages being exchange across end points and hence cannibalizing on the bandwidth intended to carry data. Loose connections are caused by bad cable termination and bad patch cords.

4.   Use interfaces with enough capacity at the uplinks; uplinks are the interfaces interconnecting switches to other switches or switches to routers. Make sure that there are no bottle necks at the uplinks. For example gigabit interfaces for large networks and 100mbps interfaces for small networks.

5.   Watch out for computers with viruses on the network. A computer virus will always try to spread over the network and will always be sending unnecessary messages over the network which will clog up your bandwidth. Maintain a virus free network by using a good anti-virus with latest updates.

What is dynamic routing?

Dynamic routing is when protocols are used to find networks and update routing tables on routers as opposed to static routing or default routing. In static routing, IP networks are manually entered into the routing table by use of configuration commands whereas in dynamic routing, the router automatically learns of other neighboring IP networks by use of a routing protocol.
The routing protocols used in dynamic routing include:
1.        RIPv1 - Routing Information Protocol version 1
2.        RIPv2 - Routing Information Protocol version 2
3.        IGRP - Interior Gateway Routing Protocol
4.        EIGRP- Enhanced Interior Gateway Routing Protocol
5.        OSPF – Open Shortest Path First
6.        BGP – Border Gateway Protocol),
7.        MPLS – MultiProtocol Label Switching
8.        ISIS – Intermediate System-to-Intermediate System Protocol

Types of Networking Devices (Hubs, Switches and Routers)

1.   Hubs – These are used to connect devices in the same location into one collision domain. Hubs are not intelligent devices and cause unnecessary congestion on the network.
When a hub receives a frame, it replicates that frame and floods it out on all interfaces looking for the destination. It’s up to the hosts on the network to check the frame header and see who the packet is intended for!
This creates a lot of collisions and the end result is a slow network.
Hubs operate at Layer 1 of the OSI model.

2.   Bridges/Switches – Bridges were used before switches and in fact you can’t find a bridge on the market today. However switches and bridges do the same thing, i.e. breakup collision domains.
Switches create separate collision domains but a single broadcast domain.
Switches are intelligent devices and forward frames based on the destination MAC addresses.
Switches build MAC tables to help them do this intelligent forwarding of frames to destination hosts.
Switches operate at Layer 2 of the OSI model.
Switches are the best option to use when connection devices in a LAN (Local Area Network).

3.   Routers – These operate at Layer 3 of the OSI model and are used for packet switching.
Routers are used to segment broadcast domains.
Routers forward packets based on destination IP address as opposed to switches which use destination MAC addresses.
Routers are used to interconnect separate networks; e.g. Connect a LAN to the internet, Connect two LANs with different subnet ranges.

How to connect two computers using a crossover cable?

To connect two computers without using a Hub or Switch you only need to do two things:
1. Use a crossover cable for this connection; refer to the diagram below to see how the two ends of a crossover cable are terminated.


2. Assign IP addresses to the computers; make sure the two computers are assigned IPs in the same network or subnet.

For example if you choose to use 192.168.1.0/24 as your network address, then:
PC1 à IP Address: 192.168.1.1 Subnet Mask: 255.255.255.0
PC2 à IP Address: 192.168.1.2 Subnet Mask: 255.255.255.0

You can test the connectivity using the usual ping command:
Open the command terminal on your PC.

From PC1: ping 192.168.1.2
From PC2: ping 192.168.1.1

Your connection is successful in you get ping replies with 0% packet loss.
Have fun!!!

Which Subnet Mask gives you 64 Sub-networks from a class B network address?

In other words you want to take one network address and create 64 sub-networks from it!
To create sub-networks, you take bits from the host portion of the IP address and reserve them to define the subnet address.

Default subnet mask for all class B addresses is 255.255.0.0 or 11111111.11111111.00000000.00000000 or /16 where the “1”s define the network portion and “0”s define the host portion.

Number of subnets = 2^n
Where n is the number of “1”s
ð  64= 2^n
ð  2^6 = 2^n
ð  6 = n                                                                                                                                                                                                               
Which means we shall take 6 “0”s from the host portion and convert them to “1”s; The new subnet mask will be 11111111.11111111.11111100.00000000 or 255.255.252.0 or /22
Answer = 255.255.252.0 or /22
Leaving only 10 “0”s to define the hosts;
Number of Hosts = (2^m) - 2
Where m = number of “0”s
ð  Number of Hosts = (2^10) -2
ð  Number of Hosts = 1024 -2 =1022
You need to subtract 2 for the subnet address and the broadcast address, which are not valid hosts.