Re: why do the comments in bacula-dir.conf say not to use "localhost" here?

Rob Gerber <[email protected]>
Newsgroups gmane.comp.bacula.user
Message-ID <CAMKi9mRz1vfkwK=Hp9ciUsVr0KpdJOT_gremj-XkwnFuJp9Suw@mail.gmail.com>
Avahi is a decentralized local hostname resolution protocol.

Here is the text of my avahi configuration notes. These are red hat /
centos / rocky linux / alma linux centric. I specifically used them on
Rocky Linux 9.x. I hope you can get the general idea. The most important
things I think you need to know is that you will need to set up the avahi
daemon on your server, and that there are avahi-specific ping and resolver
tools to verify that avahi is working correctly.

Additionally, the following text is formatted like a bash script, with #
signs used to add comments. It is NOT a script, and shouldn't be dropped
into place as such.

notes begin:
# avahi mdns setup, for resolving names using multicast DNS, when local DNS
isn't awesome.

sudo dnf install avahi avahi-tools nss-mdns

sudo systemctl enable --now avahi-daemon

nano /etc/nsswitch.conf
OR
nano /etc/authselect/user-nsswitch.conf # preferred, nsswitch will get
overwritten by user-nsswitch

# find the line like:
hosts: files dns

# It should look like: # in my case, it was already correct, no need to
change)
hosts: files mdns4_minimal [NOTFOUND=return] dns


Test:
ping hostname.localtld
OR
avahi-resolve-host-name hostname.localtld

# If that doesn't work out of the box, maybe try dropping the firewall.

# I had to let mdns through the firewall.
# sudo firewall-cmd --get-active-zones
# should see output like
public
  interfaces: eth0
# probably only relevant to verify what zones you have configured.

# list services to see if mdns is allowed.
sudo firewall-cmd --zone=public --list-services

# if mdns isn't listed, add its service to the list:
sudo firewall-cmd --zone=public --add-service=mdns --permanent
sudo firewall-cmd --reload

# list services to see if mdns is allowed.
sudo firewall-cmd --zone=public --list-services

Test:
ping hostname.localtld
OR
avahi-resolve-host-name hostname.localtld


Regards,
Robert Gerber
402-237-8692
[email protected]


On Mon, Sep 1, 2025 at 3:51 PM Rob Gerber <[email protected]> wrote:

> To my understanding, we are advised not to use "localhost" because those
> address fields may be used to communicate "this is the director / SD
> address" to an external client. This is my guess. Someone else would need
> to confirm, or you can check the (very verbose) documentation.
>
> FYI, the best way to search the documentation is to download the pdf and
> search it. HTML manual search across multiple pages isn't possible for some
> bizarre reason. All of this is in my experience, anyhow.
>
> In an environment where local hostname resolution isn't handled by the
> router or some other central authority, I have used avahi on my bacula
> server. Avahi is a peer to peer name resolution system. I believe avahi is
> what windows machines are using to resolve LAN hostnames in environments
> where the router or DNS server isn't handling that for them. In any case,
> it got me out of a similar jam once.
>
> I believe that it would be suitable to use either a hostname or LAN IP
> address, as long as the relevant clients can resolve / reach either of
> those. You will need suitable firewall rules on the server and possibly the
> client, of course. If you previously tried the server's LAN IP address, and
> that didn't work (and you also restarted the bacula dir/sd after making the
> configuration changes), I'd try temporarily disabling the firewall on the
> server / client to see I'd that resolves the issue.
>
> Please remember to restart the bacula-dir and bacula-sd after changing
> their configuration files.
>
> Here is some information on firewalls and bacula. Please note that the
> author of this documentation mentions server config files 'server-dir.conf'
> and 'server-sd.conf'. These are simply what he has chosen to name his
> config files, and he has referenced them from within the bacula-dir.conf /
> bacula-sd.conf files. For your purposes, just pretend he wrote
> 'bacula-dir.conf' and 'bacula-sd.conf'.
>
>
> https://www.bacula.org/15.0.x-manuals/en/problems/Dealing_with_Firewalls.html
>
> And of course, here is the bacula manual, in PDF form:
> https://www.bacula.org/15.0.x-manuals/en/main/main.pdf
>
> And the documentation in general:
> https://www.bacula.org/documentation/documentation/
>
> I am *NOT* saying 'RTFM'. It is a *very* large manual (700+ pages
> currently). I want you to have the same resources I used to reach a greater
> understanding of bacula. Asking this mailing list was one of the resources
> I used. Feel free to continue asking questions here. :)
>
> I will send some of my avahi configuration notes in a follow-on email.
>
> Robert Gerber
> 402-237-8692
> [email protected]
>
> On Mon, Sep 1, 2025, 3:08 PM Gary Dale <[email protected]> wrote:
>
>> I'm running Debian 13 (Trixie) on an AMD64 system.
>>
>> I've been struggling to get bconsole to connect to the storage-director.
>> After initially trying to set up a reverse lookup for the server name, I
>> took the easy way out and replaced the name with the IP address in the
>> autochanger section of bacular-dir.conf. That didn't help.
>>
>> The reason I was doing all this is immediately above the Address - line
>> in that section, it specifically says "Do not use "localhost" here".
>> Furthermore, the line itself says "N.B. Use a fully qualified name here".
>>
>> However, it appears that localhost, or more specifically 127.0,0.1, is
>> the only address that works.
>>
>>  From what I've been reading, if you do follow the "N.B.", you need to
>> ensure that there is a working reverse DNS lookup for it in order to
>> work. However that need should be removed by using an IP address
>> instead.  But if you are running the bacula director on the same device
>> as the storage director, it appears that you must use the Localhost IP
>> (127.0.0.1).
>>
>> Can someone please revise the comments to be more reflective of a
>> typical situation?
>>
>>
>>
>> _______________________________________________
>> Bacula-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/bacula-users
>>
>

_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.