2023-08-18 Annoyed by named pouring out messages about unreachable IPv6 addresses, e.g. named[3556893]: network unreachable resolving 'nn.uninett.no/A/IN': 2001:502:ad09::12#53 wanted to pass it "-4" parameter on start-up, to limit it to IPv4. This used to be easy by a file in /etc/sysconfig/ (or was it /etc/default ?). Now (RHEL 9) it's complicated, thanks to elaborate systemd. There's an 'edit' option for the systemctl command: # systemctl edit named This copies a default config and allows editing: see below for an example. It's of course a little more complicated than that. It was necessary to include the heading "[Service]" (very reasonable). But it then failed: # systemctl restart named Failed to restart named.service: Unit named.service has a bad unit file setting. ..date..host.. systemd[1]: named.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing. It turns out that the ExecStart has to be cleared first! See below. ----------------------------- example of the edited file in 'systemctl edit named' ----------------------------- ### Editing /etc/systemd/system/named.service.d/override.conf ### Anything between here and the comment below will become the new contents of the file [Service] ExecStart= ExecStart=/usr/sbin/named -4 -u named -c ${NAMEDCONF} $OPTIONS ### Lines below this comment will be discarded ### /usr/lib/systemd/system/named.service # [Unit] # Description=Berkeley Internet Name Domain (DNS) # Wants=nss-lookup.target # Wants=named-setup-rndc.service # Before=nss-lookup.target # After=named-setup-rndc.service # After=network.target # # [Service] # Type=forking # Environment=NAMEDCONF=/etc/named.conf # EnvironmentFile=-/etc/sysconfig/named # Environment=KRB5_KTNAME=/etc/named.keytab # PIDFile=/run/named/named.pid # # ExecStartPre=/bin/bash -c 'if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi' # ExecStart=/usr/sbin/named -u named -c ${NAMEDCONF} $OPTIONS # ExecReload=/bin/sh -c 'if /usr/sbin/rndc null > /dev/null 2>&1; then /usr/sbin/rndc reload; else /bin/kill -HUP $MAINPID; fi' # # ExecStop=/bin/sh -c '/usr/sbin/rndc stop > /dev/null 2>&1 || /bin/kill -TERM $MAINPID' # # PrivateTmp=true # # [Install] # WantedBy=multi-user.target ----------------------------- end -----------------------------