VirtualBox/RancherOS with fixed ip

I’m new to Rancher and RancherOS and try to do some testing with it.

Having a machine running on Debian (3.16) and VirtualBox (5.0.10) I created VMs using docker machine with boot2docker. I was able to get a rancher-server (192.168.99.60) and some host-0x (192.168.99.6x) running.

Since there seems to be an issue with duplicate hosts after reboots (https://github.com/rancher/rancher/issues/936#issuecomment-109722750) I want to use the latest RancherOS. But now I can not figure out a way to set a fixed ip for the VMs (tried sudo ros config set rancher.network.interfaces.eth0.address … etc).

What am I missing?

Thanks for your help
Daniel

So, what you actually need is assign 2 NICs to the RancherOS VM on VirtualBox:

  • eth0: NAT - for Internet access
  • eth1: host-only network - for communication between the host and the VMs

To do that, you need to create a host-only network in VirtualBox, configure the IP address range and (optionally) DHCP and choose it for NIC #2 on all RancherOS VMs you want in one virtual network.

If you want, you can configure RancherOS to use static IP on eth1:

sudo ros config set rancher.network.interfaces.eth1.address "172.19.8.101/24"

and reboot or just restart networking, like this:

sudo system-docker restart network

BTW, don’t use 172.17.*, 172.18.*, 10.0.2.* IP addresses on eth1 or you will suffer!

Good information!
One addition is to also disable dhcp. On the current version dhcp was set to true and that overrode the address setting.
sudo ros config set rancher.network.interfaces.eth1.dhcp false