Assigning IP address via shell

I am trying to use the --ip option in a create-domain shell call. Here’s what the docs say on the subject

“To create a virtual server with a private IP address, you can use the --ip option to specify it explicitly. If your Virtualmin is configured to automatically allocate IP addresses, use the --allocate-ip option instead, to have a free address chosen from the allocation ranges. If you want to use a virtual IP that is already active on the system, you must add the --ip-already command-line option.”

I read that to mean that if I use --ip (any ip address) then virtualmin should create a virtual server on that ip address. When I use this command I get the following error:

“The virtual interface IP address is already in use”

I can add the ip address in the “Addresses and Networking - Shared IP Addresses” and then use the option --shared-ip and it works fine - that’s not what I’m trying to do.

I want to assign an ip address from script without having to log into Virtualmin and type it in the shared box.

Is this possible?


A reason might be:

When you specify the “–ip” option, VMin will not only create the server with that IP assigned, but will also try to create a new virtual eth device, like “eth0:0” in your system (depending on the setting “Base number for virtual interfaces” in System Settings -> Virtualmin Configuration -> Advanced options), and assign that the given IP.

If you already have that IP assigned to a virtual eth, you also need to specify “–ip-already” so VMin will not try to create it.

Thank you,

That did it,

It would be nice to see this in the docs - would have saved a few hours of trouble shooting

You’re welcome. :slight_smile:

Well, actually, that information already is in the documentation, although maybe not as extensive as I put it. :slight_smile: It reads: “If you want to use a virtual IP that is already active on the system, you must add the --ip-already command-line option.”

“Active” here means what I described: the IP is already assigned to a virtual eth.

how to use this option
–ip-already IP
–ip-already interface

When i use “–ip-already IP” (Where IP is valid ip address)
it shows unknown parameter “IP”
please mail at

IP = 123.456.789.123 (use your real IP)

“–ip-already 123.456.789.123”

tried that but it is showing error
Unknown parameter 123.456.789.123

actually i am trying to create virtual server using cmd only