beautypg.com

3 tuning tcp/ip buffers for nat, 4 binding nat sockets to a specific interface, Terface – Sun Microsystems VIRTUALBOX VERSION 3.1.0_BETA2 User Manual

Page 149

background image

9 Advanced topics

This command would reserve the network addresses 192.168.0.0 ...

192.168.254.254

for the first NAT network instance of “My VM”. The guest IP

would be assigned to 192.168.0.15 and the default gateway could be found at
192.168.0.2

.

9.13.2 Configuring the boot server (next server) of a NAT network

interface

For network booting in NAT mode, by default VirtualBox uses a built-in TFTP server
at the IP address 10.0.2.3. This default behavior should work fine for typical remote-
booting scenarios. However, it is possible to change the boot server IP and the location
of the boot image with the following commands:

VBoxManage setextradata "Linux Guest"

"VBoxInternal/Devices/pcnet/0/LUN#0/Config/NextServer" 10.0.2.2

VBoxManage setextradata "Linux Guest"

"VBoxInternal/Devices/pcnet/0/LUN#0/Config/BootFile"

/srv/tftp/boot/MyPXEBoot.pxe

9.13.3 Tuning TCP/IP buffers for NAT

The VirtualBox NAT stack performance is often determined by its interaction with the
host’s TCP/IP stack and the size of several buffers (SO_RCVBUF and SO_SNDBUF). For
certain setups users might want to adjust the buffer size for better performance. This
can by achieved using the following commands (values are in kilobytes and can range
from 8 to 1024):

VBoxManage setextradata "Linux Guest"

"VBoxInternal/Devices/pcnet/0/LUN#0/Config/SocketRcvBuf" 128

VBoxManage setextradata "Linux Guest"

"VBoxInternal/Devices/pcnet/0/LUN#0/Config/SocketSndBuf" 128

VBoxManage setextradata "Linux Guest"

"VBoxInternal/Devices/pcnet/0/LUN#0/Config/TcpRcvSpace" 128

VBoxManage setextradata "Linux Guest"

"VBoxInternal/Devices/pcnet/0/LUN#0/Config/TcpSndSpace" 128

Each of these buffers has a default size of 64KB.

9.13.4 Binding NAT sockets to a specific interface

By default, VirtualBox’s NAT engine will route TCP/IP packets through the default
port assigned by the host’s TCP/IP stack. (The technical reason for this is that the NAT
engine uses sockets for communication.) If, for some reason, you want to change this
behavior, you can tell the NAT engine to bind to a particular IP address instead. Use
the following command:

149