Creating a FreePBX server template for several deployments

My goal is to have a FreePBX VM that I could keep up to date and that acts as my template when I want deploy a new VOIP server.

I tried this today and ran into a problem.

My template is the latest FreePBX distro that is shutdown before the initial admin password wizard is run on the Web UI.
The IP was already set during the CLI installation.

I cloned this VM to a new VMware machine for testing.
I changed the MAC, IP and hostname in the CLI.
All of the settings in FreePBX are configured with the new IP.

When it came time to provision the first phone (using HTTP), the phone screen showed as trying to pull its configuration from the IP of the template server.

So my question is: Is there a viable way to create new FreePBX servers from a template without problems? How would I check which configuration is making the phone attempt to pull its config from the IP of the template?

I’m currently running a recursive grep on my server to find old traces of the template IP address.

We later tried to provision through TFTP with a DHCP option 66 and it worked flawlessly with the new IP of the server that was deployed from the template.

Any input would be greatly appreciated.

1 Like

Look in your template in EPM I bet you have the old IP in their. That gets set from install of the module

The only IP is in Global Settings and it is correct. Is there anywhere else I can look? The GREP is still running.

Ok but what do you mean your phone has the old IP then? I am confused

Lets say I created my template with the IP 192.168.1.10.
I then cloned this template server to a new VM.
I set the IP of the new VM to 192.168.1.11.

When everything is said and done (Extensions, Users, Apps, etc.) and I go to provision a phone for the new FreePBX server (192.168.1.11), the phone still attempts to pull its configuration from the IP address of the template (192.168.1.10).

Hence, either the FreePBX distro doesn’t like to be cloned, or I missed a configuration change somewhere.

Your still not making sense. As you have to tell the phone how to reach the PBX. So you would need to tell the phone how to find the new PBX.

We are using Sangoma phones. We have a deployment in our Sangoma portal that points to the IP of the new server (192.168.1.11). The phone, which is part of the deployment, is still trying to grab its config from the old IP (192.168.1.10).

The only relation that the phone has to the IP 192.168.1.10 is that it was the IP of the template server used to create the new server.

Now, when you setup a new FreePBX VM, right after all of the packages have installed it runs you through a wizard where you get to specify the IP address. Is there any way to re-run that wizard?

Have you factory reset the phone? That may be the issue.

Yes. We had factory reset the phone many times. We also manually updated the firmware to the latest stable version.
We also tried rebooting the server, still no luck.

If the phone gets provisioned with TFTP it works fine, but not HTTP. It still points to the IP of the template.

It boggles my mind. This is why I believe that there are still traces of the old IP still in there.

That doesn’t make sense. The file that is delivered to the phone is the same, regardless of the protocol - it’s /tftpboot/cfgMAC.xml

How do you know this?

Also, I’d check your DHCP server, to make sure you’re not sending option 66, which will override anything in portal.

The wizard just sets the IP address in Endpoint Manager -> General Settings, which I assume you would have already changed?

Because when the phone boots up it shows the provisioning server as the old IP.

Option 66 is how we got it working, thats the TFTP method.

Yes, this is set to the correct IP (192.168.1.11)

If you are using redirect server then you must have in our portal the wrong IP set as that is a internal IP so you must be setting it in the portal with the wrong IP. Anyways this is something with your setup you need to figure out and has nothing to do with your cloning a machine.

1 Like

The correct public and private IP is configured. We never configured 192.168.1.10 in our portal or the server.

OK, so maybe I’m asking the wrong question. What makes you think the cloning has anything to do with it?

From what I can gather, you’re factory resetting a phone, and then it’s immediately trying to connect to the wrong IP address. Why do you believe that has something to do with cloning a VM?

Edit: Have you checked the contents of the config file?

We have checked the config file and the correct IP is there. For some reason when we try to provision the phone using HTTP the wrong IP always shows up.

The only relation between the new server and the 192.168.1.10 IP is that it belonged to the template server from which the new server was created from.

We never even activated the template server. We never setup the admin password for it. The minute it the template server was able to be accessed via the web, we shut it down and cloned it to make the new server.

Nowhere have we ever configured 192.168.1.10. Not on our firewalls, not on our Sangoma portal.
When we cloned the VM, the new server didn’t get an IP because of the MAC address change. I had to edit the network scripts file with the correct name and MAC.

So based on our findings, we are assuming that there are still some traces of the old IP (192.168.1.10) that is still on the new server. I mean, theres no other way that the phone would even know to look for its config at 192.168.1.10. This is why I’m GREP’ing the entire file system of the new server for the template IP. It just doesn’t make any sense.

Can you expand what you mean by this? I’m guessing you mean ‘not using option 66’, but what exactly are you doing? Please be extremely verbose.

In the new server, the provisioning protocol is HTTP and the authentication is set to “None”. No DHCP options are specified.
When we boot the phone, on the bottom of the screen, it shows trying to provision itself using the IP of the template server (192.168.1.10). Please note that we never configured this IP anywhere else but on the template server which is offline at this point.

Since that process doesn’t work we tried testing with the DHCP option 66. This method works and when the phone boots it provisions itself from the correct server (192.168.1.11).

Does this happen after a factory reset? If so, does making sure both machines are turned off give the correct IP address?

Eg: Turn off both machines. Factory reset the phone. Look at the screen.

Yes it does.

I will have to test this when I get back to the office, its currently night time for me. Thanks for the quick replies thus far.

1 Like

I’m off to Linux.conf.au tomorrow, so my replies may be slightly delayed 8)