Nov 302013
 

Like many people, I have a laptop which I backup using Bacula. In my case, the laptop may be present under one of two condition:

  1. directly connected to my network via wireless
  2. indirectly connected to my network via VPN

My VPN of preference is OpenVPN, but that’s not relevant to the situation. The issue is: the IP address for my laptop changes depending upon which of the two connections it is using. Putting aside the issue that I could make OpenVPN use the same address, let’s talk about how I run backup jobs in this situation. I could also use Dynamic DNS to fix this situation. But let’s not go there just now.

There is a different hostname associated with each connection. Let’s call them laptop and laptop-vpn. Here is the Job resource from bacula-dir.conf:

Client {
  Name           = laptop-fd
#  Address        = laptop.example.org
  Address        = laptop-vpn.example.org 
  Catalog        = MyCatalog
  Password       = "NotMyPassword"

  File   Retention = 3 years
  Job    Retention = 3 years
}

Thus, I would edit the file, change the Address, and issue a reload command within bconsole. This works just fine.

I posted this amazingly clever solution to the Bacula Users mailing list last night. This morning, I had a response which educated me to a bconsole command which I did not previously know about. Hmmm, I am not sure if I had read about it before, but I certainly had never considered the setip command for this situation.

Looking at the bconsole help:

 $ bconsole
Connecting to Director bacula.example.org:9101
1000 OK: bacula-dir Version: 5.2.6 (21 February 2012)
Enter a period to cancel a command.
*help setip
  Command       Description
  =======       ===========
  setip         Sets new client address -- if authorized

Arguments:


When at a prompt, entering a period cancels the command.

*

OK, let’s try this command:

*setip
Unauthorized command from this console.
*

Hmmm. Let’s read the documentation:

setip
Sets new client address – if authorized.
A console is authorized to use the SetIP command only if it has a Console resource definition in both the Director and the Console. In addition, if the console name, provided on the Name = directive, must be the same as a Client name, the user of that console is permitted to use the SetIP command to change the Address directive in the Director’s client resource to the IP address of the Console. This permits portables or other machines using DHCP (non-fixed IP addresses) to “notify” the Director of their current IP address.

That first sentence is easy to follow. That second sentence… does it make sense to you? It seems to indicate that you must use bconsole on the client which has the new IP address. I think it means that you can only change the IP address of the client from which you are running bconsole.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

  2 Responses to “Bacula – client changes host name”

  1. Did you happen to get this working? If not, do you have any good resources? Thanks.

  2. I don’t think I tried.

    I took another approach: dynamic dns. See http://dan.langille.org/2013/11/25/openvpn-and-dynamic-dns/