2

I'm looking for a way to change source IP in traps sent by snmpd (CentOS 6.6).

My requirement is to set in trap configurable virtual IP (VIP) instead of real station IP in case of system defined in High-Availability mode.

Attempts to define another IP via snmpd.conf like:

trapsess -v 2c -c public -Ci 5.5.5.5:162 0.0.0.0:162

do not succeed.


<>Lenniey,

The procedure was to create additional virtual interface and routing with virtual IP address:

cd /etc/sysconfig/network-scripts/

cp  ifcfg-eth0 ifcfg-eth0:1

vi ifcfg-eth0:1 (define virtual IP, remove gateway)

service network restart

ip route add VIRTUAL_IP/32 dev eth0:1

But traps sent from my application via AgentX to snmpd and forwarded to target address have the same local IP address as was before these changes. BR Alex

Sven
  • 98,649
  • 14
  • 180
  • 226
Alex Fooks
  • 21
  • 2

1 Answers1

0

You could try policy based source routing. Never did this in CentOS, but generally in Linux you have to create a specific route for the particular host so that the source IP will be changed to the one you want.

ip route add 192.168.0.200 (the SNMP trap) dev eth0 (your outgoing device) src 192.168.0.100 (your virtual IP)

ip route flush cache

and try again.

If this doesn't succeed, you may have to implement routing tables, too.

Lenniey
  • 5,220
  • 2
  • 18
  • 29