Hands-on tutorial

Tutorials · Routing & Internet

How to Set Up Split-Horizon DNS for Internal and External Users

Make the same hostname resolve to an internal address inside the office and a public address outside, so portals, NVRs and servers work everywhere without hairpin NAT.

Intermediate8 min6 steps

Before you start

  • An internal DNS server (gateway, server or directory DNS)
  • The public DNS zone for your domain
  • The internal and public addresses of each service

Step by step

  1. List the services

    Identify names used both inside and outside, for example portal.example.com or files.example.com.

  2. Create internal records

    On the internal DNS server, create the same names pointing to internal addresses.

    portal.example.com.  A  10.0.20.15
    files.example.com.   A  10.0.20.30
    
  3. Keep public records unchanged

    Public DNS continues to answer with public addresses for external users.

  4. Point clients to internal DNS

    Make sure DHCP gives clients the internal DNS server, and that VPN users also receive it.

  5. Forward everything else

    The internal server answers for your own zone and forwards other queries to a filtering or public resolver.

  6. Test from both sides

    Resolve the names from the office, over VPN and from a phone on mobile data.

    nslookup portal.example.com 10.0.0.53
    nslookup portal.example.com 9.9.9.9
    

Commands are generic, industry-standard examples. Exact syntax and menu names vary by model and firmware; check your device's manual on the Documentation page.

Pro tips

  • Keep internal and public records documented together to avoid drift.
  • Use the same TLS certificate names inside and out, so browsers do not warn.
  • Avoid exposing internal-only names in public DNS.