Integrating Cisco Press Resources into the Academy Classroom

advertisement
Routers and Routing Basics CCNA 2
Chapter 4
www.ciscopress.com
1
Learning About Other Devices
Discovering Neighbors Using CDP
CDP Protocol Operations
Information Learned by CDP
Configuring and Verifying CDP Operations
Creating a Network Map Using CDP Information
Additional CDP Verification and Troubleshooting Commands
Getting Information and Troubleshooting Devices
Verifying Which Networking Layers Are Working
Telnet Basics
Advanced Telnet
Cisco IOS ping and traceroute Commands
Summary
www.ciscopress.com
2
Neighbor Discovery Tools
The chapter focuses on four Cisco IOS tools that help you
learn information about other routers and switches
 Cisco Discovery Protocol (CDP) allows a user to learn
information about neighboring devices
 The telnet command allows a user to telnet to another
router or switch
 The ping and traceroute commands supply more
information about other networking devices and help
troubleshoot problems in an internetwork
www.ciscopress.com
3
Neighbor Discovery Tools
on the OSI Model
www.ciscopress.com
4
Discovering Neighbors Using CDP
Routers, switches, and other Cisco devices can use the
Cisco Discovery Protocol (CDP) to dynamically discover
information about neighboring devices
 CDP is a Cisco-proprietary protocol
 CDP discovers information about neighboring devices
 CDP defines protocol messages that flow between
neighboring devices to discover the information.
www.ciscopress.com
5
Internetwork with Three Routers
and Two Switches
R2 can discover information about R1 and SW2, but not
about SW1 or R4
www.ciscopress.com
6
Internetwork with Three Routers
and Two Switches (Continued)
Basic CDP Information on R2
The show cdp neighbors command lists a single line of
output per neighboring device with a lot of information.
www.ciscopress.com
7
CDP Protocol Operations
 A router discovers information using CDP by listening for
CDP advertisements sent by neighboring devices.
 The advertisements list information about the
neighboring device sending the advertisement.
 The advertisements include a series of Type Length
Value (TLV) data structures - information, such as the
hostname, the device model number, or the interface out
which the advertisement was sent.
www.ciscopress.com
8
CDP Advertisements with TLVs
 By default, all the routers and switches would send periodic CDP
advertisements, but the figure focuses just on the CDP advertisements
sent by R1 and SW2.
 CDP encapsulates its messages inside data-link headers and trailers,
without relying on any Layer 3 protocols.
www.ciscopress.com
9
CDP Advertisements with TLVs
 The data link layer protocol must support the use
of a Subnetwork Access Protocol (SNAP) header.
 By not using IP or any other Layer 3 protocol,
CDP can work ever if IP does not.
 SNAP is supported by most data link protocols
including Ethernet, HDLC, PPP and Frame Relay)
www.ciscopress.com
9
CDP Versions 1 and 2
 The CDP protocol has two versions, depending on the IOS
version.
 On routers, CDP version 1 has been supported for a long
time, beginning with IOS Version 10.3, which came out in
the mid-1990s.
 CDP version 2 has been supported since the introduction
of IOS 12.0T versions, which were released around 2000.
 It supports three new TLVs
 CDP versions 1 and 2 are backward-compatible.
www.ciscopress.com
10
Types of information learned by CDP
 Device ID (name of the device)
 Local Interface (the local device’s interface or port)
 Holdtime (the time before the device will remove this CDP
entry unless another CDP message refreshes the
information)
 Capability (functions supported on the device)
www.ciscopress.com
11
Types of information learned by CDP
(Continued)
 Platform (model series number of the device)
 Port ID (interface or port number information)
 VTP Management Domain Name (CDP version 2 only)
 Native VLAN (CDP version 2 only)
 Full/Half Duplex (CDP version 2 only)
www.ciscopress.com
12
CDP Timers
 The CDP specifications define two important timers:
– CDP update interval
– CDP holdtime
 Devices are required to send advertisements on a regular, periodic time
cycle, called the CDP update interval (default 60 sec.)
 The CDP holdtime defines how long the information in an
advertisement should be considered valid. When a device receives
another CDP advertisement, the holdtime timer is refreshed.
 When a device fails, the neighbor ceases to receive advertisements, and
the holdtime defines how long the information is retained.
www.ciscopress.com
13
CDP Update Interval and Holdtime
1. R1 sends the first CDP
advertisement, which states a
(default) holdtime of 180 seconds.
2. R2 receives the CDP advertisement,
believes the information, and sets
its holdtime for to 180 seconds.
3. R2 counts down from 180 seconds
toward 120 seconds.
4. R1 sends next CDP advertisement
60 seconds after the first one.
5. R2 receives the CDP advertisement
and resets its holdtime to 180.
6. The serial link fails.
7. R2’s holdtime eventually counts
down to 0 and R2 discards its CDP
information about R1.
www.ciscopress.com
14
Information Learned by CDP
The show cdp Commands
That List Information About Neighbors
www.ciscopress.com
15
Information Learned by CDP
(Continued)
The show cdp neighbors detail Command
www.ciscopress.com
16
Information Learned by CDP
(Continued)
The show cdp neighbors detail Command (Continued)
www.ciscopress.com
17
Information Learned by CDP
(Continued)
The show cdp entry Command
www.ciscopress.com
18
Configuring and Verifying CDP
Operations
 By default, Cisco routers and switches have CDP
enabled on every interface.
 Administrators can disable CDP on a per-interface basis,
or they can disable CDP globally (CDP is disabled on all
interfaces).
 It is useful to know how to verify whether CDP is enabled
globally and, if so, on which interfaces it is enabled.
www.ciscopress.com
19
Commands Used to Verify CDP
Operations
www.ciscopress.com
20
How to enable and disable CDP
in a Cisco router
 To globally enable CDP, use the cdp run global
configuration command.
 To globally disable CDP, use the no cdp run global
configuration command.
 To enable CDP on an interface, use the cdp enable
interface subcommand.
 To disable CDP on an interface, use the no cdp enable
interface subcommand
www.ciscopress.com
21
Verifying, Disabling, and Enabling CDP
1.
Several show
commands on R1
verify that, by
default, CDP is
enabled globally
and on each
interface.
2. CDP is then disabled
on interface S0/0,
which is
connected to R2,
using the no cdp
enable interface
subcommand.
www.ciscopress.com
22
Verifying, Disabling, and Enabling CDP
(Continued)
3. The show cdp
interface
command shows
that CDP is
enabled.
4. CDP is disabled
globally using the
no cdp run global
command.
5. The show
commands
confirm that CDP
is disabled globally
and that the traffic
counters are not
displayed.
www.ciscopress.com
24
Verifying, Disabling, and Enabling CDP
(Continued)
6. CDP is then enabled
globally and reenabled on interface
S0/0.
7. The show cdp traffic
command shows
statistics, but the
counters were not
reset to 0 when CDP
was globally
disabled.
8. The clear cdp
counters command
is used to reset the
counters.
www.ciscopress.com
(See comments on the next slide)
25
Verifying, Disabling, and Enabling CDP
(Continued)
9. The show cdp traffic
command’s counters
now show low
numbers, but they
show only global
counters, not perinterface counters.
10. To verify that CDP
messages are being
sent and received on
each interface, the
debug cdp packet
command is used.
www.ciscopress.com
27
Using CDP to Construct
a Network Map
www.ciscopress.com
29
Using CDP to Construct
a Network Map (Continued)
www.ciscopress.com
30
Using CDP to Construct
a Network Map (Continued)
www.ciscopress.com
31
Using CDP to Construct
a Network Map (Continued)
www.ciscopress.com
32
Additional CDP Verification and
Troubleshooting Commands
www.ciscopress.com
33
Getting Information and
Troubleshooting Remote Devices
Although CDP does provide some convenient and useful
information about other devices, the telnet, ping, and
traceroute provide vital information about an internetwork:
 The telnet command allows the user to connect to other
routers and switches and issue commands on the remote
devices, learning about the devices’ configuration and
current operations.
 The ping and traceroute IOS EXEC commands enable
an to test Layer 3 by verifying whether IP packets can be
delivered in an internetwork, and determine the route
used by those packets.
www.ciscopress.com
34
OSI Layers Tested by Various
IOS Tools
Each tool focuses on one layer of the OSI model, while each
can be used to prove whether multiple layers are working.
 Ping focuses on Layer 3, but really tests OSI Layers 1
through 3, because although IP and IP routing are Layer 3
functions, IP cannot deliver packets unless Layers 1 & 2 are functional.
 Telnet tests all seven layers of the OSI model because it focuses on
the application layer, and the application layer cannot work unless the
rest of the layers below it are working.
 When a router is receiving CDP advertisements on an interface, it
indicates that the underlying Layer 1 and Layer 2 functions of that
interface are working.
www.ciscopress.com
35
OSI Layers Tested by Various
IOS Tools (Continued)
www.ciscopress.com
36
Telnet Basics
Telnet Client/Server Operation
www.ciscopress.com
37
Cisco IOS telnet Command
 Telnet allows a user to gain access to the CLI of a remote device.
 The telnet {hostname | address} command connects a CLI user to the
host at the IP address or hostname listed in the command. If a
hostname is used, IOS first resolves the name into an IP Address.
 The connect {hostname | address} command can be used as an
alternative to telnet. Beyond that, just by entering an IP address or
hostname on the command line in EXEC mode—without either the
telnet or connect command in front of it—IOS assumes that the user
wants to telnet to that name or address.
 Two alternatives exist for terminating the Telnet connection:
exit and logout commands.
www.ciscopress.com
38
Telnet from R1 to R2
www.ciscopress.com
39
Basic Telnet Troubleshooting
Although a Telnet connection to a router or switch can fail
for many reasons, three of the reasons are relatively common:
 IP routing is not working between the two devices.
 Name resolution is not working on the router at which the
telnet command is use (this condition occurs only when the
telnet command refers to a hostname).
 The router being telnetted to (the Telnet server) does not
have its vty password configured.
www.ciscopress.com
40
Issues with the Default Name
Resolution Method
If command in EXEC mode is not recognized by IOS as a
valid command, IOS assumes you want to telnet to a host
of that name.
By default, here is what happens when a user simply
mistypes a command, something as simple as typing shw
interfaces instead of show interfaces:
1. IOS does not recognize the command (in this
example, shw).
2. IOS tries to telnet to that name. The first step is to
resolve the name (shw) into an IP address.
www.ciscopress.com
41
Issues with the Default Name
Resolution Method (Continued)
3. IOS broadcasts DNS resolution requests on all interfaces,
looking for a DNS server to resolve the name.
4. Assuming no DNS servers hear the request, the user waits
30 to 40 seconds for IOS to finally time out its DNS request,
during which time the user cannot enter any other
commands!
To solve the problem in a lab, just add the no ip domainlookup global configuration command to the routers’
configurations, and IOS will no longer attempt to broadcast to
find a DNS, and the mistyped commands will fail immediately.
www.ciscopress.com
42
Suspending and Switching Between
Telnet Connections
Suspending a Telnet connection means that the user does
not close or terminate the Telnet connection, but instead,
the Telnet connection is temporarily “set aside”.
By suspending a Telnet connection, the user can switch
back and forth between router command prompts very
quickly and easily.
Pay close attention to the command prompts.
www.ciscopress.com
43
Suspending and Resuming a Telnet
Connection
Step 1 The user at R1
telnets into R2, logs
in, and gets into
enable mode.
Step 2 The user enters a
command on R2, just
to emphasize which
router the user is
using.
Step 3 The user
suspends the Telnet
connection, giving
the user a command
prompt back on R1.
www.ciscopress.com
44
Suspending and Resuming a Telnet
Connection (Continued)
Step 4 The user issues a
command on R1,
again to emphasize
which router the user
is using.
Step 5 The user resumes
the suspended Telnet
connection using the
resume 1 command.
Step 6 The user issues a
command on R2
again, just to
emphasize which
router the user is
using.
www.ciscopress.com
46
Switching Between Multiple Telnet
Connections
By creating, suspending, and resuming multiple Telnet
connections, a user can easily switch between the CLIs of
multiple routers.
IOS uses the following logic when there is at least one
Suspended Telnet connection:
 If the resume session-number command is used, IOS
resumes the suspended Telnet connection identified by
the session number.
(Continued)
www.ciscopress.com
48
Switching Between Multiple Telnet
Connections (Continued)
 If the resume command is used, without a session
number, IOS resumes the most recently suspended
Telnet connection.
 If a single number is entered on the command line, and
there is a suspended Telnet connection using that same
number, IOS resumes that Telnet connection.
 If the user presses the Enter key when the command line
has no text on it, IOS assumes that the user wants to
resume the most recently suspended Telnet connection,
and IOS resumes that Telnet connection.
www.ciscopress.com
49
Suspending and Resuming a Telnet
Connection
Step 1 The user telnets from
R1 to R2.
Step 2 The user suspends the
Telnet connection, moving
back to R1.
Step 3 The user telnets from
R1 to R4.
Step 4 The user suspends the
Telnet connection, moving
back to R1 again.
Step 5 At R1, the user issues
the show sessions
command, which lists both
suspended Telnet
connections.
www.ciscopress.com
50
Suspending and Resuming a Telnet
Connection (Continued)
Step 6 The user resumes the Telnet
connection to R4 by using the
resume command, without a
session number.
Step 7 The user suspends the
Telnet connection, moving back
to R1
again.
Step 8 The user resumes the Telnet
connection to R2 by using the 1
command, which simply
identifies the session number
for the
Telnet connection to R2.
Step 9 The user suspends the
Telnet connection, moving back
to R1
again.
Step 10 At the R1 command
prompt, the user simply
presses Enter,
resuming the last-suspended
Telnet connection (R2).
www.ciscopress.com
52
Number of Concurrent Telnets
There are three methods to restrict the number of Telnet
connections into a router:
 The first method prevents all Telnets into a router by simply not
configuring a Telnet password. To disable Telnet access to a router,
simply do not configure vty passwords.
 The second restriction relates to the maximum number of vty lines
supported by IOS.
 The third way to limit Telnet connections is to configure a limit. The
engineer can configure the maximum number of concurrent Telnet
connections into a router by configuring the session limit number
command in vty line configuration mode.
www.ciscopress.com
54
Cisco IOS ping Command
 The IOS ping command sends a series of ICMP echo
request messages (default five messages) to another
host.
 TCP/IP host that receives an ICMP echo request should
reply with an aptly named ICMP echo reply message.
 If the ping command sends some number of echo
requests and gets a reply to each request, the route to
reach the remote host and back is working well.
www.ciscopress.com
55
Cisco IOS ping Command
(Continued)
 The IOS ping command tests whether packets can be
routed to the remote host, as well as the time for the
echo packet to go to the remote host, and the reply to
come back.
 The ping command gives some sense of the amount of
packet loss happening over a route, because the
command states how many of the echo reply messages
were received correctly.
 There are three types of information provided by the
ping command.
www.ciscopress.com
56
The ping Command on Router R1





The output of the ping command says that it is sending five 100-byte-long ICMP echo messages.
The output shows five exclamation points, each of which means that the ping command received five
reply messages from 172.16.2.254.
The last line of output states that the command was 100 percent successful, going five for five.
The ping command notices the round-trip time, which is the time between when the echo request is
sent and the corresponding echo reply is received.
The ping command then lists the smallest, average, and largest round-trip time.
www.ciscopress.com
57
Cisco IOS traceroute Command
 The traceroute command tests whether the IP route to
another host works and it also identifies the routers in
the route.
 The traceroute command begins by sending a few
packets (typically three) to the destination address listed
in the command, but these packets have a Time to Live
(TTL) field in the IP header set to 1.
 Routers decrement the TTL field by 1 when forwarding a
packet, but if the router decrements a packet’s TTL to 0,
the router discards the packet.
 The first router that gets these three packets,
discards the packets.
www.ciscopress.com
59
Cisco IOS traceroute Command
(Continued)
The following occurs due to the traceroute command:
1. R1 sends three packets, source 172.16.4.251, destination 172.16.2.254, with TTL=1.
2. R2 receives the packets, decrements the TTL to 0, and discards the packets.
3. R2 also sends an ICMP TTL Exceeded message back to 172.16.4.251 (R1) for each
discarded packet.
4. The traceroute command on R1, upon seeing that all the ICMP TTL Exceeded messages
came from the same IP address (172.16.4.252), now knows that 271.16.4.252 is the first
router in the route to reach the destination. So, the traceroute command lists
172.16.4.252 as the first router in the route.
www.ciscopress.com
60
Summary
 Cisco routers, switches, and other Cisco devices use CDP to obtain
information about directly connected Cisco devices. The information
includes the router interfaces on the local and neighboring devices,
the model number and software version of the neighboring device,
and the Layer 3 addresses if configured.
 The IOS telnet or connect commands allow to remotely access
another device.
 The hostname or IP address can be entered on the command line
without the telnet or connect command.
 The ping command determines whether a working route exists,
determines the round-trip time for packets to go to the remote host
and back.
 The traceroute command tests the same general features as ping,
with the added benefit that it lists the routers at each hop of the
route to the destination.
www.ciscopress.com
62
Download