Image
 
linkedin_logo.png rss_logo.jpg
twitter_logo.png youtube_logo.jpg
Latest Additions
 
EH-Net Login
Welcome Guest.






Lost Password?
No account yet? Register
Who's Online
We have 22 guests online
 
Advertisement

You are here:
EH-Net
May 25, 2013, 10:17:58 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Go back to The Ethical Hacker Network Online Magazine Home Page
 
   Home   Help Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Packet Capture on Cisco Router  (Read 5361 times)
0 Members and 1 Guest are viewing this topic.
yatz
Full Member
***
Offline Offline

Posts: 222


View Profile WWW
« on: February 03, 2012, 09:59:32 AM »

Hey all, this is a neat trick I found and used to assist some network troubleshooting at a remote site earlier this week and thought I'd share.

Starting in IOS version 12.4T, the packet capture feature was added to Cisco Routers.  I haven't seen this work on switches, but if you can get access to a router you actually have more power since you'll have access to two networks rather than one.


First, let's look at a basic "capture all" configuration.

From privileged exec mode:
 ! create a capture buffer
 monitor capture buffer CAP_BUFFER circular
 
! create a capture point used for filling the buffer, all interfaces, both directions
 monitor capture point ip cef CAP_POINT all both
 
 ! tie the capture point to the buffer
 monitor capture point associate CAP_POINT CAP_BUFFER

 ! start the capture
 monitor capture point start CAP_POINT

 ! wait.....

 ! stop the capture
 monitor capture point stop CAP_POINT

 ! save the buffer to a file
 monitor capture buffer CAP_BUFFER export flash:/capture.pcap


Now it's just a matter of copying the pcap file off the router, which is easily accomplished with scp:
 ! enable scp server
 configure terminal
  ip scp server enable

 ! use scp tool included with PuTTY suite (windows)
 pscp -scp <user>@<router_ip>:/capture.pcap .\capture.pcap

 ! disable scp server
  no ip scp server enable


Pretty cool?  Second, we can also limit our capture filter based on an access-list.

 ! create access list
 configure terminal
  ip access-list extended CAPUTRE_LIST
   permit ip host <source_ip> any
   end
 
 ! create a capture buffer
 monitor capture buffer CAP_BUFFER circular

 ! apply the capture filter to the buffer
 monitor capture buffer CAP_BUFFER filter access-list CAPTURE_LIST
 
 ! create a capture point used for filling the buffer, all interfaces, both directions
 monitor capture point ip cef CAP_POINT all both
 
 ! tie the capture point to the buffer
 monitor capture point associate CAP_POINT CAP_BUFFER

 ! start the capture
 monitor capture point start CAP_POINT

 ! wait.....

 ! stop the capture
 monitor capture point stop CAP_POINT

 ! save the buffer to a file
 monitor capture buffer CAP_BUFFER export flash:/capture.pcap


Copy the file off the router and you're done!

Anyway, I thought this was pretty cool, didn't know it was possible until this week.  I can imagine using this to not only sniff cleartext passwords from telnet, but also VoIP... HTTP... all from a router that is typically not looked at every day.
Logged

"Live as though you would die tomorrow, learn as though you would live forever."

CCNA, MCSA, MCTS, Sec+, Net+, Linux+, CEH
3xban
Hero Member
*****
Offline Offline

Posts: 608


View Profile WWW
« Reply #1 on: February 03, 2012, 11:15:19 AM »

Nice writeup and decent feature Yatz!  Thanks!
Logged

Certs: GCWN
(@)Dewser
kerpap
Newbie
*
Offline Offline

Posts: 8



View Profile
« Reply #2 on: February 15, 2012, 10:28:41 PM »

for a cisco switch you can configure one of the ports to be a switch port analyzer.
(SPAN)
this is used for IDS alliances to monitor traffic.
all you need to do is plug your laptop into the SPAN port and turn on wire shark.

most switches use the same command. here I did it on a 6509 switch:

Router(config)#monitor session 1 source interface g1/1 - 48 both
Router(config)#monitor session 1 destination int g2/1

as you can see I am monitoring the range G1/1 - 48 and sending the traffic to port g2/1
"both" indicates that I want to monitor both sent and received packets.
Logged
knwminus
Full Member
***
Offline Offline

Posts: 100



View Profile WWW
« Reply #3 on: February 22, 2012, 09:56:57 AM »

Nice writeup. Good to see new features being added on the IOS. I am going to try this out today.
Logged

A+ N+ CCNA CCNA:S CNSS 4011 Security+

Next Up: CCNP CCNP:S
yatz
Full Member
***
Offline Offline

Posts: 222


View Profile WWW
« Reply #4 on: February 22, 2012, 10:19:08 AM »

One thing to add that I discovered later on - By default, the packets are truncated at 68 bytes (anyone know why 68 is the default???).

To increase this and get full packets, use the following command:
 monitor capture buffer CAP_BUFFER max-size 1500
Logged

"Live as though you would die tomorrow, learn as though you would live forever."

CCNA, MCSA, MCTS, Sec+, Net+, Linux+, CEH
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Page created in 0.052 seconds with 22 queries.
 
Exclusive Deal

sansfire13_245x90_cw90.jpg
SANSFIRE 2013
June 15 - 22

5% Off w/ Code: EHN_5

SANS Deals 4 EH-Netters
5% OFF Any SANS Course in Any Format!
Coupon Code: EHN_5 Including SANS Rocky Mountain 2013 & SANS Boston 2013
Polls
Compared to this year, 2013 will be:
 
Recent Forum Topics
EH-Net News Feeds
Latest Additions
 
         
Free Business and Tech Magazines and eBooks

© 2013 The Ethical Hacker Network
Joomla! is Free Software released under the GNU/GPL License.