Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
add comment

4 Answers

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.

share|improve this answer
add comment
#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
 }
share|improve this answer
    
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 3 '11 at 8:14
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.