2

I'd like to know if it's possible to setup Exchange 2003/2007 to switch between smarthosts, based on the WAN connection currently in use.

Example scenario: I have two WAN connections with different ISP's. Exchange is running behind a dual WAN router. The router is setup to fall back to secondary WAN when primary WAN fails. The smarthost set in Exchange is the SMTP server of the primary ISP. Because the smarthost set in Exchange only allows relaying from IP's of the primary WAN sending mail won't work when the router falls back to the secondary WAN.

Sending mail directly through DNS MX lookup is an option but the ISP's have dynamic IP's that get blacklisted a lot.

Thanks in advance!

gazorp
  • 31
  • 1
  • 3

4 Answers4

1

There's nothing built in to Exchange 2003 or 2007 to do this for you. Exchange 2007 can be managed via Powershell, however, and the component that controls your smarthost is a Send Connector in Exchange 2007 and you could write a Powershell script that changes that attribute without too much effort. Whether or not you would want this to somehow run automatically or not would determine how complex this would need to be.

icky3000
  • 4,718
  • 1
  • 20
  • 15
1
#Adding Exchange Snap In to execute Exchange CmdLets in this script
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin

#Enter an IP to use as the monitor, you may need to put a static entry on your router
$Srvname = "4.2.2.2"
$ping = new-object System.Net.NetworkInformation.Ping

#enter your primary smarthost IP
$primary = "1.1.1.1"

#enter your failover smarthost IP
$failover = "2.2.2.2"

$test = $ping.send($Srvname)

if (!$test)
 {
  Set-SendConnector "INDENTITY OF SEND-CONNECTOR" -SmartHosts $failover
  Write-host "Changed outbound send connector to $failover"
 }
elseif ($test.status -eq "Request timed out.")
 {
  Set-SendConnector "INDENTITY OF SEND-CONNECTOR" -SmartHosts $failover
  Write-host "Changed outbound send connector to $failover"
 }
elseif ($test.status -eq "Success")
 {
  Set-SendConnector "INDENTITY OF SEND-CONNECTOR" -SmartHosts $primary
  Write-host "$primary is up, no changes were made"
 }
Else
 {
  Write-Host "Failed with status..."
  $test.status
 }
pauska
  • 19,532
  • 4
  • 55
  • 75
DeMyNtEd
  • 11
  • 1
  • I've fixed the formatting of your answer, please see through it to make sure that no code got lost in formatting :) Also, it would be nice if you could describe what this code does. – pauska Feb 03 '11 at 08:14
0

I assume you're referring to a dynamic ip that your ISP has assigned to you. If so, that should have no bearing on your Exchange server's ability to use DNS to perform MX lookups for outgoing email. A dodgy ip from your ISP may cause you to get blacklisted but it won't cause your Exchange server to have problems looking up MX records or making outbound SMTP connections.

joeqwerty
  • 108,377
  • 6
  • 80
  • 171
0

No. Here is a trick, though - you should be able to do so on the router. In a setup like this. exchange would forward, for exampel, to the internal IP of the router. From there the router would prot forward depending on the conditions of the wan connections.

At least with RouterOS that is in the possible configurations.

TomTom
  • 50,857
  • 7
  • 52
  • 134