Create, modify, and manage a NAT network.
VBoxManage natnetwork add [ --disable | --enable ] <--netname=name> <--network=network> [--dhcp=on|off] [--ipv6=on|off] [--loopback-4=rule] [--loopback-6=rule] [--port-forward-4=rule] [--port-forward-6=rule]
VBoxManage natnetwork modify [--dhcp=on|off] [ --disable | --enable ] <--netname=name> <--network=network> [--ipv6=on|off] [--loopback-4=rule] [--loopback-6=rule] [--port-forward-4=rule] [--port-forward-6=rule]
The VBoxManage natnetwork command enables you to create, modify and manage a NAT network.
NAT networks use the Network Address Translation (NAT) service. The service groups systems into a network and prevents external systems from directly accessing the systems in the network. The service also enables the systems in the network to communicate with each other and with external systems by means of TCP and UDP over IPv4 and IPv6.
A NAT service is attached to an internal network. For a VM to use the NAT service, you must attach the VM to the internal network. Specify the name of the internal network when you create the NAT service. Note that the internal network is created if it does not already exist.
VBoxManage natnetwork add [ --disable | --enable ] <--netname=name> <--network=network> [--dhcp=on|off] [--ipv6=on|off] [--loopback-4=rule] [--loopback-6=rule] [--port-forward-4=rule] [--port-forward-6=rule]
The VBoxManage natnetwork add command creates a new internal network interface, and adds a NAT network service. You must use this command before you can attach the VM to the NAT network.
--disable
Disables the NAT network service.
--enable
Enables the NAT network service.
--netname=name
Specifies the name of the new internal network interface on the host OS.
--network
Specifies the static or DHCP network address and mask of the NAT service interface. By default, this value specifies the static network address.
--dhcp
Enables or disables the DHCP server that you specify by
using the --netname option.
--ipv6
Enables or disables IPv6. By default, IPv6 is disabled and IPv4 is enabled.
--loopback-4=rule
Enables an IPv4 loopback interface by using the specified rule.
--loopback-6=rule
Enables an IPv6 loopback interface by using the specified rule.
--port-forward-4=rule
Enables IPv4 port forwarding by using the rule specified
by rule.
--port-forward-6=rule
Enables IPv6 port forwarding by using the rule specified
by rule.
VBoxManage natnetwork modify [--dhcp=on|off] [ --disable | --enable ] <--netname=name> <--network=network> [--ipv6=on|off] [--loopback-4=rule] [--loopback-6=rule] [--port-forward-4=rule] [--port-forward-6=rule]
The VBoxManage natnetwork modify command modifies the settings of an existing internal network interface.
--disable
Disables the NAT network service.
--enable
Enables the NAT network service.
--netname=name
Specifies the name of the new internal network interface on the host OS.
--network
Specifies the static or DHCP network address and mask of the NAT service interface. By default, this value specifies the static network address.
--dhcp
Enables or disables the DHCP server that you specify by
using the --netname option.
--ipv6
Enables or disables IPv6. By default, IPv6 is disabled and IPv4 is enabled.
--loopback-4=rule
Enables an IPv4 loopback interface by using the specified rule.
--loopback-6=rule
Enables an IPv6 loopback interface by using the specified rule.
--port-forward-4=rule
Enables IPv4 port forwarding by using the rule specified
by rule.
--port-forward-6=rule
Enables IPv6 port forwarding by using the rule specified
by rule.
The following command shows how to create a NAT network for the
natnet1 internal network that uses the
192.168.15.0/24 network address and mask of the
NAT service interface. In this static configuration, the gateway
is assigned the 192.168.15.1 IP address by
default. Note that this IP address is the next address after the
network address that you specify with the
--network option.
$ VBoxManage natnetwork add --netname natnet1 --network "192.168.15.0/24" --enable
The following command shows how to add a DHCP server to the
natnet1 NAT network after creation:
$ VBoxManage natnetwork modify --netname natnet1 --dhcp on