Assuming example.com
(RFC domain) rather than domain.com
which is a valid domain
If you're wanting different views, but mostly the same content you want to put the content in one file, the views in 2 separate. The 2 separate then include the one content (so you don't maintain stuff in different places). Your internal one can have additional content.
Your named.conf.local
would then be
acl internals {
127.0.0.0/8;
192.168.1.0/24;
};
view "internal" {
match-clients { internals; };
zone "example.com" {
type master;
file "/var/lib/bind/example.com.internal-hosts";
};
zone "local.example.com" {
type master;
file "/var/lib/bind/local.example.com.hosts";
};
zone "1.168.192.in-addr.arpa" {
type master;
notify no;
file "/var/lib/bind/192.hosts";
};
};
view "external" {
match-clients { any; };
zone "example.com" {
type master;
file "/var/lib/bind/example.com.external-hosts";
};
};
Then in /var/lib/bind/example.com.external-hosts
you have your origin, SOA and an include statement eg
$ORIGIN example.com
$TTL 600 ; 10 minutes
example.com. IN SOA ns1.example.com. hostmaster.example.com. (
2021042801 ; serial
10800 ; refresh (3 hours)
3600 ; retry (1 hour)
604800 ; expire (1 week)
600 ; minimum (1 day)
)
$INCLUDE "example.com.hosts";
The include line is relative to the the root directory you've set for bind so you might need to experiment with adding /var/lib/bind/
Your internal file would be similar, but with the extra entries
$ORIGIN example.com
$TTL 600 ; 10 minutes
example.com. IN SOA ns1.example.com. hostmaster.example.com. (
2021042801 ; serial
10800 ; refresh (3 hours)
3600 ; retry (1 hour)
604800 ; expire (1 week)
600 ; minimum (1 day)
)
ns1.local IN A 192.168.1.3
local IN NS ns1.local.example.com.
$INCLUDE "example.com.hosts";
with the example.com.hosts
file being stripped of origin or SOA eg
localhost IN A 127.0.0.1
localhostv6 IN AAAA ::1
Try to avoid a ns1.local.example.com
if you can avoid it as it requires a glue record because the host is within the domain it is serving.
You can skip the include and maintain the dns records in 2 different files, however they will drift and then you'll be in a bunch of pain trying to clean it up later. If you have multihomed hosts eg www on both public and private IPs then exclude it from the common file and add it to the 2 separate files with the different records.