Skip to content

Split horizon: internal and external answers for one name

Goal: www.example.com resolves to a private address for staff on the corporate network and to the public address for everyone else, and admin.example.com does not exist at all outside the office.

This needs a pro license. The reference for the precedence rules and the v1 limits is Views.

1. Define the view

A view is the client ACL. Everything else references it.

gslbctl views create internal \
  --description "Corporate offices and VPN" \
  --cidr 10.0.0.0/8,192.168.0.0/16 \
  --priority 10

Leave --trust-ecs off: it lets a query's EDNS Client Subnet option decide the match, and that option comes from the client's resolver. For an internal-only view that would make the ACL spoofable.

In the WebUI the same form is Admin → Views.

2. Point a service at it

A per-view service is an ordinary service — its own name, its own pool, its own filter chain. Only the --view flag is new.

# The public answer, unchanged; no view means "everyone".
gslbctl services create --name www --domain www.example.com --pool public-pool

# The internal answer.
gslbctl services create --name www-internal --domain www.example.com \
  --pool private-pool --view internal

Service names are globally unique, so the internal one needs its own (www-internal); the domain may repeat once per view.

3. A name that exists only inside

Same thing, with no default-set row at that name:

gslbctl services create --name admin-internal --domain admin.example.com \
  --pool private-pool --view internal

Outside the view that name is NXDOMAIN. Inside it resolves normally.

4. Check it

Query from both sides. From an address inside the view:

dig +short www.example.com @ns1.example.com

and from anywhere else. The two answers should differ, and admin.example.com should return NXDOMAIN from outside and an address from inside.

If both sides get the public answer, the usual causes are: the client address is not actually in the CIDR (check the transport source the nameserver sees, not the client's own idea of its address), or the view was written on another node less than five seconds ago.

Static records work the same way

# Default MX for everyone.
gslbctl records create --name example.com. --type MX --value "10 mail.example.com."
# Internal-only A.
gslbctl records create --name intranet.example.com. --type A --value 10.0.0.9 --view internal

A view shadows one record type at a name. Giving www an internal A leaves its default MX visible to everyone — you do not have to copy the rest of the zone into the view.

"Visible to external only"

There is no way to hide a default-set name from one view. Express it the other way round: make external a real view with 0.0.0.0/0 and ::/0 at a lower priority than internal, put the external-only names in it, and keep in the default set what both audiences should see.

gslbctl views create external --cidr 0.0.0.0/0,::/0 --priority 1
gslbctl services create --name shop --domain shop.example.com --pool public-pool --view external

Staff still match internal (priority 10) for names that exist there, and fall through to the default set for everything else.

What a secondary gets

A zone transfer carries the default set only — per-view services and records are skipped. A secondary therefore serves the public view of the zone, which is usually what you want from an off-site secondary; if it needs the internal answers, run it inside the view and slave nothing.