IP Allocation not working

Hello Joe and Jamie,

I was just discussing this topic with AWBS (for a few days already) and of course with you guys. Here is what the AWBS suggested:

"In order to let VM randomly assign an ip, it would need to report back to the api the ip it assigned so we could enter that ip into AWBS.
Perhaps Jamie can add that so we can parse it out."

With that said, what would have to be done to set this in motion? If there is anything I really need working, it would be this. Here is why. If I can’t have AWBS assign the IP’s automatically, then I pretty much have to sit there and babysit new orders thus making IP range allocation pointless. Here is why…

At the moment, a client registers for a hosting package through AWBS. Then, I have the orders set to pending instead of running the master cron in AWBS. If I let the master cron run, it will process the order with desired template, assigning it the server shared IP instead of allocated IP. This is a problem because SSL and proftpd would fail during order creation in VM and even if I had those disabled to allow the order to go through, I would still need to go back to VM to enable them (ssl and proftp) and also tell VM to change the IP from the shared to allocated range IP availability. In other words, I am having to do things that are automated, manually. Orders that come in at night will now have to wait till morning for us to process them correctly. This defeats a lot of the automation from AWBS and VM.

Is there anything that the VM team can do with the AWBS team to get this going?

Thanks a bunch,
G

Virtualmin already has a couple of ways of providing the IP address assigned for new domains to AWBS. They can either :

  • Parse the output of the create-domain API call, which will contain text like "Adding virtual IP interface for 1.2.3.4"

  • Make a separate call to list-domains with the new domain name and the multiline parameter, which will include the IP address in the output in the format "IP address: 1.2.3.4"

Perhaps you could forward this information to them?

Jamie,

Thanks for the reply. I will forward that over to them. Here is what they wrote to me again while I was reading your post. I believe what Steve is asking for is what you have provided already in the previous post? I will paste that info to them and see what he says but in the meantime, here is what Steve replied with prior to me reading your post:

"Basically what I need is this:

If the package is set to automatically assign an ip upon account creation (by VM), return the ip assigned in the API return so we can parse it out and store it.

Regards,
Steve"

Let me know how they get on, or if they need any additional information from Virtualmin.

Indeed I will…thanks!!!

Jamie,

I sent the output of a server creation in debug mode to Steve at AWBS. Apparently, he says that with

"- Parse the output of the create-domain API call, which will contain text like "Adding virtual IP interface for 1.2.3.4"

…it should show this in the debug-mode option, and it’s not. He is now going to try and see if with:

"- Make a separate call to list-domains with the new domain name and the multiline parameter, which will include the IP address in the output in the format "IP address: 1.2.3.4"

…it’ll work…I’ll keep you posted

Jamie,

Steve has been working very hard on this one with me. He modified cengine.php and also had me run a few queries on the awbs database but no luck. I noticed the following though:

When creating a virtual server manually whether awbs or just straight from vm, it’ll still grabbed the main IP address. What I am thinking is that for some reason when AWBS is creating the virtual server with the ranged IP’s, it’s not actually picking them because there is nothing in the system really telling it to neither in vm. Here is why I think this. If I create a virtual server manually within vm using “Create Virtual Server” link, I would have to select the template. Now, ideally, if I select the template, it should pick an IP from the range I specified when I created the template but it’s still showing me that I must choose it explicitly in the “IP address and forwarding” section within “Create Virtual Server” or else it won’t do it. By default, “Network Interface” is set to “Shared, on MAINIPOFMYSERVER”. I guess if we could somehow make it to default to “Virtual with allocated IP”, then both AWBS and VM wouldn’t have a problem creating domains automatically with a range IP.

I know this has been answered before but just want to triple check…are we sure that I DO NOT need to setup a range on my interface itself in the Webmin module "Network Configuration"?

By default, Virtualmin will use the system’s main shared IP address for new domains. If you want to allocate a private IP, you need to pass the --allocate-ip parameter to create-domain.pl, or select ‘Virtual with allocated IP’ in the web interface.

Is AWBS setting this parameter? I’d be interested to see the full Virtualmin API command or HTTP call it is using…

Regarding the range, you do NOT need to set this up in the Network Configuration module. In fact, doing some will cause Virtualmin to not use that range of addresses, as it will assume they are already in use.

Jamie,

I am not a perl guy so setting this parameter in VM would not be something I would want to touch. I can see if I can get someone to do so or unless if you can tell me how to place the correct values in the code.

I will talk to Steve about the API to see if you can have a look. I will get back with you.

You don’t have to modify the code - all you need to do is pass an additional parameter to the create-domain.pl program, which is --allocate-ip

By the way , do you have an email address for the guy at AWBS you have been working with? Maybe I can contact him directly.

I will ask Steve for an email and I will let him know that he needs to have that additional parameter passed to that program.

Jamie,

Steve added the additional parameter to “create-domain.pl”. It is WORKINGGGGGGGGGGGGGGGGGGGG…this is niceee…I can now have AWBS create my packages automatically and also with SSL and FTP activation without worrying that it’s going to grab the main servers IP!!!..very niceee…thanks to both of you for this!!!..this is now working fantastic

Ronald,

I thought the same thing. There isn’t a way to inform AWBS of the default template because it only reads templates that actually contain the settings for particular packages. That is why I had originally place the range in each template in VM instead of in “Default Template”

Now you see what I mean…lol…oh well :-\