Configuring Source and Agent Addresses for SNMP Traps

Using SNMP trap options, you can set the source address of every SNMP trap packet sent by the router to a single address regardless of the outgoing interface. In addition, you can set the agent address of the SNMPv1 traps. For more information about the contents of SNMPv1 traps, see RFC 1157.

Note: SNMP cannot be associated with any routing instances other than the master routing instance.

To configure SNMP trap options, include the trap-options statement at the [edit snmp] hierarchy level:

[edit snmp]trap-options {agent-address outgoing-interface;source-address address;}

You must also configure a trap group for the trap options to take effect. For information about trap groups, see Configuring SNMP Trap Groups.

This topic contains the following sections:

Configuring the Source Address for SNMP Traps

You can configure the source address of trap packets in two ways: lo0 or a valid IPv4 address configured on one of the router interfaces. The value lo0 indicates that the source address of the SNMP trap packets is set to the lowest loopback address configured on the interface lo0.

To specify a valid interface address as the source address for SNMP traps on one of the router interfaces, include the source-address statement at the [edit snmp trap-options] hierarchy level:

[edit snmp trap-options]source-address address;

address is a valid IPv4 address configured on one of the router interfaces.

To specify the source address of the SNMP traps so that they are sent to the lowest loopback address configured on the interface lo0, include the source-address statement at the [edit snmp trap-options] hierarchy level:

[edit snmp trap-options]source-address lo0;

To enable and configure the loopback address, include the address statement at the [edit interfaces lo0 unit 0 family inet] hierarchy level:

[edit interfaces]lo0 {unit 0 {family inet {address ip-address;}}}

To configure the loopback address as the source address of trap packets:

[edit snmp]trap-options {source-address lo0;}trap-group "urgent-dispatcher" {version v2;categories link startup;targets {192.168.10.22;172.17.1.2;}}[edit interfaces]lo0 {unit 0 {family inet {address 10.0.0.1/32;address 127.0.0.1/32;}}}

In this example, the IP address 10.0.0.1 is the source address of every trap sent from this router.

Configuring the Agent Address for SNMP Traps

The agent address is only available in SNMPv1 trap packets (see RFC 1157). By default, the router’s default local address is used in the agent address field of the SNMPv1 trap. To configure the agent address, include the agent-address statement at the [edit snmp trap-options] hierarchy level. Currently, the agent address can only be the address of the outgoing interface:

[edit snmp]trap-options {agent-address outgoing-interface;}

To configure the outgoing interface as the agent address:

[edit snmp]trap-options {agent-address outgoing-interface;}trap-group “ urgent-dispatcher” {version v1;categories link startup;targets {192.168.10.22;172.17.1.2;}}

In this example, each SNMPv1 trap packet sent has its agent address value set to the IP address of the outgoing interface.

Related Topics