Sie sind auf Seite 1von 27

Basic Switch Configurations Command

In this article I will introduce the Cisco Internetwork Operating System (IOS) command line interface (CLI) for the 2960 series switch. You will need to logon to a switch and become familiar with the different levels of access on the switch. You will also become familiar with the commands available to you in each mode (user or privileged) and the switch help facility, history, and editing features.

User vs. Privileged Mode


User mode is indicated with the > next to the switch name. You can look at settings but can not make changes from user mode. In Privilege mode, indicated by the #, you can do anything. To get into privilege mode the keyword is enable.

HELP
To view all commands available from this mode type:?This will give you the list of all available commands for the switch in your current mode. You can also use the question mark after you have started typing a command. For example if you want to use a show command but you do not remember which one it is, use the ? as this will output all commands that you can use with the show command.

Configuration Mode
From privilege mode you can enter configuration mode by typing config term command you can exit configuration mode type type end or <CTL>+z

Configuration of Cisco 2960 Switch


To practically implement these command either create a simple topology on packet tracer or download this topology. Example topology for basic switch commands

Now click on any switch and configure it as given below


To know all available command on user exec mode type ? and press enter Switch>? Exec commands: [1-99] connect disconnect enable

Session number to resume Open a terminal connection Disconnect an existing network connection Turn on privileged commands

exit Logout ping [Output is omitted]

Exit from the EXEC Exit from the EXEC Send echo messages

Three command can be used to logout from terminal use any one Switch>enable Switch#disable Switch>exit Switch con0 is now available Press RETURN to get started. Show version command will tell about the device platform and detected interface and ios name Switch>enable Switch#show version Cisco IOS Software, C2960 Software (C2960-LANBASE-M), Version 12.2(25)FX, RELEASE SOFTWARE (fc1) Copyright (c) 1986-2005 by Cisco Systems, Inc. Compiled Wed 12-Oct-05 22:05 by pt_team ROM: C2960 Boot Loader (C2960-HBOOT-M) Version 12.2(25r)FX, RELEASE SOFTWARE (fc4) System returned to ROM by power-on Cisco WS-C2960-24TT (RC32300) processor (revision C0) with 21039K bytes of memory. 24 FastEthernet/IEEE 802.3 interface(s) 2 Gigabit Ethernet/IEEE 802.3 interface(s) [Output is omitted] show mac address command will show all detected mac address dynamically and manually Switch#show mac-address-table Mac Address Table ------------------------------------------Vlan ---1 Mac Address ----------0001.643a.5501 Type -------DYNAMIC Ports ----Gig1/1

Run time configuration of ram can be any time by simple show run commands Switch#show running-config Building configuration... Current configuration : 925 bytes version 12.2 no service password-encryption ! hostname Switch [Output is omitted] To view startup configuration [ Stored in NVRAM] use show start command

Switch#show startup-config Current configuration : 925 bytes version 12.2 no service password-encryption ! hostname Switch [Output is omitted] show vlan command will give the detail overview of all vlan configured on switch Switch#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ----------------------1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 Fa0/5, Fa0/6, Fa0/7, Fa0/8 Fa0/9, Fa0/10, Fa0/11, Fa0/12 Fa0/13, Fa0/14, Fa0/15, Fa0/16 Fa0/17, Fa0/18, Fa0/19, Fa0/20 Fa0/21, Fa0/22, Fa0/23, Fa0/24 [Output is omitted] show interface command will show all detected interface with their hardware description and configuration Switch#show interfaces FastEthernet0/1 is up, line protocol is up (connected) Hardware is Lance, address is 0060.2f9d.9101 (bia 0060.2f9d.9101) MTU 1500 bytes, BW 100000 Kbit, DLY 1000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set [Output is omitted] interface vlan 1 is used to assign ip address and default gateway to switch. Show interface vlan 1 will give a over view of vlan1. Switch#show interface vlan1 Vlan1 is administratively down, line protocol is down Hardware is CPU Interface, address is 0060.5c23.82ae (bia 0060.5c23.82ae) MTU 1500 bytes, BW 100000 Kbit, DLY 1000000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set ARP type: ARPA, ARP Timeout 04:00:00 [Output is omitted] delete command is used to delete all vlan configuration from switch Dont add space between flash and vlan.dat Run this exactly shown here adding a space could erase flash entirely leaving switch blank Switch#delete flash:vlan.dat Delete filename [vlan.dat]? Delete flash:/vlan.dat? [confirm] %deleting flash:/vlan.dat Startup configuration can be removed by erase commands

Switch#erase startup-config Erasing the nvram filesystem will remove all configuration files! Continue? [confirm] [OK] Erase of nvram: complete %SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram use configure terminal command to go in global configuration mode Switch#configure terminal Enter configuration commands, one per line. Now change default switch name to switch 1 Switch(config)#hostname Switch1 Set enable password to vinita and secret to nikki Switch1(config)#enable password vinita Switch1(config)#enable secret nikki Set console password to vinita and enable it by login command, order of command is important set password before you enable it Switch1(config)#line console 0 Switch1(config-line)#password vinita Switch1(config-line)#login Switch1(config-line)#exit Enable 5 telnet session [ vty0 - vty4] for router and set their password to vinita Switch1(config)#line vty 0 4 Switch1(config-line)#password vinita Switch1(config-line)#login Switch1(config-line)#exit Now set switch 192.168.0.5 ip address to 192.168.0.10 255.255.255.0 and default gateway to

End with CNTL/Z.

Switch1(config)#interface vlan1 Switch1(config-if)#ip address 192.168.0.10 255.255.255.0 Switch1(config-if)#exit Switch1(config)#ip default-gateway 192.168.0.5 Set a description finance VLAN to interface fast Ethernet 1 Switch1(config)#interface fastEthernet 0/1 Switch1(config-if)#description finance VLAN By default switch automatically negotiate speed and duplex but you can adjust it manually Switch1(config-if)#duplex full %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to down %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to downSwitch1 (config-if)#duplex auto %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

Switch1(config-if)#duplex half %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to down %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up Switch1(config-if)#duplex auto Switch1(config-if)#speed 10 Switch1(config-if)#speed 100 Switch1(config-if)#speed auto Switch1(config-if)#exit Switch1(config)#exit mac address table can be wiped out by clear commands Switch1#show Switch1#show mac-address-table Mac Address Table ------------------------------------------Vlan ---Mac Address ----------Type -------Ports -----

1 0001.643a.5501 DYNAMIC Gig1/1 Switch1#clear mac-address-table Switch1#clear mac-address-table ? dynamic dynamic entry type Switch1#clear mac-address-table dynamic To restart switch use reload command [ running configuration will be erased so copy it first to startup configuration ] Switch1#reload Proceed with reload? [confirm] Switch con0 is now available Press RETURN to get started.

CCNA basic switch configuration commands sheet


Command switch>? switch>enable switch# switch#disable switch>exit switch#show version switch#show flash: switch#show mac-addresstable switch#show runningconfig descriptions The ? works here the same as in a router Used to get the list of all available commands User mode, same as a router Privileged mode Leaves privileged mode Leaves user mode Displays information about software and hardware. Displays information about flash memory (will work only for the 2900/2950 series). Displays the current MAC address forwarding table . Displays the current configuration in DRAM.

switch#show startupconfig switch#show vlan switch#show interfaces switch#show interface vlan1 Switch#delete flash:vlan.dat Delete filename [vlan.dat]? Delete flash:vlan.dat? [confirm] Switch#erase startupconfig Switch#reload

Displays the current configuration in NVRAM. Displays the current VLAN configuration. Displays the interface configuration and status of line: up/up, up/down, admin down. Displays setting of virtual interface VLAN 1, the default VLAN on the switch. To Reset Switch Configuration Removes the VLAN database from flash memory. Press Enter Press Enter Erases the file from NVRAM.

Restarts the switch. To Set Host Names Switch#configure terminal Moves to global configuration mode Switch(config)#hostname Creates a locally significant host name of the switch. This is the same command as the router. Switch1 Switch1(config)# To Set Passwords Switch(config)#enable Sets the enable password to vinita password vinita Switch(config)#enable Sets the encrypted secret password to nikki secret nikki Switch(config)#line Enters line console mode console 0 Switch(config-line)#login Enables password checking Switch(configSets the password to vinita line)#password vinita Exits line console mode Switch(config-line)#exit Switch(config-line)#line Enters line vty mode for all five virtual ports vty 0 4 Switch(config-line)#login Enables password checking Switch(configSets the password to vinita line)#password vinita Exits line vty mode Switch(config-line)#exit Switch(config)# To Set IP Addresses and Default Gateways Switch(config)#interface Enters the virtual interface for VLAN 1, the default VLAN on the switch vlan1 Switch(config-if)#ip Sets the IP address and netmask to allow for remote access to the address 192.168.0.10 switch 255.255.255.0

Switch(config-if)#exit Switch(config)#ip defaultAllows IP information an exit past the local network gateway 192.168.0.5 To Set Interface Descriptions Switch(config)#interface Enters interface configuration mode fastethernet 0/1 Switch(configAdds a description of the interface if)#description Finance VLAN To Set Duplex Operation Switch(config)#interface Moves to interface configuration mode fastethernet 0/1 Switch(config-if)#duplex Forces full-duplex operation full Switch(config-if)#duplex Enables auto-duplex config auto Switch(config-if)#duplex Forces half-duplex operation half To Set Operation Speed Switch(config)#interface fastethernet 0/1 Switch(config-if)#speed 10 Forces 10-Mbps operation Switch(config-if)#speed Forces 100-Mbps operation 100 Switch(config-if)#speed Enables autospeed configuration auto MAC Address Table switch#show mac addressDisplays current MAC address forwarding table table switch#clear mac addressDeletes all entries from current MAC address forwarding table table switch#clear mac addressDeletes only dynamic entries from table table dynamic

OSI Reference Model


The OSI reference model is the primary model for network communications. The early development of LANs, MANs, and WANs was confused in many ways. The early 1980s saw great increases in the number and sizes of networks. As companies realized that they could save money and gain productivity by using networking technology, they added networks and expanded existing networks as rapidly as new network technologies and products were introduced. In 1984, the International Organization for Standardization (ISO) developed the OSI Reference Model to describe how information is transferred from one networking component to another, from the point

when a user enters information using a keyboard and mouse to when that information is converted to electrical or light signals transferred along a piece of wire (or radio waves transferred through the air). ISO developed the seven-layer model to help vendors and network administrators gain a better understanding of how data is handled and transported between networking devices, as well as to provide a guideline for the implementation of new networking standards and technologies. To assist in this process, the OSI Reference Model separates thenetwork communication process into seven simple layers. Dividing the network into these seven layers provides these advantages:

Reduces complexity:
It breaks network communication into smaller, simpler parts. It divides the network communication process into smaller and simpler components, thus aiding component development, design, and troubleshooting.

Standardizes interfaces:
It standardizes network components to allow multiple vendor development and support.

Facilitates modular engineering:


It allows different types of network hardware and software to communicate with each other.

Interoperability between Vendors


It allows multiple-vendor development through standardization of network components. Defines the process for connecting two layers together, promoting interoperability between vendors It Allows vendors to compartmentalize their design efforts to fit a modular design, which eases implementations and simplifies troubleshooting

Ensures interoperable technology:


It prevents changes in one layer from affecting the other layers, allowing for quicker development.

Accelerates evolution:
It provides for effective updates and improvements to individual components without affecting other components or having to rewrite the entire protocol.

Simplifies teaching and learning:


It breaks network communication into smaller components to make learning easier. Provides a teaching tool to help network administrators understand the communication process used between networking components

The OSI Reference Model


The OSI reference model consists of seven layers: physical, data-link, network, transport, session, presentation, and application. The OSI model layers usually do not correspond exactly to the protocol stack running on an actual system. The data-link layer protocols often include physical layer specifications. The network and transport layer protocols work together to provide a cumulative end-to-end communication service. The functions of the session, presentation, and application layers are often combined into a single application layer protocol.

OSI Reference Model


Each OSI layer contains a set of functions performed by programs to enable data to travel from a source to a destination on a network. In our pervious article I told you the advantage of OSI model. advantage of OSI model In this article I will provide brief descriptions of each layer in the OSI reference model.

Application Layer
The application layer is the OSI layer that is closest to the user. This layer provides network services to the user's applications. It differs from the other layers in that it does not provide services to any other OSI layer, but only to applications outside the OSI reference model. Applications layer provide a platform to access the data of remote computer. The application layer protocols that you should know are as follows:

SNMP (Simple Network Management Protocol) Communicates status and allows control of networked devices. TFTP (Trivial File Transfer Protocol) Simple, lightweight file transfer. DNS (Domain Naming System) Translates a website name (easy for people) to an IP address (easy for computers). DHCP (Dynamic Host Configuration Protocol) Assigns IP, mask, and DNS server (plus a bunch of other stuff) to hosts. Telnet Provides a remote terminal connection to manage devices to which you are not close enough to use a console cable. HTTP (Hypertext Transfer Protocol) Browses web pages. FTP (File Transfer Protocol) Reliably sends/retrieves all file types. SMTP (Simple Mail Transfer Protocol) Sends email. POP3 (Post Office Protocol v.3) Retrieves email. NTP (Network Time Protocol) Synchronizes networked device clocks.

presentation layer
The presentation layer is responsible for formatting data so that application-layer protocols (and then the users) can recognize and work with it. Presentation layer format the file extensionssuch as .doc, .jpg, .txt, .avi, and so on. you realize that each of these file types is formatted for use by a particular type of application. The presentation layer taking the application layer data and marking it with the formatting codes so that it can be viewed reliably whenaccessed later. If necessary, the presentation layer might be able to translate between multiple data formats by using a common format.

The Session Layer


The session layer establishes, manages, and terminates sessions between two communicating hosts. It provides its services to the presentation layer. The session layer also synchronizes dialogue between the presentation layers of the two hosts and manages their data exchange. For example, web servers have many users, so many communication processes are open at a given time. Therefore, keeping track of which user communicates on which path is important.

Transport Layer
The transport layer is possibly the most important layer for exam study purposes. A lot is going on here, and it is heavily tested. The transport layer's main jobs

It sets up and maintains a session connection between two devices. It can provide for the reliable or unreliable delivery of data across this connection. It multiplexes connections, allowing multiple applications to simultaneously send and receive data. When Implementing a reliable connection, sequence numbers and acknowledgments (ACKs) are used. Flow control (through the use of windowing or acknowledgements) Reliable connections (through the use of sequence numbers and Acknowledgement )

Transport layer use two protocols for sending data TCP and UDP. TCP TCP is connection oriented protocols. Connection-oriented transmission is said to be reliable. Thinks TCP as registry AD facility available in Indian post office. For this level of service, you have to buy extra ticket and put a bunch of extra labels on it to track where it is going and where it has been. But, you get a receipt when it is delivered, you are guaranteed delivery, and you can keep track of whether your shipment got to its destination. All of this costs you morebut it is reliable! UDP UDP is connection less protocols. Connection-less transmission is said to be unreliable. Now, don't get too wrapped up in the term "unreliable" this doesn't mean that the data isn't going to get there; it only means that it isn't guaranteed to get there. Think of your options when you are sending a postcard, put it in the mailbox, and chances are good that it will get where it's supposed to go but there is no guarantee, and stuff does go missing once in a while. On the other hand, it's cheap. The transport layer can use two basic flow control methods:

Ready/not ready signals Windowing

There are two problems with the use of ready/not ready signals to implement flow control. First, the destination may respond to the source with a not ready signal when its buffer fills up. While this message is on its way to the source, the source is still sending information to the destination, which the destination will probably have to drop because its buffer space is full. The second problem with the use of these signals is that once the destination is ready to receive more information, it must first send a ready signal to the source, which must receive it before more information can be sent.In many implementations, the window size is dynamically negotiated up front and can be renegotiated during the lifetime of the connection. In windowing a window size is defined between two host engaged in data transmission. And sender host will wait for anacknowledgement signal after sending the segments equal to window size. If any packet lost in way receiver will respond with acknowledgement for lost packet. And sender will send lost packet again.

Reliability

When reliability is necessary, it should cover these four items:


recognizing lost packets and having them re-sent recognizing packets that arrive out of order and reordering them detecting duplicate packets and dropping the extra ones Avoiding congestion

Connection Multiplexing/Application Mapping


Transport layer assigns a unique set of numbers for each connection. These numbers are called port or socket numbers. TCP, and UDP, provide a multiplexing function for a device: This allows multiple applications to simultaneously send and receive data. Imagine a server that performs a number of functionsfor example email, web pages, FTP, and DNS. The server has a single IP address, but can perform all these different functions for all the hosts that want to connect to it. The transport layer (layer 4) uses port numbers to distinguish between different types of traffic that might be headed for the same IP address. Port numbers are divided into ranges by the IANA. Following are the current port ranges: Port number 01023 descriptions and

Well-KnownFor common TCP/IP functions applications 102449151 RegisteredFor applications built by companies Dynamic/PrivateFor dynamic connections 4915265535 unregistered applications

or

Common TCP and UDP Port Numbers


TCP FTP Telnet SMTP DNS HTTP POP NNTP HTTPS 20, 21 23 25 53 80 110 119 443 DNS DHCP TFTP NTP SNMP UDP 53 67,68 69 123 161

Network Layer
The network layer provides a logical topology and layer-3 addresses. Routers function at the network layer. This layer is responsible for three main functions:

Defines logical addresses used at layer-3 Finds paths, based on the network numbers of logical addresses, to reach destination devices Connects different data link types together, such as Ethernet, FDDI, Serial, and Token Ring

IP packet Where the transport layer uses segments to transfer information between machines, the Internet layer uses datagram's. Datagram is just another word for packet. The IP protocol is mainly responsible for these functions:

Connectionless data delivery: best effort delivery with no data recovery capabilities Hierarchical logical addressing to provide for highly scalable internetworks

IP addresses are broken into two components:


Network component Defines on what segment, in the network, a device is located Host component defines the specific device on a particular network segment

Two types of packets are used at the Network layer: data and route updates. Data packets Used to transport user data through the internetwork. Protocols used to support data traffic are called routed protocols; examples of routed protocols are IP and IPv6. Route update packets Used to update neighboring routers about the networks connected to all routers within the internetwork. Protocols that send route update packets are called routing protocols; examples of some common ones are RIP, RIPv2, EIGRP, and OSPF. Route update packets are used to help build and maintain routing tables on each router.

IP Classes

Class A addresses range from 1-126: 00000001-01111111. Class B addresses range from 128-191: 10000000-10111111. Class C addresses range from 192-223: 11000000-11011111. Class D addresses range from 224-239: 11100000-11101111. Class E addresses range from 240-254:

1. 0 is reserved and represents all IP addresses; 2. 127 is a reserved address and is used for testing, like a loop back on an interface: 3. 255 is a reserved address and is used for broadcasting purposes. Public addresses are Class A, B, and C addresses that can be used to access devices in other public networks, such as the Internet. Public IP address assign authority The Internet Assigned Numbers Authority (IANA) is ultimately responsible for handing out and managing public addresses. Normally you get public addresses directly from your ISP, which, in turn, requests them from one of five upstream address registries:

American Registry for Internet Numbers (ARIN) Reseaux IP Europeans Network Coordination Center (RIPE NCC) Asia Pacific Registry for Internet Numbers (APNIC) Latin American and Caribbean Internet Address Registry (LACNIC)

African Network Information Centre (AfriNIC)

Private IP and ISP


Private ip address can be used to configure private network. You can use private ip to build your network without paying a single rupees. But one biggest problem with private ip is that with private you can not access the internet. This is the point where ISP comes from. ISP purchase a bulk of public ip address and provide them on rent. Whatever you pay to ISP for accessing internet is actually the charge of using public ip address. Private ip address:- Not route able in public network

Class A: 10.0.0.0-10.255.255.255 (1 Class A network) Class B: 172.16.0.0-172.31.255.255 (16 Class B networks) Class C: 192.168.0.0-192.168.255.255 (256 Class C networks) Protocol IP IPX ICMP Description IP of TCP/IP, featuring routable 32-bit addressing. The equivalent of IP in Novell Netware. Internet Connection Management Protocol. Incorporates Ping and Traceroute, which are layer 3 link-testing utilities.

OSPF, IGRP, Dynamic routing protocols that learn about remote networks and the best EIGRP, RIP, ISIS paths to them from other routers running the same protocol. ARP, RARP Address Resolution Protocol (and Reverse ARP). ARP learns what MAC address is associated with a given IP address. Reverse ARP learns an IP address given a MAC address.

Data link layer


Main functions of data link layer is

Defining the Media Access Control (MAC) or hardware addresses Defining the physical or hardware topology for connections Defining how the network layer protocol is encapsulated in the data link layer frame Providing both connectionless and connection-oriented services Defines hardware (MAC) addresses as well as the communication process that occurs within a media. The first six hexadecimal digits of a MAC address form the OUI. MAC addresses only need to be unique in a broadcast domain, You can have the same MAC address in different broadcast domains (virtual LANs).

There are two specifications of Ethernet frame Ethernet II and 802


802.2 use a SAP or SNAP field to differentiate between encapsulatedlayer-3 payloads. With a SNAP frame, the SAP fields are set to 0xAA and the type field is used to indicate the layer-3 protocol. One of the issues of the original SAP field in the 802.2 SAP frame is that even though it is

eight bits (one byte) in length, only the first six bits are used for identifying upper-layer protocols, which allows up to 64 protocols. 802.2 SNAP frame support of up to 65,536 protocols Ethernet II's Version of Ethernet

Ethernet II does not have any sub layers, while IEEE 802.2/3 has two: LLC and MAC. Ethernet II has a type field instead of a length field (used in 802.3). IEEE 802.2 defines the type for IEEE Ethernet

Physical Layer
The Physical layer communicates directly with the various types of actual communication media. Different kinds of media represent these bit values in different ways. Some use audio tones, while others utilize state transitionschanges in voltage from high to low and low to high. Specific protocols are needed for each type of media to explain the proper bit patterns to be used, how data is encoded into media signals, and the various qualities of the physical medias attachment interface.

Fiber Cabling
Two types of fiber are used for connections: multimode and single-mode. Multimode fiber has a fiber thickness of either 850 or 1300 nanometers (nm), and the light signal is typically provided by an LED. When transmitting a signal, the light source is bounced off of the inner cladding (shielding) surrounding the fiber. Multimode fiber can achieve speeds in the hundreds of Mbps range, and many signals can be generated per fiber. Single-mode fiber has a fiber thickness of 1300 or 1550 nm and uses a laser as the light source. Because lasers provide a higher output than LEDs, single-mode fiber can span over 10 kilometers and have speeds up to 100Gbps. With single-mode fiber, only one signal is used per fiber.

Loss factor is used to describe any signal loss in the fiber before the light source gets to the end of the fiber. Connector loss is a loss that occurs when a connector joins two pieces of fibers: a slight signal loss is expected. Attenuation describe the signal loose due to distance Microbending is when a wrinkle in the fiber, typically where the cable is slightly bent, causes a distortion in the light source. Macrobending is when there is leakage of the light source from the fiber, typically from a bend in the fiber cable. to overcome this problem over long distances, optical amplifiers can be used.

Two main standards are used to describe the transmission of signals across a fiber: SONET is defined by the Exchange Carriers Standards Association (ECSA) and American National Standards Institute (ANSI) and is typically used in North America.

SDH is an international standard used throughout most of the world (with the exception of North America). Both of these standards define the physical layer framing used to transmit light sources, which also includes overhead for the transmission.

Cisco's three-layer hierarchical model


Core Layer
The core provides a high-speed layer-2 switching infrastructure and typically does not manipulate packet contents.

Distribution Layer
The distribution layer provides a boundary between the access and core layers. It contains routers and switches. Routers are used to provide the logical boundary--broadcasts are contained within the access layer and Filtering policies can be implemented to restrict traffic flows.

Access Layer
The access layer provides the user's initial access to the network, which is typically via switches or hubs.

TCP/IP protocol
The TCP/IP protocol stack has four layers. Note that although some of the layers in the TCP/IP protocol stack have the same names as layers in the OSI reference model, the layers have different functions in each model, as is described in the following list:

Application layer:
The application layer handles high-level protocols, including issues of representation, encoding, and dialog control. The TCP/IP model combines all application-related issues into one layer and ensures that this data is properly packaged for the next layer.

Transport layer:
The transport layer deals with QoS issues of reliability, flow control, and error correction. One of its protocols, TCP, provides for reliable network communications.

Internet layer:
The purpose of the Internet layer is to send source datagrams from any network on the internetwork and have them arrive at the destination, regardless of the path they took to get there.

Network access layer:


The name of this layer is broad and somewhat confusing. It is also called the host-to-network layer. It includes the LAN and WAN protocols and all the details in the OSI physical and data link layers.

Benefits of subnetting

Reduced network traffic


One network will not access the data of other network without the use of router. Thus we can reduce the amount of data remain in one network. Less data less overhead, collision, or broadcast storm.

Optimized network performance


This is a result of reduced network traffic.

Simplified management
It's easier to identify and isolate network problems in a group of Smaller connected networks than within one gigantic network. Facilitated spanning of large geographical distances Because WAN links are significantly slower and more expensive than LAN links, a single large network that spans long distances can create problems in every area earlier listed. Connecting multiple smaller networks makes the system more efficient.

Powers of 2
Powers of 2 are important to understand and memorize for use with IP subnetting. 21 22 23 24 25 26 27 28 2 4 8 16 32 64 128 256 29 210 211 212 213 214 215 216 512 1024 2048 4096 8192 16384 32768 65536

Before we go further lets get familiar with subnetting components

Subnet mask
A subnet mask is a 32-bit value that allows the receiver of IP packets to distinguish the network ID portion of the IP address from the host ID portion of the IP address. Every IP address is composed of a network component and a host component. The subnet mask has a single purpose: to identify which part of an IP address is the network component and which part is the host component. Subnet mask value 0 represent host ID while subnet mask value 1 to 255 represents Network ID in ip address.

Classless Inter-Domain Routing (CIDR)


This slash notation is sometimes called CIDR (Classless Inter-Domain Routing) notation. Its basically the method that ISPs (Internet service providers) use to allocate a number of Addresses to a company, a homea customer. The slash notation is simply the number of 1s in a row in the subnet mask. The real reason to use CIDR notation is simply that it is easier to say and especially to type.

Address Class and Default Mask


Subnetting happens when we extend the subnet mask past the default boundary for the address we are working with. So it's obvious that we first need to be sure of what the default mask is supposed to be for any given address. When faced with a subnetting question, the first thing to do is decide what class the address belongs to. And later decide what the default subnet mask is. One of the rules that Cisco devices follow is that a subnet mask must be a contiguous string of 1s followed by a contiguous string of 0s. There are no exceptions to this rule: A valid mask is always a string of 1s, followed by 0s to fill up the rest of the 32 bits. (There is no such rule in the real world, but we will stick to the Cisco rules hereit's a Cisco exam, after all.) Therefore, the only possible valid values in any given octet of a subnet mask are 0, 128, 192, 224, 240, 248, 252, 254, and 255. Any other value is invalid.

Block Size
The process of subnetting creates several smaller classless subnets out of one larger classful . The spacing between these subnets, or how many IP addresses apart they are, is called the Block Size.

Network ID and Broadcast ID


The first address in a network number is called the network address, or wire number. This address is used to uniquely identify one segment or broadcast domain from all the other segments in the network. The Broadcast ID The last address in the network number is called the directed broadcast address and is used to represent all hosts on this network segment. it is the common address of all hosts on that Network ID. This should not be confused with a full IP broadcast to the address of 255.255.255.255, which hits every IP host that can hear it; the Broadcast ID hits only hosts on a common subnet. A directed broadcast is similar to a local broadcast. The main difference is that routers will not propagate local broadcasts between segments, but they will, by default, propagate directed broadcasts.

Host Addresses
Any address between the network address and the directed broadcast address is called a host address for thesegment. You assign these middle addresses to host devices on the segment, such as PCs, servers, routers, and switches.

Method of Subnetting
There is several method of subnetting. Different author different approach to calculate the subnets. You should choose the method you can understand and perform subnetting easily. Whatever approach you choose need conversion of decimal to binary. Cram up this chart

27 128

26 64

25 32

24 16

23 8

22 4

21 2

20 1

To convert a decimal number into binary, you must turn on the bits (make them a 1) that would add up to that number, as follows:
187 = 10111011 = 128+32+16+8+2+1 224 = 11100000 = 128+64+32

To convert a binary number into decimal, you must add the bits that have been turned on (the 1s), as follows:
10101010 = 128+32+8+2 = 170 11110000 = 128+64+32+16 = 240

The IP address 138.101.114.250 is represented in binary as


10001010.01100101.01110010.11111010

The subnet mask of 255.255.255.224 is represented in binary as


11111111.11111111.11111111.11100000

Practical approach of subnetting


When faced with a subnetting question, the first thing to do is decide what class the address belongs to. for examples:
192.168.1.1

The first octet is between 192 and 223 so it is a Class C address


Default mask for Class C: is 255.255.255.0

In exam default subnet mask is not subnetted. Now write down the given ip address as shown here. Write down the default side of IP as it is and reset of part where actual subnetting will perform in binary
192.168. 1 .00000001 255.255.255.00000000 (defaul maks)

Step 1:- calculate the CIDR value CIDR are the on bit in subnet mask. As you can see in our example we have on bit only in default side.
255.255.255.00000000

So our CIDR value is 24 + 0 = 24 Step 2:- calculate the Subnet mask To calculate the subnet mask use the binary to decimal chart given above. Add the decimal place value of on network bit.
<==H bit

255.255.255.00000000 N bit==>

In our example we are using on default mask so our subnet mask will be 255.255.255.0 Step 3:- calculate the To calculate the total host count the H bit and use this formula
Total host = 2H <==H bit 255.255.255.00000000 Total host = 28 = 256

Total

Host

Step 4:- calculate the Valid Host Subtract 2 from Total host Every network or subnet has two reserved addresses that cannot be assigned to a host. These addresses are called the Network ID and the Broadcast ID, respectively. They are the first and last IPs in any network or subnet. We lose those two IP addresses from the group of values that could be assigned to hosts.
Total host - 2 256 -2 = 254

Step 5:- calculate the To calculate the Network count the N bit and use this formula
Network = 20 255.255.255.00000000 N bit==> Network = 20 = 1

Network

Step 6:Find out the block Finding block size is very easy just subtract the subnet mask from 256
256 Subnet mask (only the last octal, dont include the default subnet mask) 256 - 0 = 256

Size

Step 7:- Write down the subnet chart Network 1 CIDR Value /24 Net ID First Valid Host Last Valid Host Broadcast ID IP 192.168.1.0 192.168.1.1 192.168.1.254 192.168.1.255 Sunetmask 255.255.255.0 255.255.255.0 255.255.255.0 255.255.255.0

Subnetting of CIDR /25

Now do the subnetting of CIDR /25 using same method Step 1:- calculate the CIDR value CIDR = sum of all on bit in subnet mask
255.255.255.10000000

So our CIDR value is 24 + 1 = 25 Step 2:- calculate the Add the decimal place value of on network bit.
<==H bit 255.255.255.10000000 N bit==>

Subnet

mask

In our example we have one on bit and as you can see in decimal chart the place value of 1000000 is 128 so our subnet mask will be 255.255.255.128 Step 3:- calculate the Total Host
Total host = 2H <==H bit 255.255.255.10000000 Total host = 27 = 128

Step 4:- calculate the Subtract 2 from Total host


Total host - 2 128 -2 = 126

Valid

Host

Step 5:- calculate the To calculate the Network count the N bit and use this formula
Network = 21 255.255.255.10000000 N bit==> Network = 21 = 2

Network

Step 6:- Find out the block Size


256 Subnet mask (only the last octal, dont include the default subnet mask) 256 - 128 = 128

With help of block size you can easy find out the network ID and broadcast ID of all possible networks as we have 8 bits in one octal those can give maximum of 28 = 256 decimal number We start from 0 so it will end up on 255 (Do not get confuse because we are counting from 0 not from 1 so the last digit will be 255 not 256. It will 256 only when you count from 1 ). All subnetting will perform between these two numbers. Create a table of x Columns where x is the number of your network

First ip of first network will always be 0 and last ip of last network will be 255 fill its in chart Now you have network ID of first network and broadcast ID of last network. Now add block size in the first ip of first network to get the network ID of second network and so on till we get the network id of last network
First network ID 0 Second Network ID 0 +128 = 128

Fill this in Chart. As you can see from 128 next network is started so the last IP of first network will be 127 fill it in chart. With this method you can fill the last ip of all networks. Now you have first ip ( network ID ) of all networks and the last ip (Broadcast ID) of all networks. At this point you can easily fill the valid ip in each network. As valid hosts are all ip address those fall between network ip and host ip. Step 7:- Write down the subnet chart CIDR /25 Net ID First Valid Host Last Valid Host Broadcast ID Network 1 192.168.1.0 192.168.1.1 192.168.1.126 192.168.1.127 Network 2 192.168.1.128 192.168.1.129 192.168.1.254 192.168.1.255

Binary ANDing
Binary ANDing is the process of performing multiplication to two binary numbers. In the decimal numbering system, ANDing is addition: 2 and 3 equals 5. In decimal, there are an countless number of answers when ANDing two numbers together. However, in the binary numbering system, the AND function give up only two possible outcomes, based on four different combinations. These answers, can be displayed as a truth table:
0 1 0 1 and and and and 0 0 1 1 = = = = 0 0 0 1

You use ANDing most often when comparing an IP address to its subnet mask. The end result of ANDing these two numbers together is to give up the network number of that address.

Example Question
What is the network number of the IP address 192.168.100.115 if it has a subnet mask of 255.255.255.240?

Answer Step 1 Convert both the IP address and the subnet mask to binary:
192.168.100.115 = 11000000.10101000.01100100.01110011 255.255.255.240 = 11111111.11111111.11111111.11110000

Step 2 Perform the AND operation to each pair of bits1 bit from the address ANDed to the corresponding bit in the subnet mask. Refer to the truth table for the possible outcomes:
192.168.100.115 = 11000000.10101000.01100100.01110011 255.255.255.240 = 11111111.11111111.11111111.11110000 ANDed result = 11000000.10101000.01100100.01110000

Step 3 Convert the answer back into decimal:


11000000.10101000.01100100.01110000 = 192.168.100.112

The IP address 192.168.100.115 belongs to the 192.168.100.112 network when a mask of 255.255.255.240 is used.

My easy method
Conversion of decimal to binary and vice versa to get network ID is too time consuming process in exam. So I found this easy method. Step 1:- Decide from which class this IP belongs and what's its default subnet mask As given IP have 192 in its first octal so its a class C IP. And def ault subnet mask of class C is 255.255.255.0 Step2:- Find out the block size. ( As we describe above)
256 -240 = 16

Step3:- Write down all possible network using block size till we do not get our host partition in middle of two network
0,16,32,48,64,80,96,112,128,

As our host number is 115 which fall in the network of 112 so our network ID is
192.168.1.112,

And our host's broad cast ID is 192.168.1.127 as from 128 onward next network will start. Easy as I promise

ariable length subnet mask


Neither RIPv1 nor IGRP routing protocols have a field for subnet information, so the subnet information gets dropped. What this means is that if a router running RIP has a subnet mask of a certain value, it

assumes that all interfaces within the classful address space have the same subnet mask. This is called classful routing, and RIP and IGRP are both considered classful routing protocols. Classless routing protocols, however, do support the advertisement of subnet information. Therefore, you can use VLSM with routing protocols such as RIPv2, EIGRP, and OSPF. The benefit of this type of network is that you save a bunch of IP address space with it. VLSM enables you to have more than one mask for a given class of address, albeit a class A, B, or C network number. VLSM, originally defined in RFC 1812, allows you to apply different subnet masks to the same class address spaceClassful protocols, such as RIPv1 and IGRP, do not support VLSM. To deploy VLSM requires a routing protocol that is classlessBGP, EIGRP, IS-IS, OSPF, or RIPv2, for instance. VLSM provides Two major advantages:

more efficient use of addressing Ability to perform route summarization

when you perform classful subnetting, all subnets have the same number of hosts because they all use the same subnet mask. This leads to inefficiencies. For example, if you borrow 4 bits on a Class C network, you end up with 14 valid subnets of 14 valid hosts. A serial link to another router only needs 2 hosts, but with classical subnetting, you end up wasting 12 of those hosts. Even with the ability to use NAT and private addresses, where you should never run out of addresses in a network design, you still want to ensure that the IP plan that you create is as efficient as possible.

An efficient addressing scheme using VLSM.


1. Find the largest segment in the areathe segment with the largest number of devices connected to it. 2. Find the appropriate subnet mask for the largest network segment. 3. Write down your subnet numbers to fit your subnet mask. 4. For your smaller segments, take one of these newly created subnets and apply a different, more appropriate, subnet mask to it. 5. Write down your newly subnetted subnets. 6. For even smaller segments, go back to step 4.

Route Summarization
Route summarization is the ability to take a bunch of contiguous network numbers in your routing table and advertise these contiguous routes as a single summarized route. Route summarization, or supernetting, is needed to reduce the number of routes that a router advertises to its neighbor. Remember that for every route you advertise, the size of your update grows. It has been said that if there were no route summarization, the Internet backbone would have warped from the total size of its own routing tables back in 1997. Routing updates, whether done with a distance vector or link-state protocol, grow with the number of routes you need to advertise. In simple terms, a router that needs to advertise ten routes needs ten specific lines in its update packet. The more routes you have to advertise, the bigger the packet. The bigger the packet, the more bandwidth the update takes, reducing the bandwidth available to transfer

data. But with route summarization, you can advertise many routes with only one line in an update packet. This reduces the size of the update, allowing you more bandwidth for data transfer. Summarization allows you to create a more efficient routing environment by providing the following advantages:

It reduces the size of routing tables, requiring less memory and processing. It reduces the size of updates, requiring less bandwidth. It contains network problems

Example of VLSM

Above image shows several branch offices using subnetted Class C (/26) addresses that provide each branch with 62 possible host IPs. The branches are connected to the central office via point-to-point WAN links. The ideal mask to use for such a link is /30 because it provides only 2 hosts, one for each end of the link. The problem arises when therouting protocols are configured: Prior to VLSM, the /30 networks could not be used because the /26 networks existed in the same system and the classful routing protocols could only advertise one mask per class of address. All networks, including the little /30 links, had to use the same mask of /26. This wastes 60 IP addresses on each WAN link.

With the implementation of VLSM-capable routing protocols, we can deploy a /30 mask on the point-topoint links, and the routing protocols can advertise them as /30s along with the /26s in the branches because the subnet mask for each network is included in the routing updates. VLSM has allowed us to make the point-to-point link networks the ideal size (two hosts on each) using /30 masks. This has allowed us to use a single subnetted Class C network for all the addressing requirements in this scenarioand as you'll see, it makes a perfect opportunity to summarize these routes. This is what is meant by "more efficient addressing" in other words, making networks the right size without depleting the limited address space or limitingfuture growth.

Classless Interdomain Routing


Classless Interdomain Routing (CIDR), specified in RFC 2050, is an extension to VLSM and route summarization. With VLSM, you can summarize subnets back to the Class A, B, or C network boundary. For example, if you have a Class C network 192.168.1.0/24 and subnet it with a 26-bit mask, you have created four subnets. Using VLSM and summarization, you can summarize these four subnets back to 192.168.1.0/24. CIDR takes this one step further and allows you to summarize a block of contiguous class A, B, and C network numbers. This practice is commonly referred to as supernetting. Todays classless protocols support supernetting. However, it is most commonly configured by ISPs on the Internet using BGP. Discontiguous subnets are not supported by classful protocols but are supported by classless protocols. Classful protocols do not include the subnet mask when advertising network and subnet numbers. When implementing route summarization, another thing youll need to consider is that routing decisions, by a router, must be made on the entire destination IP address in the IP packet header. The router always uses the longest matching prefix in the routing table. CIDR allows you to summarize class networks together; VLSM allows you to summarize subnets only back to the class network boundaryEach segment has a single network number and mask. VLSM allows a class address, not a networksegment, to have more than one subnet mask.