NAME

Langertha::Holmgang::Sim::Linux::Dns - BIND 9 on a simulated Linux server — named.conf, zones, rndc, dig, secondaries

VERSION

version 0.001

SYNOPSIS

# from the Linux simulator: rndc, named-checkconf, named-checkzone, dig, host
Langertha::Holmgang::Sim::Linux::Dns::prepare( $dev, $ctx );     # when the case loads
my ( $out, $ok ) = Langertha::Holmgang::Sim::Linux::Dns::rndc( $dev, \@argv, $ctx );

DESCRIPTION

An authoritative BIND 9.18 (Debian 12, service named) on a device of type linux (cai-platform docs/entwurf-evals.md §3.3.1). Configuration and zones are files under files; what is loaded is under bind.zones:

bind:
  conf:    /etc/bind/named.conf        # default; include files are read along
  service: named                        # default
  zones:                                # loaded; when missing, prepare() loads the files
    example.com: { type: primary, file: /etc/bind/db.example.com, serial: 2026102001,
                   records: [ "example.com. 3600 IN SOA …", "www.example.com. 3600 IN A 192.0.2.10", … ] }
    example.net: { type: secondary, primaries: [ 192.0.2.53 ], serial: …, records: [ … ] }
  source:  { example.com: "<zone text>" }   # start only: loaded like this (instead of the file)
  log:     [ … ]                        # by the simulator: messages of named (journalctl -u named)

records are canonical lines owner. ttl IN TYPE data (names lower case and absolute, TXT as one joined text in quotes), so rules check with any/none/contains no matter how the zone file is written.

prepare (when the case loads) fills bind.zones from bind.source or the zone files, as a freshly started named would have loaded them.

Commands: rndc reload [zone]|reconfig|retransfer zone|refresh zone|notify zone|status|zonestatus zone|flush, named-checkconf [-z] [file], named-checkzone zone file, dig [@server] name [type] [+short] [-x address] [axfr], host [-t type] name [server]; systemctl reload|restart|start|stop named (through the Linux simulator).

Like BIND: rndc reload and systemctl reload named reread named.conf and all zones; a broken zone keeps its old state (message in the log), a restart does not load it at all (SERVFAIL). An error in named.conf makes reload fail; a restart then fails. Relative file names are taken under directory (Debian: /var/cache/bind). When the serial of a primary zone rises, NOTIFYs go to the addresses of the NS records and also-notify; a secondary zone on another device takes over the zone when allow-transfer (zone, else options; when missing: everyone) allows its address and the serial is newer (RFC 1982). rndc retransfer fetches without comparing. Checks like named-checkzone: SOA and NS at the apex, "CNAME and other data", NS without an address in the zone, TXT text over 255 characters, addresses; data outside the zone is skipped with a warning.

parse_conf

my $c = parse_conf( $dev [, $path] );   # { directory, allow_transfer, zones => { name => {...} } }

Reads named.conf with its include files; an error dies with named's message.

parse_zone

my $z = parse_zone( $text, 'example.com', $filename );
# { ok, serial, records => [...], show => { "<canonical>" => "<display>" }, errors => [...], warnings => [...] }

Reads a zone file like named (see above) and checks it like named-checkzone.

prepare

When the case loads, fills bind.zones: every zone from named.conf, loaded from bind.source.<zone> or the file (primary zones); secondary zones without a state stay empty. A bind.zones already set is kept. bind.source.<path> (absolute path) replaces a file while deriving — so named loads an older version of a named.conf that has since been broken.

load

my ( $message, $ok ) = load( $dev, $ctx, $mode [, $zone] );

named loads: reload (old zone stays on error), start (fresh), reconfig (only new zones and options), zone (only this zone).

transfer

transfer( $secondary_dev, $ctx, 'example.com', $force );

Fetch a secondary zone: from the first reachable primary, when its allow-transfer allows the address and (without $force) the serial is newer. Returns ( $message, $ok ).

service_event

From the Linux simulator on systemctl start|restart|reload|stop of the service named. An error in named.conf makes start and restart fail (die).

rndc

rndc (see above).

checkconf

named-checkconf [-z] [file].

checkzone

named-checkzone zone file.

dig

dig (see above).

host

host [-t type] name [server].

SUPPORT

Issues

Please report bugs and feature requests at https://github.com/Getty/langertha-holmgang/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.