9 Advanced topics
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.12.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.12.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:
VBoxManage setextradata "Linux Guest" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/BindIP" "10.45.0.2"
After this, all outgoing traffic will be sent through the interface with the IP address
10.45.0.2.Please make sure that this interface is up and running prior to this assign-
ment.
Also, if you have configured port forwarding for the NAT engine as described in chapter 6.4.1, Configuring port forwarding with NAT, page 84, you can bind this con- figuration only to a particular interface as well. Assuming that you have configured port forwarding for a “guestssh” service, you would use the following additional com- mand:
VBoxManage setextradata "Linux Guest" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/BindIP" "127.0.0.1"
This would make ssh port forwarding available from host only.
139