test

Page 163

9 Advanced topics

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 a better performance. This can by achieved using the following commands (values are in kilobytes and can range from 8 to 1024): VBoxManage modifyvm "VM name" --natsettings1 16000,128,128,0,0

This example illustrates tuning the NAT settings. The first parameter is the MTU, then the size of the socket’s send buffer and the size of the socket’s receive buffer, the initial size of the TCP send window, and lastly the initial size of the TCP receive window. Note that specifying zero means fallback to the default value. Each of these buffers has a default size of 64KB and default MTU is 1500.

9.12.4 Binding NAT sockets to a specific interface By default, VirtualBox’s NAT engine will route TCP/IP packets through the default interface 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 modifyvm "VM name" --natbindip1 "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 assignment.

9.12.5 Enabling DNS proxy in NAT mode The NAT engine by default offers the same DNS servers to the guest that are configured on the host. In some scenarios, it can be desirable to hide the DNS server IPs from the guest, for example when this information can change on the host due to expiring DHCP leases. In this case, you can tell the NAT engine to act as DNS proxy using the following command: VBoxManage modifyvm "VM name" --natdnsproxy1 on

9.12.6 Using the host’s resolver as a DNS proxy in NAT mode For resolving network names, the DHCP server of the NAT engine offers a list of registered DNS servers of the host. If for some reason you need to hide this DNS server list and use the host’s resolver settings, thereby forcing the VirtualBox NAT engine to intercept DNS requests and forward them to host’s resolver, use the following command: VBoxManage modifyvm "VM name" --natdnshostresolver1 on

Note that this setting is similar to the DNS proxy mode, however whereas the proxy mode just forwards DNS requests to the appropriate servers, the resolver mode will interpret the DNS requests and use the host’s DNS API to query the information and return it to the guest. 9.12.6.1 User-defined host name resolving In some cases it might be useful to intercept the name resolving mechanism, providing a userdefined IP address on a particular DNS request. The intercepting mechanism allows the user to map not only a single host but domains and even more complex namings conventions if required. The following command sets a rule for mapping a name to a specified IP:

163


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.