Create trust between two domain forests

Posted by Kerwen Blog on March 3, 2022

正常情况下一个domain的机器或者账号只能在本domain使用,拿到另外一个domain是不受信任的。因为产品需求,调查了下如何让两个domain能互相认证,domain1的账号也能在domain2内正常使用。

Prepare two domains

  1. Prepare two domain servers, for example: the first one Windows Server 2016, the second one Windows Server 2019.
    Note: if you are using vm, please make sure they are cloned from different template. Two vms which clone from same template will share same SID even after you rename the computer. This will lead to error when create trust. Use the PSTool to get the SIDs of two servers, make sure they are different.
  2. Rename them:
    Windows Server 2016 -> DomainServer1
    Windows Server 2019 -> DomainServer2
  3. Upgrade DomainServer1 to domain server
    • Go to Server Manager, select “Manage” -> “Add Roles and Features”
      img

    • Use default option “Role-based or feature-based installation”.
      img

    • Use default option “Select a server from the server pool”.
      img

    • Select checkbox “Active Directory Domain Services”
      img

    • Popup a confirm dialog, click “Add Features”
      img

    • It will take few minutes to complete installation.
      img

    • After install complete, click “Promote this server to a domain controller”.
      img

    • Select option “Add a new forest”, change domain name to “Updater1.domain”.
      img

    • Input password and confirm
      img

    • Will generate NetBIOS domain name automatically, keep default.
      img

    • Keep default setting, Next
      img

    • Will run prerequisites check, if all passed, click “Install”.
      img

    • After reboot, check the full computer name and domain name.
      img

  4. Similar steps to upgrade DomainServer2 to domain server.
    After complete:
    DomainServer1.Updater1.domain(10.224.106.208)
    DomainServer2.Updater2.domain(10.224.110.245)

Create trust between domains

  1. Ping each other, make sure the two servers can ping each other successfully.
    img
  2. Add second DNS Server
    On DomainServer1:
    • Go to Control Panel -> Network and Sharing Center
    • Select your Ethernet connections, select property and config IPV4
    • Input the second DNS ip address
      img On DomainServer2, similar steps to config second DNS.
      img
  3. Create stub zone in DNS
    On DomainServer1:
    • Open Server Manager, Tools -> DNS
      img
    • Right click on “Forward Lookup Zones”, select “New Zone…”
      img
    • Select “Stub zone” and Next
      img
    • Select “To all DNS … forest”, Next
      img
    • Input domain name “Updater2.domain”.
      img
    • Input the ip address of Updater2.domain
      img
    • Display below success dialog.
      img
    • You should be able to successful ping Updater2.domain now.
      img

    On DomainServer2, similar steps to config DNS.

  4. Create trust
    On DomainServer1:
    • Open “Server Manager”, select “Tools” -> “Active Directory Domains and Trusts”
      img
    • Right click on “Updater1.domain”, select “Properties”
      img
    • Go to “Trusts” tab, click “New Trust”.
      img
    • Input domain name: “Updater2.domain”, Next
      img
    • Select “Forest trust”, Next
      img
    • Select “Two-way”, Next
      img
    • Select “Both this domain and the specified domain”, Next
      img
    • Input the user name and password of Updater2.domain
      img
    • Select “Forest-wide authentication”
      img
    • Select “Forest-wide authentication”
      img
    • Next
      img
    • Select “Yes, confirm the outgoing trust”
      img
    • Select “Yes, confirm the incoming trust”
      img
    • Should display below success dialog.
      img
    • Could see the trusts have been created in outgoing and incoming.
      img
    • Go to DomainServer2, could see the trusts have been created automatically.
      img

Verify

  1. Prepare two windows client machines: Test1 and Test2
  2. Test1 join Updater1.domain, Test2 join Updater2.domain
  3. On Test1 machine, sign out and use domain2 account to logon

If could logon, we have created trust between two domain forests.

Reference

Trust Relationship Between Two Forest
Cannot create Trust Relationship
How to get SID by PSTool