# VBoxManage dhcpserver

VBoxManage-dhcpserver

1

VBoxManage-dhcpserver

DHCP server management

&product-name;

          VBoxManage dhcpserver add

            --network=netname
            --interface=ifname

          --server-ip=address
          --netmask=mask
          --lower-ip=address
          --upper-ip=address

            --enable
            --disable

            --global
            --set-opt=dhcp-opt-no value
            --set-opt-hex=dhcp-opt-no hexstring
            --force-opt=dhcp-opt-no
            --suppress-opt=dhcp-opt-no
            --min-lease-time=seconds
            --default-lease-time=seconds
            --max-lease-time=seconds

            --group=name
            --set-opt=dhcp-opt-no value
            --set-opt-hex=dhcp-opt-no hexstring
            --force-opt=dhcp-opt-no
            --suppress-opt=dhcp-opt-no
            --incl-mac=address
            --excl-mac=address
            --incl-mac-wild=pattern
            --excl-mac-wild=pattern
            --incl-vendor=string
            --excl-vendor=string
            --incl-vendor-wild=pattern
            --excl-vendor-wild=pattern
            --incl-user=string
            --excl-user=string
            --incl-user-wild=pattern
            --excl-user-wild=pattern
            --min-lease-time=seconds
            --default-lease-time=seconds
            --max-lease-time=seconds

            --vm=name|uuid
            --nic=1-N
            --set-opt=dhcp-opt-no value
            --set-opt-hex=dhcp-opt-no hexstring
            --force-opt=dhcp-opt-no
            --suppress-opt=dhcp-opt-no
            --min-lease-time=seconds
            --default-lease-time=seconds
            --max-lease-time=seconds
            --fixed-address=address

            --mac-address=address
            --set-opt=dhcp-opt-no value
            --set-opt-hex=dhcp-opt-no hexstring
            --force-opt=dhcp-opt-no
            --suppress-opt=dhcp-opt-no
            --min-lease-time=seconds
            --default-lease-time=seconds
            --max-lease-time=seconds
            --fixed-address=address

          VBoxManage dhcpserver modify

            --network=netname
            --interface=ifname

          --server-ip=address
          --lower-ip=address
          --upper-ip=address
          --netmask=mask

            --enable
            --disable

            --global
            --del-opt=dhcp-opt-no
            --set-opt=dhcp-opt-no value
            --set-opt-hex=dhcp-opt-no hexstring
            --force-opt=dhcp-opt-no
            --unforce-opt=dhcp-opt-no
            --suppress-opt=dhcp-opt-no
            --unsuppress-opt=dhcp-opt-no
            --min-lease-time=seconds
            --default-lease-time=seconds
            --max-lease-time=seconds
            --remove-config

            --group=name
            --set-opt=dhcp-opt-no value
            --set-opt-hex=dhcp-opt-no hexstring
            --force-opt=dhcp-opt-no
            --unforce-opt=dhcp-opt-no
            --suppress-opt=dhcp-opt-no
            --unsuppress-opt=dhcp-opt-no
            --del-mac=address
            --incl-mac=address
            --excl-mac=address
            --del-mac-wild=pattern
            --incl-mac-wild=pattern
            --excl-mac-wild=pattern
            --del-vendor=string
            --incl-vendor=string
            --excl-vendor=string
            --del-vendor-wild=pattern
            --incl-vendor-wild=pattern
            --excl-vendor-wild=pattern
            --del-user=string
            --incl-user=string
            --excl-user=string
            --del-user-wild=pattern
            --incl-user-wild=pattern
            --excl-user-wild=pattern
            --zap-conditions
            --min-lease-time=seconds
            --default-lease-time=seconds
            --max-lease-time=seconds
            --remove-config

            --vm=name|uuid
            --nic=1-N
            --del-opt=dhcp-opt-no
            --set-opt=dhcp-opt-no value
            --set-opt-hex=dhcp-opt-no hexstring
            --force-opt=dhcp-opt-no
            --unforce-opt=dhcp-opt-no
            --suppress-opt=dhcp-opt-no
            --unsuppress-opt=dhcp-opt-no
            --min-lease-time=seconds
            --default-lease-time=seconds
            --max-lease-time=seconds
            --fixed-address=address
            --remove-config

            --mac-address=address
            --del-opt=dhcp-opt-no
            --set-opt=dhcp-opt-no value
            --set-opt-hex=dhcp-opt-no hexstring
            --force-opt=dhcp-opt-no
            --unforce-opt=dhcp-opt-no
            --suppress-opt=dhcp-opt-no
            --unsuppress-opt=dhcp-opt-no
            --min-lease-time=seconds
            --default-lease-time=seconds
            --max-lease-time=seconds
            --fixed-address=address
            --remove-config

          VBoxManage dhcpserver remove

            --network=netname
            --interface=ifname

          VBoxManage dhcpserver start

            --network=netname
            --interface=ifname

          VBoxManage dhcpserver restart

            --network=netname
            --interface=ifname

          VBoxManage dhcpserver stop

            --network=netname
            --interface=ifname

          VBoxManage dhcpserver findlease

            --network=netname
            --interface=ifname

          --mac-address=mac

## Description

The `dhcpserver` commands enable you to control the DHCP server that is built into &product-name;. You may find this useful when using internal or host-only networking. Theoretically, you can also enable it for a bridged network, but that may cause conflicts with other DHCP servers in your physical network.

### Common options

The subcommands of `dhcpserver` all operate on an internal network that can be identified via its name or in the host-only case via the host-only interface name:

--network=`netname`

- The internal network name. This is the same name you would supply to the `VBoxManage modifyvm --intnet` option when configuring a VM for internal networking. The internal network name can be found labelled as VBoxNetworkName in the output of the following commands: `VBoxManage list intnets`, `VBoxManage list natnets`, or `VBoxManage list hostonlyifs`.

--interface=`ifname`

- The host only interface name. This is the same value would supply to the `VBoxManage modifyvm --host-only-adapter` option when configuring a VM to use a host-only network. The value can also be found labelled as Name in the output of the `VBoxManage list hostonlyifs` command.

### dhcpserver add

Adds a new DHCP server to a network or host-only interface.

Options configuring the DHCP server core:

`--server-ip=`address``

- The IP address the DHCP server should use.

`--lower-ip=`address``, `--upper-ip=`address``

- The IP address range for the DHCP server to manage. This should not include the address of the DHCP server itself, but it must be in the same network. The boundaries are inclusive, so both the lower and upper addresses will be handed out to clients.

`--netmask=`mask``

- The network mask. Typically 255.255.255.0.

`--enable`, --disable

- Whether to enable the DHCP server or disable it. If not specified, the server will be created in a disabled state and no IP addresses will be handed out.

Options selecting the scope:

`--global`

- Set the configuration scope to global. Any subsequent `--set-opt` options will be applied to all the DHCP clients.

`--vm=`vmname|uuid``

- Set the configuration scope to the first NIC of the specified VM. Any subsequent `--set-opt` options will apply just to that interface, nothing else.

`--nic=`1-N``

- Set the configuration scope to a NIC other than the first NIC of the VM specified in the `--vm` option.

`--mac-address=`address``

- Set the configuration scope to the specified MAC address.

`--group=`name``

- Set the configuration scope to the specified group.

Options configuring the currently selected scope:

`--set-opt=`dhcp-opt-no value``

- Adds the specified DHCP option number (0-255) and value. The value format is option specific (typically human readable) and will be validated by the API and the DHCP server.

`--set-opt-hex=`dhcp-opt-no hexstring``

- Adds the specified DHCP option number (0-255) and value. The option value is specified as a raw series of hex bytes optionally separated by colons. No validation is performed on these by the API or the DHCP server, they will be passed as specified to the client.

`--force-opt=`dhcp-opt-no``

- Forces the specified DHCP option number (0-255) to be sent to the client whether it requested it or not (provided the option is configured with a value at some level).

`--suppress-opt=`dhcp-opt-no``

- Prevents the specified DHCP option number (0-255) from being sent to the client when present in this or a higher configuration scope.

`--min-lease-time=`seconds``

- Sets the minimum lease time for the current scope in seconds. Zero means taking the value from a higher option level or use the default value.

`--default-lease-time=`seconds``

- Sets the default lease time for the current scope in seconds. Zero means taking the value from a higher option level or use the default value.

`--max-lease-time=`seconds``

- Sets the maximum lease time for the current scope in seconds. Zero means taking the value from a higher option level or use default.

`--fixed-address=`address``

- Fixed address assignment for a `--vm` or `--mac-address` configuration scope. Any empty `address` turns it back to dynamic address assignment.

Options configuring group membership conditions (excludes overrides includes):

`--incl-mac=`address``

- Include the specific MAC address in the group.

`--excl-mac=`address``

- Exclude the specific MAC address from the group.

`--incl-mac-wild=`pattern``

- Include the specific MAC address pattern in the group.

`--excl-mac-wild=`pattern``

- Exclude the specific MAC address pattern from the group.

`--incl-vendor=`string``

- Include the specific vendor class ID in the group.

`--excl-vendor=`string``

- Exclude the specific vendor class ID from the group.

`--incl-vendor-wild=`pattern``

- Include the specific vendor class ID pattern in the group.

`--excl-vendor-wild=`pattern``

- Exclude the specific vendor class ID pattern from the group.

`--incl-user=`string``

- Include the specific user class ID in the group.

`--excl-user=`string``

- Exclude the specific user class ID from the group.

`--incl-user-wild=`pattern``

- Include the specific user class ID pattern in the group.

`--excl-user-wild=`pattern``

- Exclude the specific user class ID pattern from the group.

### dhcpserver modify

The `dhcpserver modify` command modifies an existing DHCP server configuration. It takes the same options as the `add` command with the addition of the following options which have variable configuration scope:

`--del-opt=`dhcp-opt-no``

- Counterpart to `--set-opt` that will cause the specified DHCP option number (0-255) to be deleted from the server settings. Similar to `--set-opt` the scope of the deletion is governed by the `--global`, `--vm`, `--mac-address` and `--group` options.

`--unforce-opt=`dhcp-opt-no``

- Removes the specified DHCP option number (0-255) from the forced option list (i.e. the reverse of `--force-opt`). Similar to `--set-opt` the scope of the deletion is governed by the `--global`, `--vm`, `--mac-address` and `--group` options.

`--unsuppress-opt=`dhcp-opt-no``

- Removes the specified DHCP option number (0-255) from the suppressed option list (i.e. the reverse of `--suppress-opt`). Similar to `--set-opt` the scope of the deletion is governed by the `--global`, `--vm`, `--mac-address` and `--group` options.

`--remove-config`

- Removes the configuration currently being scoped. The `--global` scope is not removable. The configuration scope will change to `--global` after this option.

And the addition of these group membership condition options:

`--del-mac=`address``

- Delete the specific MAC address from the group conditions.

`--del-mac-wild=`pattern``

- Delete the specific MAC address pattern from the group conditions.

`--del-vendor=`string``

- Delete the specific vendor class ID from the group conditions.

`--del-vendor-wild=`pattern``

- Delete the specific vendor class ID pattern from the group conditions.

`--del-user=`string``

- Delete the specific user class ID from the group conditions.

`--del-user-wild=`pattern``

- Delete the specific user class ID pattern from the group conditions.

`--zap-conditions`

- Deletes all the group conditions.

### dhcpserver remove

Removes the specified DHCP server.

### dhcpserver start

Start the specified DHCP server.

### dhcpserver restart

Restarts the specified DHCP server. The DHCP server must be running.

### dhcpserver stop

Stops the specified DHCP server.

### dhcpserver findlease

Performs a lease database lookup. This is mainly for getting the IP address of a running VM.

`--mac-address=`mac``

- The MAC address to lookup in the lease database.

### Common DHCP Options: