SNMP Server Configuration

Hello community,

I always wondered if there is any difference between the two configurations below as far as setting up SNMP:

Option 1: Why is BGP needed at the end of the first line when the BGP traps are enabled in the second line?

snmp-server host 192.168.1.1 traps version 2c cisco bgp
snmp-server enable traps bgp

Option 2: Does the first line here do anything different than the first line in option 1 by omitting "traps" and "bgp"?

snmp-server host 192.168.1.1 version 2c cisco
snmp-server enable traps bgp

Thanks in advance

Comments

  • Option 1: Why is BGP needed at the end of the first line when the BGP traps are enabled in the second line?

    snmp-server host 192.168.1.1 traps version 2c cisco bgp
    snmp-server enable traps bgp


    You do not need to specify it on the 1st line in order for snmp to send traps to the server. You only use it if you want it to ONLY send it BGP traps. The second line is needed because without it, snmp will not be enabled. You could enable snmp "globally" by using "snmp-server enable traps" which will enable all possible traps on that system. By only enableing bgp traps on the 2nd line, the "bgp" at the end of the 1st line is redundant. 


    Option 2: Does the first line here do anything different than the first line in option 1 by omitting "traps" and "bgp"?

    snmp-server host 192.168.1.1 version 2c cisco
    snmp-server enable traps bgp

    No, if you look at the default settings when enableing snm-server host, it will be default send traps. Try it out for yourself...type in "snmp-server host 192.168.1.1 version 2c cisco" and "snmp-server host 192.168.1.1 traps version 2c cisco". Then do a show run | s snmp-server host.  You will see that the  snmp-server host traps does not show up. 

    Hope this helps...

     

  • GabeGabe ✭✭

    "You do not need to specify it on the 1st line in order for snmp to send
    traps to the server. You only use it if you want it to ONLY send it BGP
    traps"

    So if I only wanted to send BGP traps, would any of these be correct?

    Option 1:

    snmp-server host 192.168.1.1 traps version 2c cisco bgp

    Option 2:

    snmp-server host 192.168.1.1 traps version 2c cisco
    snmp-server enable traps bgp

    Thanks in advance :)

  • The second option is good, not the 1st though. Remember,  you just enable the traps 1st before you can send then. You can either enable all traps possible,  by doing snmp-server enable traps. Or you can just enable specific ones,  such as your second statement. The 1st statement sends them to whatever host you specify,  the 2nd statement enables them. 

     

    It would make more sense if you think about it in reverse order....1st enable, then send to host. 

  • GabeGabe ✭✭

    oh I see, I think I'm getting it but I'd like to ask one more time just to make sure:

    Option 1: So you are saying the first one enables traps and the second one tells where to send it. My question would be, if I wanted to enable BGP traps ONLY would the "bgp" keyword ad the end of the second line override the "send all traps" logig in the first line?

    snmp-server enable traps
    snmp-server host 192.168.1.1 traps version 2 cisco bgp

    Option2: This configuration sends BGP traps ONLY right?


    snmp-server enable traps bgp

    snmp-server host 192.168.1.1 traps version 2c cisco

    I'm not just trying to understand the basic SNMP configuration but also why "bgp" or any other traps are available in both lines of the configuration.

    Thanks for all your help :)

  • oh I see, I think I'm getting it but I'd like to ask one more time just to make sure:

    Option 1: So you are saying the first one enables traps and the second one tells where to send it. My question would be, if I wanted to enable BGP traps ONLY would the "bgp" keyword ad the end of the second line override the "send all traps" logig in the first line?

    snmp-server enable traps
    snmp-server host 192.168.1.1 traps version 2 cisco bgp

    Option2: This configuration sends BGP traps ONLY right?

     



    Normal
    0




    false
    false
    false

    EN-US
    X-NONE
    X-NONE



































































































































































    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin:0in;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;}

    snmp-server enable traps bgp

    snmp-server host 192.168.1.1 traps version 2c cisco

    I'm not just trying to understand the basic SNMP configuration but also why "bgp" or any other traps are available in both lines of the configuration.

    Thanks for all your help :)

     

    Think this way - in order for the trap to be sent to the snmp server, the router has to be told two things: (1) to generate the trap and, (2) to send the trap generated.

     

    The snmp-server enable traps command tells the router to do the first thing, while the snmp-server host traps command instructs the router to do the second. Both commands can take argument to narrow down the list of traps affected. For a snmp trap to be sent to the server, it must be "covered" in both commands.

     

     

Sign In or Register to comment.