Manage host-only network interfaces.
The VBoxManage hostonlyif command enables you to change the IP configuration of a host-only network interface. For a description of host-only networking, see Section 6.7, “Host-Only Networking”. Each host-only network interface is identified by a name and can either use the internal DHCP server or a manual IP configuration, both IPv4 and IPv6.
VBoxManage hostonlyif ipconfig <ifname> [ --dhcp | --ip=IPv4-address [--netmask=IPv4-netmask] | --ipv6=IPv6-address [--netmasklengthv6=length] ]
The VBoxManage hostonlyif ipconfig command configures a host-only interface.
ifname
Specifies the name of the network interface. The name is
of the form
vboxnetN
where N is the interface
instance.
--dhcp
Uses DHCP for the network interface.
You cannot use this option with the --ip,
--ipv6, --netmask, and
--netmasklengthv6 options.
--ip=IPv4-address
Specifies the IPv4 IP address for the network interface.
You cannot use this option with the
--dhcp, --ipv6, and
--netmasklengthv6 options.
--netmask=IPv4-netmask
Specifies the IPv4 netmask of the network interface. The
default value is 255.255.255.0.
You can use this option only with the
--ip option.
--ipv6=IPv6-address
Specifies the IPv6 IP address for the network interface.
You cannot use this option with the
--dhcp, --ip, and
--netmask options.
--netmasklengthv6=length
Specifies the length of the IPv6 network interface. The
default value is 64.
You can use this option only with the
--ipv6 option.
VBoxManage hostonlyif create
The VBoxManage hostonlyif create command
creates a new host-only network interface on the host operating
system (OS). The network interface name is of the form
vboxnetN where
N is the interface instance. You must
run this command before you can attach virtual machines (VMs) to
the host-only network.
VBoxManage hostonlyif remove <ifname>
The VBoxManage hostonlyif remove command removes the specified host-only network interface from the host OS.
ifname
Specifies the name of the network interface. The name is
of the form
vboxnetN
where N is the interface
instance.
The following command creates a new host-only network interface.
$ VBoxManage hostonlyif create 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Interface 'vboxnet2' was successfully created
The following command configures the IPv4 address for the
vboxnet2 host-only network interface.
$ VBoxManage hostonlyif ipconfig vboxnet2 --ip 10.0.2.18