Solved

Tcpdump on a Cisco Router?

Posted on 2004-10-25
17,821 Views
Last Modified: 2010-07-12
I want to be able to watch the packets as they flow through my router similar to tcpdump in *nix.  Is there any such command that can allow me to do this?  I am running IOS 12.2(17a).

Thanks guys and gals.
0
Question by:mpathetiq
    10 Comments
     
    LVL 79

    Expert Comment

    by:lrmoore
    Try "debug ethernet-interface"
    0
     
    LVL 50

    Assisted Solution

    by:Don Johnston
    You could use "debug ip packet detail"

    You can also limit the output with a ACL

    access-list 1 permit 144.1.0.0 0.0.255.255
    debug ip packet  1 detail

    Will only show ip traffic sourced from the 144.1.0.0 network

    You can also use an extended ACL to further limit the output.

    This may cause a bit of a load on the CPU though and you will need to disable fast-switching.

    -Don
    0
     

    Author Comment

    by:mpathetiq
    i did "debug ip packet detail"  but i saw no packets.  i know there was data flowing through but saw no packets.
    0
     

    Author Comment

    by:mpathetiq
    i also did "debug ethernet-interface"

    both commands indicate that the debugging is on, but i don't know how to retrieve that data.
    0
     
    LVL 79

    Assisted Solution

    by:lrmoore
    Are you using the router's console port, or telnet session?
    If using telnet session, issue "term mon" command
    0
     
    LVL 79

    Expert Comment

    by:lrmoore
    Else, be sure to allow debug to the console
      router(config)#logg console debug
    0
     
    LVL 50

    Accepted Solution

    by:
    And don't forget to disable fast switching.

    In interface configuration mode, "no ip route-cache"

    -Don
    0
     
    LVL 3

    Expert Comment

    by:MaxQ
    You really don't want to do "debug ip packet detail" if you're connected via telnet/ssh and are logging to anything other than the internal buffer.  Otherwise the debug will capture the output going to the screen and/or syslog server and you'll get this nifty loop loop of doom as the debug causes more packets to dump from the debug.  Even going to the buffer (which will scroll like crazy if the router is moving much traffic at all) this will still add load to the router's CPU so be careful with this.  If you have a way to narrow down what you're looking for make an ACL to only match those packets, and put the ACL number after the debug command as in "debug ip packet detail 122".  This will give you less output to dig through and limit the overhead of logging every packet.

    Finally, if you're really feeling brave or are doing this in a lab where you can take risks, there is an undocumented mode in most IOS version called 'debug ip packet dump" that will dump the entire contents of the packets, as tcpdump would.  All the stuff above about overhead, etc. goes triple for this.  The reason it's undocumented is so people don't complain to Cisco if they crash their router with this command.
    0
     

    Expert Comment

    by:alexcf
    On your transit port you could setup port monitoring depending on how much traffic is actually going out.

    (config)# monitor session 1 <destination/source> 1 int fa 0/bla

    http://www.cisco.com/en/US/products/hw/switches/ps4324/products_configuration_guide_chapter09186a00801d616e.html

    Then you can just run tcpdump or ethereal on the Linux machine you send the mirrored traffic to. Worked very well when I needed to monitor a machine which was suspected of illegal activity.
    0
     

    Expert Comment

    by:umasscscf
    How do you turn off the debugging???
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Problem Description:   Couple of months ago we upgraded the ADSL line at our branch office from Home to Business line. The purpose of transforming the service to have static public IP’s. We were in need for public IP’s to publish our web resour…
    Tired of waiting for your show or movie to load?  Are buffering issues a constant problem with your internet connection?  Check this article out to see if these simple adjustments are the solution for you.
    After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
    After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

    875 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now