# Vagrant / DevStack Network Configuration Hints Various hints I found for properly configuring a Vagrant host-only network with DevStack. The goals are: 1. DevStack is accessible via it's given private IP 2. VMs launched in DevStack are also accessable via IPs from their range ### Fix DNS resolution (required?) Found here: http://askubuntu.com/questions/238040/how-do-i-fix-name-service-for-vagrant-client Might be an ubuntu 12.04 bug only. In `Vagrantfile` (on the host): ```ruby vm.provider :virtualbox do |vb| # Allow DNS to work for Ubuntu 12.10 host vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] end ``` ### Fix DNS resolution (alternative) Found here: http://getcloudify.org/2014/05/13/devstack-vagrant-tutorial-localrc.html Should be an alternative to the above option, and sets the Google DNS server (`8.8.8.8`) as a sane default: ```bash neutron subnet-update public-subnet --dns_nameservers list=true 8.8.8.8 neutron subnet-update private-subnet --dns_nameservers list=true 8.8.8.8 ``` ### Allow Guest to talk to each other Found here: https://github.com/openstack-dev/devstack-vagrant/blob/master/Vagrantfile In `Vagrantfile` (on the host): ```ruby vm.provider :virtualbox do |vb| # you need this for openstack guests to talk to each other vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"] end ``` ### Allow Ping / SSH / HTTP-ing to guests Found here: http://www.cloudsoftcorp.com/blog/2013/05/getting-started-with-heat-devstack-vagrant/ Optional: changes the default nova security group: ```bash $ nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0 $ nova secgroup-add-rule default tcp 22 22 0.0.0.0/0 $ nova secgroup-add-rule default tcp 80 80 0.0.0.0/0 $ nova secgroup-list-rules default +-------------+-----------+---------+-----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+-----------+--------------+ | icmp | -1 | -1 | 0.0.0.0/0 | | | tcp | 22 | 22 | 0.0.0.0/0 | | | tcp | 80 | 80 | 0.0.0.0/0 | | +-------------+-----------+---------+-----------+--------------+ ``` ### Bridge Network Traffic Found here: http://www.cloudsoftcorp.com/blog/2013/05/getting-started-with-heat-devstack-vagrant/ In your `local.conf` (on the guest): ``` # Network configuration. HOST_IP should be the same as the IP you used # for the private network in your Vagrantfile. The combination of # FLAT_INTERFACE and PUBLIC_INTERFACE indicates that OpenStack should # bridge network traffic over eth1. HOST_IP=172.16.0.2 HOST_IP_IFACE=eth1 FLAT_INTERFACE=br100 PUBLIC_INTERFACE=eth1 FLOATING_RANGE=172.16.0.224/27 ``` ### Fix Routing on DevStack Found here: http://getcloudify.org/2013/12/23/setting_up_devstack_havana_on_your_local_network.html Fix routing (on the guest) temporarily...: ```bash sudo bash echo 1 > /proc/sys/net/ipv4/ip_forward echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE ``` ...or permanently in `/etc/sysctl.conf`: ``` net.ipv4.conf.eth0.proxy_arp = 1 net.ipv4.ip_forward = 1 ``` ### Fix Routing on the host (not required?) Found here: http://getcloudify.org/2014/05/13/devstack-vagrant-tutorial-localrc.html Should not be required once the Vagrant networking is properly configured. However, it is suggested here to do this before `vagrant up`: ```bash sudo /sbin/route add -net 10.0.2.0 netmask 255.255.255.0 gw 171.15.19.31 sudo /sbin/route add -net 172.24.4.0 netmask 255.255.255.0 gw 171.15.19.31 vagrant up ``` ## Resources Most interesting / helpful / insightful: * https://github.com/cloudbau/devstack-chef/blob/master/Vagrantfile * https://github.com/lorin/devstack-vm * http://www.cloudsoftcorp.com/blog/2013/05/getting-started-with-heat-devstack-vagrant/ Basic guides: * http://devstack.org/guides/single-machine.html * http://getcloudify.org/2014/05/13/devstack-vagrant-tutorial-localrc.html * http://getcloudify.org/2014/05/07/devstack-heat-openstack-cloud.html > Written with [StackEdit](https://stackedit.io/).