For development they recommend using a virtual machine to run a single Riak node and they have a handy guide on how to set it up.
While following the guide I came across a few things that weren’t very clear when it came to configuring the Ubuntu guest with a static IP so I thought I’d post some clarification here in case anyone comes this way via Google.
Step 8 of the guide:
You will find a line saying something like iface eth0 inet dhcp. Replace this line with the following lines.
iface eth0 inet static
The new IP address of your virtual machine is on the second line. We have chosen the IP address192.168.1.200 because it is likely above the range that the router DHCP uses for dynamic allocation, so there should be little risk that it is in use. Note that this is an assumption based on common default settings in routers. If you get problems with this you should double-check your subnet settings in the router.
Just to clarify, the static IP address must be outside the range used by your router or it won’t work. Also, the gateway address should be the IP of your router.
What they don’t mention is that for DNS lookup to work you need to specify a nameserver in
For a typical home network this will be the IP address of your router:
Or you can specify the particular servers you want to use:
nameserver 18.104.22.168 nameserver 22.214.171.124
While you don’t need really need DNS if you’re just using the VM as a Riak node, later on in the guide it tells you to use wget to download the Riak package which you won’t be able to do if you don’t have a working DNS.
The changes you make to
/etc/resolv.conf will be overwritten by the dhcp client next time you boot the VM so if you want them to be permanent you can just remove the dhcp client. On Ubuntu server 12.04 the package is called isc-dhcp-client.
sudo apt-get remove isc-dhcp-client
Don’t forget to restart networking after you’re done:
sudo /etc/init.d/networking restart