Tuesday, 19 August 2014

ARP-Address-Resolution-Protocol

ARP (Address Resolution Protocol) is a network protocol used to find out the hardware (MAC) address of a device from an IP address. It is used when a device wants to communicate with some other device on a local network (for example on an Ethernet network that requires physical addresses to be known before sending packets). The sending device uses ARP to translate IP addresses to MAC addresses. The device sends an ARP request message containing the IP address of the receiving device. All devices on a local network segment see the message, but only the device that has that IP address responds with the ARP reply message containing its MAC address. The sending device now has enough information to send the packet to the receiving device.
ARP request packets are sent to the broadcast addresses (FF:FF:FF:FF:FF:FF for the Ethernet broadcasts and 255.255.255.255 for the IP broadcast).
ARP broadcast explained: 
arp process
Let’s say that Host A wants to communicate with host B. Host A knows the IP address of host B, but it doesn’t know the host B’s MAC address. In order to find out the MAC address of host B, host A sends an ARP request, listing the host B’s IP address as the destination IP address and the MAC address of FF:FF:FF:FF:FF:FF (Ethernet broadcast). Switch will forward the frame out all interfaces (except the incoming interface). Each device on the segment will receive the packet, but because the destination IP address is host B’s IP address, only host B will reply with the ARP reply packet, listing its MAC address. Host A now has enough information to send the traffic to host B.
All operating systems maintain ARP caches that are checked before sending an ARP request message. You can display ARP entries in Windows by using the arp -a command:
 
windows arp

DHCP-Dynamic Host Configuration Protocol

DHCP is a network protocol that is used to assign various network parameters to a device. This greatly simplifies administration, since there is no need to assign static network parameters for each device separately. DHCP is a client-server protocol. A client is a device that is configured to use DHCP to request network parameters from a DHCP server. DHCP server maintains a pool of available IP addresses and assignes one of them to the host. A DHCP server can also provide some other parameters, such as:
• subnet mask
• default gateway
• domain name
• DNS server
Cisco routers can be used as a DHCP server.
DHCP process explained:
DHCP client goes through the four step process:
dhcp process explained
1: A DHCP client sends a broadcast packet (DHCP Discover) to discover DHCP servers on the LAN segment.
2: The DHCP servers receive the DHCP Discover packet and respond with DHCP Offer packets, offering IP addressing information.
3: If the client receives the DHCP Offer packets from multiple DHCP servers,
the first DHCP Offer packet is accepted. The client responds by broadcasting a DHCP Request packet, requesting network parameters from a single server.
4: The DHCP server approves the lease with a DHCP Acknowledgement packet. The packet includes the lease duration and other configuration information.

DNS -Domain Name System

DNS is a network protocol used to translate hostnames into IP addresses. DNS is not required to establish a network connection, but it is much more user friendly for human users than the numeric addressing scheme. Consider this example. You can access the Google homepage by typing 74.125.227.99, but it’s much easier just to type www.google.com!
To use DNS, you must have a DNS server configured to handle the resolution process. A DNS server have a special-purpose application installed. The application maintains a table of dynamic or static hostname-to-IP address mappings. When a user request some network resource using a hostname, (for example by typing www.google.com in a browser), a DNS request is sent to the DNS server asking for the IP address of the hostname. The DNS server then replies with the IP address. The user’s browser can now use that IP address to access www.google.com.
The figure below explains the concept:
dns process
Suppose that the DNS Client wants to communicate with the server named Server1. Since the DNC Client doesn’t know the IP address of Server1, it sends a DNS Request to the DNS Server, asking for Server1′s IP address. The DNS Server replies with the IP address of Server1 (DNS Reply).
The picture below shows a sample DNS record:
dns record
Here you can see that the host with the hostname APP1 is using the IP address of 10.0.0.3.

Telnet

Telnet is a network protocol that allows a user to communicate with a remote device. It is a virtual terminal protocol used mostly by network administrators to remotely access and manage devices. Administrator can access the device by “telnetting” to the IP address or hostname of a remote device.
To use telnet, you must have a software (Telnet client) installed. On a remote device, a Telnet server must be installed and running. Telnet uses TCP port 23.
One of the greatest disadvantages of this protocol is that all data, including usernames and passwords, is sent in clear text, which is a potential security risk. This is the main reason why Telnet is rarely used today and is being replaced by a much secure protocol called SSH.
The word “telnet” can also refer to the software that implements the telnet protocol.
On Windows, you can start a Telnet session by typing the telnet IP_ADDRESS or HOSTNAME command:
telnet windows

SSH-Secure Shell

SSH is a network protocol used to remotely access and manage a device. The key difference between Telnet and SSH is that SSH uses encryption, which means that all data transmitted over a network is secure from eavesdropping.
Like Telnet, a user accessing a remote device must have an SSH client installed. On a remote device, an SSH server must be installed and running. SSH uses TCP port 22 by default.
SSH relies on public key cryptography for its encryption.
Here is an example of creating an SSH session using Putty, a free SSH client:
putty
NOTE – SSH is the most common way to remotely access a Cisco device

FTP -File Transfer Protocol

FTP is a network protocol used to transfer files from one computer to another over a TCP network. Like Telnet, it uses a client-network arhitecture, which means that a user has to have an FTP client installed to access an FTP server running on the remote machine. After establishing an FTP connection, the user can download or upload files to and from the FTP server.
FTP uses two TCP ports: port 20 for sending data and port 21 for sending control commands.
FTP can use authentication, but like Telnet, all data is sent in clear text, including usernames and passwords.

TFTP-Trivial File Protocol

TFTP is a network protocol used to transfer files between remote machines. It is a simple version of FTP, lacking some of the more advanced features FTP offers, but requiring less resources than FTP.
Because of it’s simplicity TFTP can be used only to send and receive files. It uses UDP port 69 for communication.
Because of it’s disadvantages TFTP is not widely used today, but it’s used to save and restore a router configuration or to backup an IOS image.
TFTP doesn’t support user authentication and sends all data in clear text

HTTP Hypertext Transfer Protocol

HTTP is an client-server protocol that allows clients to request web pages from web servers. It is an application level protocol widely used on the Internet. Clients are usually web browsers. When a user wants to access a web page, a browser sends an HTTP Request message to the web server. The server responds with the requested web page. Web servers usually use TCP port 80.
Clients and web servers use request-response method to communicate with each other, with clients sending the HTTP Requests and servers responding with the HTTP Responses. Clients usually send their requests using GET or POST methods, for example GET /homepage.html. Web servers responds with a status message (200 if the request was successful) and sends the requested resource.
An example will clarify this process:

http process explained

HTTPS | Hypertext Transfer Protocol Secure

Hypertext Transfer Protocol Secure is a secure version of HTTP. This protocol enables secure communication between a client (e.g. web browser) and a server (e.g. web server) by using encryption. HTTPS uses SSL (Secure Socets Layer) protocol and for encryption and TCP port 443 for communication.
HTTPS is commonly used to create a secure channel over some insecure network, e.g. Internet. By default, most traffic on the Internet is unencryped and susceptible to sniffing attacks. HTTPS encrypts sensitive information, which makes a connection secure.
HTTPS is usually not used on the entire website because encryption slows down the site. Instead, it is used only to protect sensitive information like usernames and passwords.
HTTPS URLs begin with https instead of http. In Internet Explorer, you can immediately recognize that a web site is using HTTPS because a lock appears to the right of the address bar:
https ie lock

Cisco IOS overview

IOS (Internetwork Operating System) is a multitasking operating system used on most Cisco routers and switches. IOS has a command-line interface with the predetermined number of multiple-word commands. This operating system is used to configure routing, switching, internetworking and other features supported by a Cisco device.
Previous versions of Cisco switches ran CatOS, a discounted version of a CLI-based operating sytem.
Below you can see how IOS looks like when a Cisco device is started for the first time:
ios initial screen

 Accessing the IOS

There are three most common ways to access the IOS:
1. Console access – this type of access is usually used to configure newly acquired devices. These devices usually don’t have an IP address configured, and therefore can not be accessed through a network. Most of the Cisco devices have a physical console port. This port can be connected to a computer using a rollover cable, a special type of cable with pins on one end reversed on the other end of the cable. The rollover cable is a serial cable, which means that you can’t just plug it in an Ethernet port on your computer. You will need an adapter that converts an interface on your computer (usually a 9-pin serial interface) into RJ-45.
2. Telnet access – this type of access used to be a common way to access network devices. Telnet is an terminal emulation program that enables you to access IOS through the network and configure the device remotely. The device that is being configured needs to have an Telnet server installed and an IP address configured.
Telnet uses a well known TCP port 23. One of the biggest disadvantages of this protocol is that is sends all data as clear-text, which includes the passwords! This is the reason why this type of access is usually not used anymore. Instead, SSH is usually used.
3. SSH access – like Telnet, this access type enables you to configure devices remotely, but it adds an extra layer of security by encrypting all communications using public-key cryptography. SSH uses well known TCP port 22.

Types of memory on a Cisco device

Cisco devices usually have four types of memory that are being used for different purposes. These four types are:
•    ROM (Read-only memory) – stores a bootstrap program that is used to initialize a boot process. This is a read-only type of memory, so it can’t be altered.
•    RAM (Random Access Memory) – the running configuration of a device is stored here. This type of memory loses its content when a device is restarted.
•    Flash memory – used to store IOS software images. Can also be used to store other files, for example backup configuration files.  Retains its content even after a device is restarted.
•    NVRAM (Nonvolatile RAM) – usually used to store a startup configuration file. This type of memory retains its content even after a device is powered down or restarted.

IOS modes

IOS has many different modes. There are three main modes any many submodes. We will describe the three main modes and one submode.
user EXEC mode – the default mode for the IOS CLI. This is the mode that a user is placed in after accessing the IOS. Only basic commands (like ping or telnet) are available in this mode.
privileged EXEC Mode – this mode is accessed by typing the enable command from the user EXEC mode. This mode can be password protected. In this mode a user can view and change a device’s configuration.
global configuration mode – this mode can be accessed by typing the configure terminal command from the privileged EXEC mode. It is used to change the device’s configuration.
A global configuration mode can have many submodes. For example, when a user wants to configure an interface, he will have to enter the interface submode by entering the interface INTERFACE_TYPE INTERFACE_NUMBER command (e.g. interface FastEthernet 0/1 ) from the global configuration mode. This submode can have many commands that are specific for the interface.

IOS command-User EXEC

User EXEC mode commands

Initially, a user logs into the User Exec mode. This is the mode with the least number of commands. You can get a list of all available commands by typing the character “?”.
user exec mode commands
As you can see, most of the commands available are used to show statistics and perform some basic troubleshooting. The prompt on the left side of the screen always displays the device hostname (R1 in this case), followed by the character >.
All commands can be abbreviated to their first letters of the command name. For example, you can abbreviate ping by typing pin, because no other command in the User EXEC mode IOS mode begins with these letters.

Privileged EXEC IOS mode commands

Privileged EXEC mode commands

This IOS mode is also called enable mode because you must enter the enable command from a user EXEC mode, if you want to access this mode. You can use more commands in the privileged EXEC mode than you were able to use in the user EXEC mode. You can save a device configuration or reload a device in this mode. You can also enter a third mode, the configuration mode.
An access to this mode can be protected by a password.
The prompt for this mode shows # after the device hostname.
privileged exec mode commands

Global configuration IOS mode commands

Global configuration mode commands

To change a device configuration, you need to enter the global configuration mode. This mode can be accessed by typing configure terminal (or conf t, the abbreviated version of the command) from the enable mode. The prompt for this mode is hostname(config).
Global configuration mode commands are used to configure a device. You can set a hostname, configure authentication, set an IP address for an interface, etc. From this mode you can also access submodes, for example the interface mode, from where you can configure interface options.
You can get back to a privileged EXEC mode by typing the end command. You can also type CTRL + C to exit the configuration mode.
global configuration mode commands

Submode commands

Submode commands

A global configuration mode contains many submodes. For example, if you want to configure an interface you have to enter that interface configuration mode. Each submode contains only commands that pertain to the resource that is being configured.
To enter the interface configuration mode you need to specify which interface you would like to configure. This is done by using the interface INTERFACE_TYPE/INTERFACE_NUMBER global configuration command, where INTERFACE_TYPE represents the type of an interface (Ethernet, FastEthernet, Serial…) and INTERFACE_NUMBER represents the interface number, since CIsco devices usually have more than one physical interface. Once inside the interface configuration mode, you can get a list of avaliable commands by typing the “?” character. Each submode has its own prompt. Notice how the command prompt was changed to HOSTNAME(config-if).
interface mode commands

Running and startup configuration

CIsco devices store commands in a configuration file. Immediately after you type a command in the global configuration mode it is stored in the running configuration. A running configuration resides in a device’s RAM, so if a device loses power, all configured commands will be lost.
To avoid that scenario, you need to copy your current configuration into a startup configuration. A startup configuration is stored in the nonvolatile memory of a device, which means that all configuration changes are saved even if the device loses power.
To copy your running configuration into the startup configuration you need to type the command copy running-configuration startup-configuration.
copy running startup config