Change the source IP address of an EEM SMTP session

I've got the following question from Levi:

I have a Tcl script that is used in conjunction with EEM to send email whenever the amount of CRC errors on a particular interface increases above a certain threshold. My problem is that the router uses the IP of the outgoing interface as the source IP when it communicates with the SMTP server. This particular interface happens to have a private IP. There's another interface with a public IP and I wanted to know how to get the router to use the public IP on the other interface when it's sending email generated by the TCL script.
There are several ways to solve this problem. If you use Tcl, you could write your own SMTP client and use the -myaddr parameter in the socket call to specify the source IP address. Those of us who prefer EEM applets are not so lucky, you have to use NAT to change the source IP address before the packet is sent toward the SMTP server.

This article is part of You've asked for it series.

4 comments:

  1. Thanks for giving this information. I am searching for how to change the ip address. and also i found a website for chk the ip address from http://www.ip-details.com/ at a free of cost.

    ReplyDelete
  2. Thanks for giving this information. I am searching for how to change the ip address. and also i found a website for chk the ip address from http://www.ip-details.com/ at a free of cost.

    ReplyDelete
  3. How would one implement the eem email alerts using a vrf

    ReplyDelete
  4. The latest versions of EEM allow you to specify a source address and interface for SMTP. This was addressed by CSCsg69672. VRF support was added specifically for the callhome feature but is also available for regular eem policies, this was added by CSCsr63098. I believe the vrf is determined automatically based on the source ip address/interface.

    ReplyDelete

You don't have to log in to post a comment, but please do provide your real name/URL. Anonymous comments might get deleted.

Ivan Pepelnjak, CCIE#1354, is the chief technology advisor for NIL Data Communications. He has been designing and implementing large-scale data communications networks as well as teaching and writing books about advanced technologies since 1990. See his full profile, contact him or follow @ioshints on Twitter.