CCNET Handbook - Good Summary For Networking Ideas
CCNET Handbook - Good Summary For Networking Ideas
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any
form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise
without the prior written permission of the author. All rights reserved.
Chapter 1: Basic Networking Concepts
Network devices
Hub is a device that connects multiple Ethernet segments, effectively making them act as a single
segment. Every device that is attached to a hub shares a single broadcast and a single collision
domain. Hub provides basic OSI layer 1 connection. Hubs don't have any intelligence and every
packet is sent to every connected device in a hub environment.
Switch forwards data only to the devices that need to receive it, rather than broadcasting the data
through all it's ports. Switches work on layer 2 of OSI model. Switches can also perform error
checking.
Bridge is similar to a switch in it's function but a bridge usually have much less ports than a switch.
Bridges are easy and inexpensive way of connecting segments.
Router is a device that determines the next network hop to which it can forward a packet, towards
the ultimate destination. Usually routers use the IP address to forward the packets. Routers support
different WAN technologies and work on layer 3 of OSI model. Routers do not forward broadcast
packets by default. They do packet filtering, packet switching, path selection and facilitate
internetwork communication.
Collision domains
A collision domain is a domain where packet collisions can occur. A collision can occur when
multiple devices send a packet at the same time. Collisions do often occur in a hub environment,
because each port on a hub is in the same collision domain. Each port on a bridge, a switch or a
router is in a separate collision domain.
Broadcast domains
A broadcast domain is a domain in which a broadcast is forwarded. A broadcast domain contains all
the devices that can reach each other by using a broadcast messages. All ports on a hub and a
switch are in the same broadcast domain by default. All ports on a router are in a different
broadcast domain and routers don't forward broadcasts from a one broadcast domain to another.
The Application Layer serves as a medium for users and applications to access network services. This
layer contains variety of commonly used functions such as resource sharing, remote file access, remote
printer access, electronic messaging, etc. Examples include web browsers, SNMP, Telnet, NFS, FTP,
and HTTP.
The Presentation Layer formats the data before it is presented to the Application Layer. It can be called
the translator of the network. This layer translates data into a common format at the sending host, then
translates the common format to a format known to the Application Layer at the receiving host. It is
sometimes called the syntax layer. Examples include encryption, MIDI, EBCDIC, PICT, GIF, TIFF,
MPEG, JPEG, and ASCII.
The Session Layer establishes session between the processes running on the different stations.
Examples include NFS, NetBios names, RPC, and SQL.
The Transport Layer provides transfer of data between the hosts, and is responsible for error
recovery and flow control. It ensures a complete data transfer. Creates logical paths, known as
virtual circuits, for transmitting data from host to host. Examples include SPX, TCP, and UDP.
The Network Layer provides switching and routing. Routing, forwarding, addressing,
internetworking, error handling, congestion control and packet sequencing are functions of this
layer. Examples include AppleTalk DDP, IP, and IPX.
The Data Link Layer encodes data packets and decodes them to bits. It handles errors in the
physical layer, flow control and frame synchronization. The data link layer is divided into two sub
layers: The Media Access Control (MAC) layer and the Logical Link Control (LLC) layer. The MAC sub
layer controls how a host on the network gains access to the data and permission to transmit it.
The LLC layer handles error checking, flow control and frame synchronization. Examples include
PPP, FDDI, ATM, IEEE 802.5/ 802.2, IEEE 802.3/802.2, HDLC, and Frame Relay.
The Physical Layer handles transmission and reception of the raw bit stream over a physical
medium. It describes the electrical/optical, mechanical, and functional interfaces to the physical
medium, and carries the signals for all of the higher layers. Examples include Ethernet, FDDI, B8ZS,
V.35, V.24, and RJ45.
Ethernet frames
Bytes get combined into frames in Data Link Layer. Packets handed down from the Network Layer
are encapsulated to frames in Data Link Layer for transmission. Frames provide error detection
using a cyclic redundancy check (CRC). This is error detection, not error correction. An example of a
typical Ethernet frame is shown below.
Ethernet at the Physical Layer
Every Ethernet cable has attenuation, which is defined as the loss of signal strength as it travels
further. Crosstalk is another vector of loss of quality and is caused by unwanted signal interference
from adjacent pairs in the cable.
The cabling is measured in categories. A higher quality cable will have a higher-rated category.
100Base-TX (IEEE 802.3u) is known as Fast Ethernet, uses category 5, 5E, or 6 UTP two-pair
wiring. It can run up to 100 meters long. It uses an RJ45 connector.
100Base-FX (IEEE 802.3u) uses fiber cabling 62.5/125-micron multimode fiber. It can run up to
412 meters long. It uses ST and SC connectors.
1000Base-CX (IEEE 802.3z) uses copper twisted-pair. It can run up to 25 meters. It uses a 9-pin
connector known as the High Speed Serial Data Connector (HSSDC).
1000Base-T (IEEE 802.3ab) is category 5, four-pair UTP wiring that can rup up to 100 meters and
offers speeds up to 1 Gbps.
1000Base-SX (IEEE 802.3z) is a fiber optic Gigabit Ethernet standard for operation over multi-
mode fiber using a 770 to 860 nanometer, near infrared (NIR) light wavelength. The standard
specifies a distance capability between 220 metres (62.5/125 m fiber with low modal bandwidth)
and 550 metres (50/125 m fiber with high modal bandwidth). Offers speeds up to 1 Gbps.
1000Base-LX (IEEE 802.3z) is single-mode fiber. It uses a 9-micron core and 1300 nm laser. It
can have maximum cable length between 3 km and 10 km.
1000Base-ZX (Cisco standard) is a Cisco standard for Gigabit Ethernet. It operates on single-mode
fiber-optic links and it can go up to 70 km.
10GBase-T (802.3.an) is standard for 10 Gbps connections over UTP cables. It uses RJ45
connector and can go up to 100 meters.
Ethernet cabling
Straight-through cable uses four wires. It is used to connect the following devices:
Router to switch or hub
Host to switch or hub
Crossover cable uses four wires too but wires are connected to different ends. Can be used to
connect the following devices:
Host to host
Router to host
Router to router
Switch to switch
Switch to hub
Hub to hub
Rolled cable uses eight wires. Rolled cable is used to connect host's EIA-TIA 232 interface to
router's or switch's console port.
Fiber Optic
Fiber optic is used for fast transmission of data, is made of glass or plastic, is thin. It works as a
waveguide to transmit light between two ends of the fiber. Fiber optics can go very long distances.
Its protected against interference like cross-talk. There are two types of fiber optics: single-mode
and multimode. Single-mode fiber optic cable allows only one mode of light to go through.
Multimode fiber optic cable allows multiple modes of light to go through.
Data encapsulation
When a data is being transmitted across a network, data goes through a process called
encapsulation and is encapsulated with protocol information at each layer of the OSI model.
Each layer uses protocol data units (PDUs) to communicate. PDU information is read only by the
peer layer on the receiving device. After reading PDU, it gets stripped off and handed to next layer.
The Core Layer is responsible for transporting large amounts of data. It is purpose is to switch
traffic as fast as possible. The Core Layer sees large volumes of data. Speed and latency are very
important in this layer.
The Distribution Layer is the communication point between the Access Layer and the Core Layer.
It is function is to provide routing and filtering. The Distribution Layer must determine fastest way
of handling a request.
The Access Layer controls user's access to internetwork. The access layer is also referred to as the
desktop layer. Network resources users need must be available locally because the Distribution
Layer will handle any request for remote services.
Chapter 2: TCP/IP and IP Addressing
TCP/IP
TCP/IP (Transmission Control Protocol/Internet Protocol) is the basic communication language
and protocol of the Internet. It can also be used as a communications protocol in a private network.
TCP/IP dictates how information should be packaged, sent, and received, as well as how to get to
its destination.
DoD Model
The DoD model is a condensed version of the OSI model that has four layers:
Process Layer or Application Layer
Host-to-Host Layer or Transport Layer
Internet Layer
Network Access Layer or Link Layer
Telnet allows a user on a remote client machine to access the resources of another machine, in
order to access a command-line interface. Telnet sends everything in clear text and doesn't use
encryption.
Secure Shell (SSH) is similar to Telnet in function but uses encrypted connection.
File Transfer Protocol (FTP) lets user transfer files between two machines. FTP can also do
directory operations. FTP requires authentication and is usually protected by username and
password.
Trivial File Transfer Protocol (TFTP) is simpler version of FTP. TFTP can only send and receive files,
it does not offer any directory functions.
Simple Network Management Protocol (SNMP) collects and manipulates network information.
Network management station (NMS) gathers information from network devices at fixed or random
intervals. In addition, network devices can inform the NMS station about the problems in the
network device as they occur.
Hypertext Transfer Protocol (HTTP) is used to manage communications between web browsers
and web servers.
Hypertext Transfer Protocol Secure (HTTPS) is a secure version of HTTP. It uses Secure Sockets
Layer (SSL).
Network Time Protocol (NTP) synchronizes clock of network devices and ensures that all devices
on a given network agree on the time.
Domain Name Service (DNS) resolves hostnames. DNS maintains a list of domain names and
translates them to IP addresses.
Dynamic Host Configuration Protocol (DHCP) assigns IP addresses to hosts. These are the
information DHCP server provides when the host is requesting an IP address from the DHCP
server: IP address, subnet mask, domain name, default gateway, DNS server address, WINS server
address. DHCP uses UDP at the Transport layer.
Client takes these steps to receive an IP address from a DHCP server:
1. The client broadcasts a DHCP Discover message at port 67 that looks for a DHCP server.
2. The DHCP server that received the Discover message sends a DHCP Offer message back to
the client.
3. The client then sends a DHCP Request message that asks for the offered IP address and
other information.
4. The server sends back DHCP Acknowledgment message to finalize the exchange.
Automatic Private IP Addressing (APIPA) Windows systems has a feature called Automatic Private
IP Addressing (APIPA). Clients can automatically self-configure an IP address and subnet mask with
APIPA - when a DHCP server isnt available. The IP address range for APIPA is 169.254.0.1 through
169.254.255.254. APIPA also configures client with a default Class B subnet mask of 255.255.0.0.
Port numbers
TCP and UDP uses port numbers to communicate with the upper layers, to keep track of the
different conversations crossing the network at the same time. Source port numbers are
dynamically assigned and are some number starting at 1024. Port numbers below 1023 are called
well-known port numbers.
Common port numbers:
The Internet Layer protocols
Common Internet Layer protocols are explained below.
Internet Protocol (IP) holds the big picture and is aware of all the interconnected networks. All
machines on the network have a logical address called an IP address. IP looks at each packets
logical address and uses routing table to decide where to send it next. IP receives segments from
the Host-to-Host layer and fragments them into datagrams. IP then reassembles datagrams back
into segments on the receiving host. Each datagram has source and destination address on it. Each
router makes a routing decision based on datagram's destination address. Image of IP header is
given below.
Internet Control Message Protocol (ICMP) works at the Network layer and has many uses. ICMP is
a management protocol and messaging service provider. Packet Internet Groper (Ping) uses ICMP
echo request and reply messages to check the connectivity of machines. Traceroute uses ICMP
Time-outs to determine the path data takes to reach the destination.
Address Resolution Protocol (ARP) finds the hardware address of a host from a known IP address.
When IP sends a datagram, it must uses a destinations hardware address on the local network. If IP
can't find the destination hosts hardware address in the ARP cache, it uses ARP to find the
destination hardware address. ARP sends out a broadcast asking the host with the specified IP
address to reply with it's hardware address. ARP basically translates the software/logical address
into a hardware address.
IP addressing
An IP address is an identifier assigned to each host on a network. An IP address is a software
address, not a hardware address (hardware address is hard-coded on a network interface card (NIC)
and is used for finding hosts on a local network). IP addressing is used to allow hosts on one
network to communicate with a host on a different network. An IPv4 address is 32 bits. These bits
are divided into four parts, referred to as octets, each containing 8 bits. IP address can be shown
using one of three methods:
Decimal: 10.20.5.15
Binary: 00001010.00010100.00000101.00001111
Hexadecimal: 0A.14.05.0F
Network address identifies each network. Every host on the same network shares that network
address. In the IP address 172.20.5.15, 172.20 is the network address.
Different node address is assigned to each host. This part of the address is unique because it
identifies a particular host. In IP address 172.20.5.15, the 5.15 specifies the node address.
Network classes are classification of network addresses based on network size.
Private IP addresses can be used on a private network, but theyre not routable through the
Internet. This is designed for the purpose of creating a measure of security, but it also saves IP
address space.
Classless Inter-Domain Routing (CIDR) is the method that Internet service providers use to
allocate addresses to their customers. They provide addresses in a certain block size using CIDR.
When you receive a block of addresses, it will have a slash notation like this: /29. This shows what
your subnet mask is. The slash notation means how many bits are turned to 1s. For example, a
Class A default subnet mask, which is 255.0.0.0, tells us that the 8 bit of the subnet mask is all 1s
(11111111). You need to count all the 1-bits to figure out your mask. The 255.0.0.0 is a /8 in slash
notation because it has 8 bits that are 1s. Table below lists every available subnet mask and
equivalent CIDR slash notation.
IP Subnet-Zero is command that allows you to use the first and last subnet in your network
design.
In example given above, we broke our network down to four subnets using VLSM. /30, /29, /28, /
27. Subnets will have 2 hosts, 6 hosts, 10 hosts, and 25 hosts respectively.
Summarization
Allows routing protocols to advertise many networks as one address. The main purpose of
summarization is to reduce the size of routing table on a router.
When you power up a Cisco IOS device, it will run a power-on self-test (POST). After POST, the
device will load the Cisco IOS from flash memory if an IOS file is present, then expand it into RAM.
Flash memory is electronically erasable programmable read-only memory (EEPROM). The next
step is to locate and load a configuration known as the startup-config that is usually stored in
nonvolatile RAM (NVRAM). After the IOS is loaded, the startup-config will be copied from NVRAM
into RAM and from then on known as the running-config. If a startup-config isnt found in NVRAM,
device will enter setup mode, which gives you step-by-step guide for setting up basic parameters.
Command-line interface
When you enter CLI, Switch> prompt will show up. This is called user exec mode, or user mode
and its mostly used to view statistics. Configuration of a Cisco device can be viewed and changed
while in privileged exec mode, and you can enter it by using the enable command like this:
Switch>enable
Switch#
The Switch# prompt means that you are in privileged mode where you can view and change the
device configuration.
You can go back to user mode by using the disable command:
Switch#disable
Switch>
You can use logout command from either mode to exit the console.
You can make global changes to the device by typing configure terminal or just config t.
This command gets you into global configuration mode where you can make changes to the
running-config.
Interfaces
Interface command is used to make changed to an interface
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#
Prompt has changed to Switch(config-if)#, this tells us that were in interface configuration
mode.
Adminsitrative configurations and commands
Hostname We use the hostname command to set the name of the device. Hostname is only
locally significant, it doesnt affect how the device performs name lookups or how the device works
on the internetwork.
Switch#config t
Switch(config)#hostname name
Banners Banners are little messages that show up when someone connects to your device. You
can create and customize them and give the users any information you wish them to have. Three
types of banners are: exec banner, login banner and message of the day banner. Message of the
day (MOTD) banners give a message to anyone connecting to the device via Telnet, auxiliary port
or through a console port. You can configure MOTD banner like this:
Switch(config)#banner motd message
Passwords There are five passwords that can be set on Cisco device: console, auxiliary, telnet,
enable password, and enable secret. The enable secret and enable password are used to secure
privileged mode. Once the enable commands are set, users will be prompted for a password when
they try to access privileged mode. Here's an example of setting up enable passwords:
Switch(config)#enable password password
Switch(config)#enable secret password
User-mode password are assigned via the line command like this:
Switch(config)#line console 0
Switch(config-line)#password password
Switch(config-line)#login
Telnet password are assigned via the line command like this:
Switch(config)#line vty 0 15
Switch(config-line)#password password
Switch(config-line)#login
Encrypting passwords
To manually encrypt your passwords, use the service password-encryption command. Heres how:
Router#config t
Router(config)#service password-encryption
do command
do command allows you to view the configuration and statistics from within configuration mode.
All you have to do is add do in front of command you want to execute.
Pipe command
You can use pipe to search through large amounts of output and filter output to exclude
information you do not need. These features can be used with show and more commands, which
generally display large amounts of data. Three examples of pipe command is given below:
Router#show any-command | begin regular-expression Shows output starting
from the first line that contains the regular expression.
Router#show any-command | exclude regular-expression Shows lines that don't
contain the regular expression.
Router#show any-command | include regular-expression Shows lines that
contain regular expression.
Boot sequence
1. When a Cisco device boots up, it performs boot sequence. Boot sequence is used to test the
hardware and load the software. The boot sequence is made of following steps: The device
performs a POST, which tests the hardware to verify that all parts of the device are operational.
POST is stored in and runs from read-only memory (ROM).
2. The bootstrap then locates and loads the Cisco IOS software. The IOS software is loaded
from flash memory by default. The default order of an IOS loading is: flash, TFTP server, ROM.
3. After that IOS software looks for a configuration file stored in NVRAM. This file is called
startup-config and will be there only if you have copied the running-config into NVRAM.
4. If a startup-config file is found in NVRAM, the device will copy it, place it in RAM, and name
the it the running-config. Device should now be operational. If no startup-config is found in
NVRAM, the device reacts by broadcasting out any interface that detects carrier detect (CD) to
locate a TFTP host in its search for a configuration. If that fails then the device will begin the setup
mode configuration process.
Heres how well configure DHCP using the 192.168.10.0/24 network ID:
Switch(config)#ip dhcp excluded-address 192.168.10.1 192.168.10.10
Switch(config)#ip dhcp pool pool_name
Switch(dhcp-config)#network 192.168.10.0 255.255.255.0
Switch(dhcp-config)#default-router 192.168.10.1
Switch(dhcp-config)#dns-server 4.4.4.4
DHCP Relay
If your DHCP server and DHCP clients aren't on the same LAN, you can configure your router
forward the DHCP client requests to DHCP server. Here's how we configure Fa0/1 interface of
router to forward the DHCP requests to DHCP server:
Router#config t
Router(config)#interface fa0/0
Router(config-if)#ip helper-address 10.10.10.254
LLDP is industry standard protocol that has the same functions of the CDP.
Routing basics
Routing means taking a packet from one device and sending it through the network to another
device on a different network. Routers use logical destination address of destination to choose best
path to route packet through.
Router must know these things to effectively route a packet:
Destination address
Neighbor routers from which it can learn about remote networks
Possible routes to all remote networks
The best route to each remote network
There are few ways router can learn about non directly connected networks. Static routing method
is about hand typing all routes into the router. Dynamic routing method is about using a specific
protocol that communicates with the same protocol on neighboring routers. Neighboring routers
running same dynamic routing protocol update each other about known networks. Dynamic
routing protocols update all routers when change occurs on the network.
Packet-forwarding techniques
Cisco uses three types of packet-forwarding techniques.
Process Switching This process looks up every destination in the routing table and finds the exit
interface for every packet. This process has high demand for router resources.
Fast Switching This process uses a cache to store the most recently used destinations, which gets
rid of need to look up routing table for every packet.
Cisco Express Forwarding (CEF) This process creates many different cache tables and is change
triggered, not packet triggered. When network topology changes, CEF caches change as well.
Static routing
Static routing is about adding routing information into routers manually.
Pros:
Adds security because you are only one who can add and remove entries.
Less need for router resources, CPU.
Minimizes bandwidth usage. Doesn't use bandwidth like dynamic routing protocols do for
updates.
Cons:
If a new network is added into the topology, manual changes have to be made at each
router.
You need accurate map of the network to be able to configure functional static routing.
Static routing can be configured like this:
ip route destination_network mask next-hop_address or exit_interface
administrative_distance permanent
This list describes each command in the string:
ip route - This command is used to create the static route.
destination_network - Specifies the network you want to place into routing table.
mask - Specified the subnet mask being used on the network.
next-hop_address - Specified the IP address of the next-hop router that will receive
packets destined to remote network and forward them. This must be a directly connected
router.
exit_interface - Can be used in place of next hop address.
administrative_distance -Static routes have an administrative distance of 1 (0 if
you use exit interface instead of next hop address). You can change the default
administrative distance by specifying it here. Information about administrative distance is
given later in this chapter.
permanent - Adding this tag to the end of command keeps the entry in routing table even
if interface is shut down or router can't communicate with next hop router.
Default route
If destination is not found in routing table then default route is used to forward the packet. It is also
knows as gateway of last resort.
This is how you configure a default route:
Router(config)#ip route 0.0.0.0 0.0.0.0 next-hop_address
Dynamic routing
When protocols are used for routing, this kind of routing is called dynamic routing. Dynamic
routing is easier to use than static routes but uses more router CPU and eats up some of the
bandwidth.
Two types of routing protocols are interior gateway protocols (IGPs) and exterior gateway protocols
(EGPs). Interior gateway protocols are used to exchange routing information with routers in the
same autonomous system. An autonomous system is either a single network or a collection of
networks under a common administrative domain, which means that all routers sharing the same
routing information are in the same autonomous system. Exterior gateway protocols are used to
communicate between autonomous systems. Example of IGPs are OSPF, RIP, EIGRP. Example of
EGP is BGP.
Administrative distances
The administrative distance rates the trustworthiness of routing information. An administrative
distance is a number from 0 to 255. 0 administrative distance means the most trusted and 255
means that this route will not be used. If a router receives two updates regarding same network,
one with lower administrative distance will be placed on routing table. If two or more advertised
routes to the same network have the same administrative distance, then routing protocol metric is
used to determine which route to use. Route with lowest metric will be placed into routing table. If
two routes have the same administrative distance as well as the same metrics, then the routing
protocol will load-balance to the remote network.
Default administrative distances that a Cisco router uses are given below.
Connected interface 0
Static route 1
EIGRP 90
OSPF 110
RIP 120
External EIGRP 170
Unknown 255 (This route will never be used.)
Routing protocols
There are three classes of routing protocols.
Distance vector These protocols judge distance to find best route to a given network. RIP protocol
uses hops to determine the best path. Each router in a way to destination is known as hop. Less
hops mean better route.
Link state Also known as shortest path first protocols. Routers create three separate tables when
using link state protocols. First table keeps track of directly connected neighbors, second table
determines the topology of the entire network, and the third one is used as the routing table. Link
state protocols keep more information about the network than distance vector protocol. OSPF is
example of link state protocol. These protocols send updates containing the state of their links to
all other directly connected routers. This information then is propagated to their neighbors.
Hybrid Hybrid protocols use aspects of both distance vector and link state protocols. EIGRP is
example of hybrid routing protocol.
RIP version 1 uses classful routing, which means that all devices in the network must use the same
subnet mask. RIP version 1 doesn't send subnet mask information in it's updates which means that
RIP version 1 is classful routing protocol. This also implies that all devices on the network must use
the same subnet mask. RIP version 2 does send subnet mask information in routing updates and
therefore is called classless routing protocol.
We usually dont want routing protocols to auto-summarize because its better to do that
manually. Both RIP and EIGRP auto-summarize by default. We can turn this feature off with no
auto-summary command.
Passive-interface
We dont want RIP network advertised everywhere on our LAN and WAN. We can use passive-
interface command to disable routing updates being sent on specific interfaces. This command
will prevent routing updates from being sent out of a specified interface but it still allows the
interface to receive updates. Heres an example of how to configure a passive-interface on the
Router's Fa0/1 interface:
Router#config t
Router(config)#router rip
Router(config-router)#passive-interface FastEthernet 0/1
OSPF Terminology
OSPF Terminology is given below.
Link Interface added to OSPF process is considered to be a link. This link will have up or down state
information associated with it and one or more IP addresses.
Router ID The router ID is an IP address that is used to identify the router. Cisco routers choose the
router ID by using the highest IP address of all loopback interfaces. If no loopback interface is
found, router will choose the highest IP address of all active physical interfaces. Router ID is
basically name of the router in the OSPF process.
Neighbor Neighbors are routers that have interface on common network. These configuration
options must be same for OSPF routers to form a neighborship:
Area ID
Stub area flag
Authentication password (if using one)
Hello and Dead intervals
Adjacency An adjacency is a relationship between two routers that allows the direct exchange of
route updates. OSPF will directly share routes only with neighbors that have also established
adjacencies. Not all neighbors become adjacent type of connection and configuration determines
that. Routers form adjacencies only with designated and backup designated routers in multi-access
networks. Routers form adjacencies with the router on the other end of the connection in point-to-
point and point-to-multipoint networks.
Designated router A designated router is elected whenever OSPF routers are connected to the
same broadcast network. It minimizes the number of adjacencies that need to be formed.
Elections are held based on a routers priority level. Router with highest priority becomes the
designated router and router ID is used as a tie-breaker. All routers on the network establish
adjacencies with the DR and the BDR.
Backup designated router A backup designated router is used as backup to designated router and
takes the role of designated router should it fail. Backup designated router receives all routing
updates from adjacent routers but doesn't send out LSA updates.
Hello protocol Hello protocol is used for dynamic neighbor discovery and maintaining neighbor
relationships. Hello packets are sent to multicast address of 224.0.0.5.
Neighborship database This database is a list of all routers from which Hello packets have been
received. Router ID and state information about each router are kept in the neighborship database.
Topological database This database contains information from all of the Link State Advertisement
packets that have been received for a given area. Information inside the topology database is used
as input into the Dijkstra algorithm that computes the shortest path to every network. Topological
database is updated and maintained with LSA packets.
Link State Advertisement A Link State Advertisement is a packet that contains link state and
routing information thats shared among routers. There are different types of LSA packets. A router
shares LSA packets only with established adjacencies.
Areas An area is a grouping of contiguous networks and routers. Router can be a member of more
than one area at a time, therefore area ID is associated with specific interfaces. Routers in the same
area has the same topology table. All areas have to connect to area 0 which is also called a
backbone area. Areas play a big role in establishing hierarchical network design.
OSPF metrics
OSPF's metric is called a cost. The cost of the entire path is the sum of the costs of the outgoing
interfaces along the path. Cisco calculates the cost by using an equation of reference/bandwidth,
where bandwidth is the configured bandwidth for the interface. Reference is 100 by default but
this value can be changed.
int loopback x Creates loopback interface. Can be used to specify OSPF router ID.
network ip_address wildcard_mask area x Add specified network to OSPF area x.
show ip ospf Displays OSPF information for all OSPF processes running on the device.
show ip ospf interface Reveals all interface related OSPF information.
show ip ospf database Gives information about number of routers in AS and neighboring
router's ID.
show ip ospf neighbor Shows information regarding neighbors and adjacency states.
show ip protocols Shows information about all currently running protocols.
Chapter 6: Switching
Heres a list of four important advantages we gain when using Layer 2 switching:
Hardware-based bridging (ASICs)
Wire speed
Low latency
Low cost
No modification to data packet takes place and that's why Layer 2 switches are efficient. There are
three functions of layer 2 switching: address learning, forward/filter decisions, and loop avoidance.
Address learning Switches record the source hardware address of each frame received on an
interface and enter this information into a MAC table.
Forward/filter decisions When a frame is received, the switch looks for destination address in MAC
table and chooses appropriate exit interface.
Loop avoidance If multiple connections between switches are created for redundancy purposes,
network loops can occur. Spanning Tree Protocol (STP) is used to prevent network loops while still
permitting redundancy.
When the switch receives a frame, it places the frames source address in the MAC table which
allows it to refer to the precise interface the sending device is located on. Switch then floods this
frame out all ports except the one that it was received on, if the destination address is not found in
the MAC table. If a destination device answers this flooded frame and sends a frame back, then the
switch takes the source address from that frame and places that MAC address in it's MAC table. If
destination address is found in MAC table then switch doesn't flood this frame out all ports, it
simply sends it out the port associated with the destination address.
Picture below shows how switches learn hosts' locations.
Port security
You can limit the number of MAC addresses that can be assigned dynamically to a port, set static
MAC addresses, and set penalties when given policy is abused. This process is known as port
security. There are three types of actions switch can take when port security is violated: shutdown,
protect, restrict.
Shutdown Shutdown mode shuts interface down and puts it into err-disabled state when
configured policy is broken.
Protect Protect modes drops the traffic received from MAC address that violates the policy.
Restrict Restrict mode is same as protect mode but it also generates notification messages when
policy is broken.
If you want to set up a switch port to allow only one host per port and make sure the port will shut
down if this rule is violated, use the following commands:
Switch(config-if)#switchport port-security maximum 1
Switch(config-if)#switchport port-security violation shutdown
Sticky command With the sticky command you can provide MAC address security without
having to type in all MAC address on the network. In the example given below the first two MAC
addresses coming into the port stick to it as static addresses and will be placed in the running-
config, but when a third address tries to connect, the port will shut down.
Switch(config-if)#switchport port-security mac-address sticky
Switch(config-if)#switchport port-security maximum 2
Switch(config-if)#switchport port-security violation shutdown
VLAN basics
VLAN is a logical grouping of hosts and network resources. When you create VLANs, you can assign
different ports of switch to different VLANs and create a smaller broadcast domains. A VLAN is its
own subnet and broadcast domain, and broadcast frames are only switched between the ports
grouped within the same VLAN.
By default, hosts in different VLANs can't communicate with each other. To make interVLAN
communication possible, you need either a router to route between VLANs or a layer 3 switch.
There are two types of switch ports, access ports and trunk ports.
Access ports An access port is port that belongs to single VLAN. They carry traffic for one VLAN
only. Traffic is sent and received without any VLAN tagging information. Traffic arriving to access
port is considered to belong to VLAN that is port is assigned to. Devices that are attached to an
access port is not aware of their VLAN membership, they just assume to be part of some broadcast
domain.
Voice access ports Most current switches will allow you to add a second VLAN to an access port for
voice traffic. With voice access ports you can have both your PC and IP phone plugged into a single
switch port.
Trunk ports Trunk ports carry traffic for multiple VLANs. They can carry traffic for VLANs 1 through
4094. You have to use extended VLANs if you want your trunk ports to carry traffic for VLANs
above number 1001. Cisco devices have a proprietary protocol called Dynamic Trunk Protocol
(DTP). DTP checks if switch is compatible with connected switch to start a trunk port, if they are
compatible then trunk port will be configured automatically.
Configuring VLANs
We can use commands below to create 2 VLANs and name them.
Switch(config)#vlan 2
Switch(config-vlan)#name Sales
Switch(config-vlan)#vlan 3
Switch(config-vlan)#name Marketing
Inter-Switch Link (ISL) ISL tags VLAN information into Ethernet frame. ISL encapsulates the entire
frame to add in VLAN information. It allows switch to identify VLAN membership of received
frame.
802.1q Unlike ISL, 802.1q only inserts the VLAN field into frame instead of encapsulating whole
frame. You have to use 802.1q if you are trunking between Cisco switch and switch of some other
vendor.
Access lists
An access list is a list of conditions that categorize packets. Access lists are most commonly used to
filter unwanted packets and implementing security policies. You can configure access list to allow
certain hosts to reach the server but block the certain group.
Packet follows three rules when being compared against an access list:
The packet is compared with each line of the access list in sequential order.
The packet is compared only until a match is made. Once a packet matches a condition, it is
acted upon. No more lines are checked.
There is an implicit deny at the end of each access list. If packet doesn't match any line
then it will match last line and get denied.
Standard access lists These access lists don't distinguish between protocols and make decision
based only on source address. Destination address or packet type is not checked with standard
access lists. With standard access lists, you can deny or permit the packet only based on it's source.
Extended access lists Extended access lists can evaluate many more fields of the packet. They can
filter based on source address, destination address, protocol and port number.
Named access lists Named access lists are either standard or extended and not a distinct type.
They are functionally same with standard or extended access lists but only difference is the fact
that you can give them a name instead of using just a number to refer to it.
Access lists don't do anything after creation unless they are applied. For packet filtering, you need
to apply the access list to an interface. When access list is being applied you have to specify which
direction you are applying it for. When an access list is applied as inbound, packets are filtered
when they are received on an interface. When an access list is applied as outbound, packets are
filtered when they are being sent out of an interface.
Standard access lists
Standard access lists filter the traffic based on source address only. Standard access list can be
created by giving it number identifier of 199 or number in the expanded range of 13001999.
If we want to allow 192.168.10.0 network to the Internet but not allow access to 192.168.20.2 host,
we need to create a standard access list and apply it to Fa0/1 interface of router as an outbound
access list. Here's how it's done:
Router(config)#access-list 10 deny host 192.168.10.0 0.0.0.255
Router(config)#access-list 10 permit any
Router(config)#interface fastEthernet 0/1
Router(config-if)#access-group 10 out
0.0.0.255 at the end of access-list command is a wildcard mask. They can be called an inverse
subnet mask. Wildcard mask indicates which parts of IP address are available for examination. 0s in
first three octets means that, three first octets of IP address have to match exactly 192.168.10. 255
in last octet means that last octet of IP address can be anything from 0 to 255.
We used permit any as the last line of the access list to permit other traffic to pass through. If we
didn't configure this line then all other traffic would match the implicit deny at the end of the
access list and get discarded.
Extended access lists
Extended access lists can filter traffic based on source address, destination address, protocol and
port number. Extended access list number range is from 100 to 199 and expanded range of
extended access lists is 2000-2699.
In situation above we have to deny FTP traffic from 192.168.10.0/24 network to 192.168.20.2 node
and deny Telnet traffic from 192.168.30.0/24 network to 192.168.20.2 node. Here's how it can be
done:
Router(config)#access-list 110 deny tcp 192.168.10.0 0.0.0.255
192.168.20.2 0.0.0.0 eq 21
Router(config)#access-list 110 deny tcp 192.168.30.0 0.0.0.255
192.168.20.2 0.0.0.0 eq 23
Router(config)#access-list 110 permit ip any any
Router(config)#interface fastEthernet 0/1
Router(config-if)#access-group 10 out
Static NAT This type of NAT is for one-to-one mapping between local and global addresses. You
need one global Internet address for each private host when using static NAT.
Dynamic NAT Dynamic NAT allows you to map a private IP address to a global IP address from a
pool of registered IP addresses. You dont have to statically configure mapping when using
dynamic NAT.
PAT (Port Address Translation) or overloading Most commonly used type of NAT today is PAT.
PAT is type of dynamic NAT that allows multiple private hosts to use single global address to get
access to the Internet. Traffic is separated using unique port number for each connection.
NAT configuration
Static NAT and PAT configuration is given below.
PAT configuration
We can use these commands to configure a PAT:
Router(config)#access-list 1 permit 10.10.2.0 0.0.0.255
Router(config)#ip nat pool pool_name 98.120.5.1 98.120.5.1 netmask
255.255.255.0
Router(config)#ip nat inside source list 1 pool pool_name overload
Router(config)#interface fastEthernet 0/1
Router(config-if)#ip nat inside
Router(config-if)#interface Serial 0/1
Router(config-if)#ip nat outside
IPv6 basics
Advantage of IPv6 over IPv4 is the fact that it gives us a lot of addresses (3.4x1038) compared to
IPv6 4.3 billion addresses. IPv6 has host of new features as well. IPv6 is 128 bits long.
Shortened expression
There are two of ways of shortening IPv6 address:
1. You can drop any leading zeros in each of the individual blocks.
2. You can replace whole section of all 0s with double colon. You can't replace more than one
contiguous block of 0s with double colon.
Address types
IPv6 has three address types. Also notice that broadcast is removed from IPv6.
Multicast Multicast packets are sent from one node to a group of nodes. Also called one-to-many.
Anycast Anycast is called one-to-any. Anycast packets are sent to nearest host with the
destination IP address. Many nodes can share a same address and each receive anycast packets
from nearest clients.
Header
IPv6 header is shorter and much more efficient than IPv4 header. Picture of IPv6 header is given
below.
Special addresses
List of special addresses are given below.
0:0:0:0:0:0:0:0 or simply :: This is the equivalent of IPv4s 0.0.0.0 and is typically the source
address of a host before the host receives an IP address from DHCP server.
0:0:0:0:0:0:0:1 or simply ::1 The equivalent of 127.0.0.1 in IPv4.
0:0:0:0:0:0:192.168.100.1 This is how an IPv4 address is written in a mixed IPv6/IPv4 network.
2000::/3 The global unicast address range.
FC00::/7 The unique local unicast range.
FE80::/10 The link-local unicast range.
FF00::/8 The multicast range.
3FFF:FFFF::/32 Reserved for examples and documentation.
2001:0DB8::/32 Also reserved for examples and documentation.
2002::/16 Used with 6-to-4 tunneling, which is an IPv4-to-IPv6 transition system. The structure
allows IPv6 packets to be transmitted over an IPv4 network without the need to configure explicit
tunnels.
Address assignment
There are three ways of assigning IPv6 address to an interface.
Manual address assignment You can configure IPv6 address on interface manually like this:
Router(config-if)#ipv6 address ip_address
IPv6 protocols
Neighbor Discovery (NDP) ARP has been renamed to NDP in IPv6. Function of NDP remains the
same.
OSPFv3 IPv6 version of OSPF is called OSPFv3. All functions of OSPF remain, including the 32 bit
router ID and therefore you have to assign a router ID manually to the router because IPv6 address
is 128 bits and can't be used as a router ID. Here's an example of assigning router ID of
10.10.10.10 to the OSPF process:
Router(config)#ipv6 router osfp 10
Router(config-rtr)#router-id 10.10.10.10
Another thing that changed is the fact that you can't use network command to enable OSPF
process on interfaces anymore. You have to enable interfaces into OSPF process by using this
command under interface configuration mode (This command sets interface to OSPF area 0
under process of 10):
Router(config-if)#ipv6 ospf 10 area 0
List of useful commands
Router(config)#ipv6 unicast-routing Turns on IPv6 features of a router.
Router#ping ipv6 ip_address Pings specified IPv6 address.
Router#show ipv6 interface brief Shows brief information about interfaces and IPv6
information associated with them.
Router#show ipv6 route Shows IPv6 routing table.
Router#show ipv6 protocols Shows layer 1, layer 2 and IPv6 information of interfaces.