Setting up Sender Based Routing for Exchange 2013/2016

If you have multiple Accepted Domains in your environment and need some or all of them to route through a different Send Connector, you will need to enable SBR (Sender Based Routing) in your environment.

Unfortunately, Sender Based Routing is not installed in Exchange 2013/2016 by default so a custom SBR Transport agent must be configured.

For each Accepted Domain you wish to be routed to a different gateway you need to configure a Send Connector to route to your gateway of choice. This does not change the sender address when sending through these connectors but just re-routes the domain to the correct connector. You also don’t need to use a valid TLD (Top-level domain), so we recommend using .sbr or something similar.

Each version and CU (Cumulative Update) require a specific .dll file to utilize the SBR connector. These can be created in Visual Basic or searching for the correct .dll on the internet.

This link covers how to create your own .dll using Visual Studio.

https://www.tuescher.net/Exchange-Sender-Based-Routing/compile.html


1. Setting up New Send Connector
 

For example, if the domain you are wanting to route through our smart host is domain.com you would create a new Send Connector from the Exchange Admin Center>Mail Flow>Send Connectors and title it something like domain.sbr

This domain should match the domain you will specify in your SBR Override file later in this article.



Then select Next, then “Route Mail through smart hosts” and click the plus sign and add your assigned AppRiver smart host FQDN, such as server209.appriver.com (check with us if you are unsure of your assigned Smarthost server):



Then select Next, for authentication it would be None:



Then select Next, click the plus sign and for domain you would use your SBR domain, such as domain.sbr:



Click Next, then the plus sign and add your source servers and then Finish:


 

2. Install SBR Binaries
 

Next you need to create the actual binaries that tell the Transport service to override the default send connector if it is going to an SBR domain.
 

Create directory: 
%ExchangeInstallPath%\TransportRoles\agents\Custom

 

Extract the DLL you either downloaded or if you created your own to that directory and Unblock the DLL. To unblock the DLL, right click on the file, select Properties, then Unblock. If you created your own, you may not need to unblock it.



In that same directory create Microsoft.Exchange.SBR.OverrideSettings.config file. Easiest method is to open notepad and copy the text below into it, then save with the specified name and file type of All Files.
 

#Line Format: [original_internal_domain_or_individualsender];[re-routing_domain]
domain.com;domain.sbr

#john.doe@myotherdomain.com;domain.sbr

You can comment out the second line as that would be used for if you wanted to re-route just a specific user.

Also, in that same directory create Microsoft.Exchange.SBR.InternalDomains.config file.
 

#Line Format: [internal_domain]
domain.com

myotherdomain.com
myotherotherdomain.com
 

This file should list all your internal domains, if you leave it empty every configured re-routing domain will send out the specified connector, even if the recipient is from the same domain or any other internal domain.

If you list the internal domains Exchange will resolve them correctly and send using the ABP Routing agent.

Next, in that same directory create Microsoft.Exchange.SBR.IgnoreAuthAs.config file.
 

#Line Format: [Ignore_AuthAs_Header]
Anonymous
External

Partner

At the very least Anonymous should be in this list because if not loops can be created between internal users. Internal should not be in this list at all. The agent checks X-MS-Exchange-Organization-AuthAs header value against this list and ignores message if value is in list.

At the end of this you should have the following files in that directory:




3. Install SBR Transport Agent on Exchange 2013/2016

 

Open Exchange Management Shell

Run the following command:
 

Install-TransportAgent "Sender Based Routing" -TransportAgentFactory "Microsoft.Exchange.SBR.SbrRoutingAgentFactory" -AssemblyPath "C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\agents\Custom\Microsoft.Exchange.SBR.dll" -TransportService Hub
 

Restart Exchange Management Shell

Restart Exchange Transport Service: Restart-Service MSExchangeTransport
 

4. Install ABP Routing Agent on Exchange 2013/2016
 

This solves the problem if members of different ABP (Address Book Policies) are sending to each other and allows Exchange to resolve them correctly.

Open Exchange Management Shell

Run the following command:
 

Install-TransportAgent -Name "ABP Routing Agent" -TransportAgentFactory "Microsoft.Exchange.Transport.Agent.AddressBookPolicyRoutingAgent.AddressBookPolicyRoutingAgentFactory" -AssemblyPath "C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\agents\AddressBookPolicyRoutingAgent\Microsoft.Exchange.Transport.Agent.AddressBookPolicyRoutingAgent.dll"
 

Restart EMS

Restart Exchange Transport Service: Restart-Service MSExchangeTransport
 

5. Enable SBR Agent
 

Open Exchange Management Shell

Run the following command: Enable-TransportAgent "Sender Based Routing" -TransportService Hub

Run the following command: Restart-Service MSExchangeTransport

Check Transport Agents: Get-TransportAgent
 

Identity Enabled Priority
Transport Rule Agent True 1
Malware Agent True 2
Text Messaging Routing Agent True 3
Text Messaging Delivery Agent True 4
System Probe Drop SMTP Agent True 5
System Probe Drop Routing Agent True 6
Sender Based Routing True 7
ABP Routing Agent False 8

As you can see “Sender Based Routing” is now set to True.
 

6. Enable ABP Agent
 

Open Exchange Management Shell

Run the following command: Enable-TransportAgent "ABP Routing Agent"

Run the following command: Restart-Service MSExchangeTransport

Run the following command: Set-TransportConfig –AddressBookPolicyRoutingEnabled $True

Check Transport Agents: Get-TransportAgent
 

Identity
Enabled
Priority
Transport Rule Agent
True
1
Malware Agent
True
2
Text Messaging Routing Agent
True
3
Text Messaging Delivery Agent
True
4
System Probe SMTP Agent
True
5
System Probe Drop Routing Agent
True
6
Sender Based Routing
True
7
ABP Routing Agent
True
8


Now ABP Routing Agent shows True as well.

From this point forward all your other domains will continue to use the current send connector but whatever domain you have specified will use the new connector to route mail.

 

 

Add Feedback