Network settings (including SSH) for new VirtualBox VM

Stolen from here.

To get access to the Internet from the guest, enable the NAT network adapter.

On VM, open up settings->Network
In adapter 1, enable network adapter and use attached to NAT

To get SSH access to the guest VM, we need to give it a static IP and be accessible to the host.

  • On VirtualBox, open up (general) preferences -> network Add a host-only network (if none exist)
  • Configure the host-only network with an IP address (eg 192.168.56.1)
  • Optionally enable the DHCP server and make sure to leave room for static addresses (e.g. by setting lower address bound to 192.168.56.101)
  • On the guest VM settings -> Network, activate a second adapter and use attached to Host-only Adapter with the name of the network you have defined globally (usually vboxnet0)
  • Note down the MAC address (visible in the advanced section) Boot VM and add the network interface

Add a network interface: create a file ifcfg-eth1 in /etc/sysconfig/network-scripts (or an alternative ethn name).

Fill it up with

DEVICE=eth1
HWADDR=08:00:27:0B:74:DE
BOOTPROTO=static
IPADDR=192.168.56.100
NETMASK=255.255.255.0
ONBOOT=yes
NM_CONTROLLED=yes

Make sure to change DEVICE if you use a different ethn name. Make sure to replace HWADDR with the MAC address that you copied from adapter 2. Finally, make sure the static address is not within the range of DHCP addresses. I my example 192.168.56.100 would do fine. Reboot for good measure, you should be able to access the guest from the host at 192.168.56.100.

Bringing up VirtualBox interface

Stolen from https://jekil.sexy/blog/2014/bringing-up-virtualbox-interface-before-starting-cuckoo.html

# VBoxManage hostonlyif create
# ip link set vboxnet0 up
# ip addr add 192.168.56.1/24 dev vboxnet0

Elasticsearch performance tuning

First, see here.

Edit /etc/environment and add ES_HEAP_SIZE=1g. Edit /etc/sysctl.conf and add:

fs.file-max=32000 vm.max_map_count=262144

Edit /etc/security/limits.conf and add root - nofile 32000. Edit /opt/elasticsearch/config/elasticsearch.yml and set bootstrap.mlockall: true.

Finally, restart the VM.

GitHub – jonyt

Jon Yom-Tov