{"id":740,"date":"2016-01-13T22:43:03","date_gmt":"2016-01-13T21:43:03","guid":{"rendered":"http:\/\/www.opencloudblog.com\/?p=740"},"modified":"2021-01-16T13:41:01","modified_gmt":"2021-01-16T12:41:01","slug":"openstack-juno-neutron-deployment-part-6-start-vm","status":"publish","type":"post","link":"https:\/\/www.opencloudblog.com\/?p=740","title":{"rendered":"OpenStack Liberty Neutron Deployment (Part 6 start a VM in the tenant defined network)"},"content":{"rendered":"<p>Now it is time to start a VM. Up to now, no DHCP server is running for the tenant&#8217;s network n1.<\/p>\n<pre class=\"lang:sh decode:true\" title=\"Start a VM\">#\n# first we need the ID of the image to be used\n#\nglance image-list\n+--------------------------------------+-----------------------+-------------+------------------+-----------+--------+\n| ID                                   | Name                  | Disk Format | Container Format | Size      | Status |\n+--------------------------------------+-----------------------+-------------+------------------+-----------+--------+\n| a13badd0-28a6-4d2a-a05b-7c064b747b7e | Cirros 64 Bit         | qcow2       | bare             | 13167616  | active |\n+--------------------------------------+-----------------------+-------------+------------------+-----------+--------+\n#\n# get the network ID for the nic\n#\nneutron net-list | grep -w n1\n+--------------------------------------+---------------------+------------------------------------------------------+\n| id                                   | name                | subnets                                              |\n+--------------------------------------+---------------------+------------------------------------------------------+\n| 53fa05ef-9a39-4c30-825f-485bf9480388 | n1                  | a107c408-08e2-4158-b75b-4ed74abc4e18 192.168.1.0\/24  |\n+--------------------------------------+---------------------+------------------------------------------------------+\n#\n# list the flavors\n#\nnova flavor-list\n+----+------------+-----------+------+-----------+------+-------+-------------+-----------+\n| ID | Name       | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |\n+----+------------+-----------+------+-----------+------+-------+-------------+-----------+\n| 30 | Cirros     | 256       | 1    | 0         |      | 1     | 1.0         | True      |\n+----+------------+-----------+------+-----------+------+-------+-------------+-----------+\n#\n# now boot the VM\n#\nnova boot --image a13badd0-28a6-4d2a-a05b-7c064b747b7e --flavor Cirros --nic net-id=53fa05ef-9a39-4c30-825f-485bf9480388 testvm1\n\n<\/pre>\n<p>After starting the VM, the set up looks like:<\/p>\n<div id=\"attachment_837\" style=\"width: 951px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-837\" class=\"size-large wp-image-837\" src=\"http:\/\/www.opencloudblog.com\/wp-content\/uploads\/2015\/02\/cnsn-vm1-1-1920x1175.png\" alt=\"After staring the first VM\" width=\"941\" height=\"576\" srcset=\"https:\/\/www.opencloudblog.com\/wp-content\/uploads\/2015\/02\/cnsn-vm1-1-1920x1175.png 1920w, https:\/\/www.opencloudblog.com\/wp-content\/uploads\/2015\/02\/cnsn-vm1-1-150x92.png 150w, https:\/\/www.opencloudblog.com\/wp-content\/uploads\/2015\/02\/cnsn-vm1-1-960x588.png 960w, https:\/\/www.opencloudblog.com\/wp-content\/uploads\/2015\/02\/cnsn-vm1-1-768x470.png 768w, https:\/\/www.opencloudblog.com\/wp-content\/uploads\/2015\/02\/cnsn-vm1-1.png 1921w\" sizes=\"(max-width: 941px) 100vw, 941px\" \/><p id=\"caption-attachment-837\" class=\"wp-caption-text\">After staring the first VM<\/p><\/div>\n<p>The following components have been configured:<\/p>\n<p>On the network node:<\/p>\n<ul>\n<li>neutron starts a DHCP server on the network node to provide a DHCP service for the tenants&#8217;s network n1. This DHCP server runs in it&#8217;s own network namespace [qdhcp-*] and is attached to Vlan 3.<\/li>\n<\/ul>\n<p>On the compute node:<\/p>\n<ul>\n<li>Allocate a Vlan on br-int from the free list of vlans. This Vlan is associated and attached to the global vxlan id 0x10001. As no vlans have been used before, vlan 1 is used.<\/li>\n<li>On br-tun mapping entries are created to map the local vlan id 1 to the global vxlan id 0x10001.<\/li>\n<li>The VM is not attached directly to br-int. The reason is, that there is no mechanism to attach iptable rules to an ovs port. iptable rules are used to implement the Openstack security groups. The workaround is to create a linux bridge, attach the tap interface of the vm to the linux bridge and attach the linux bridge using a veth pair to br-int.<\/li>\n<li>Start the VM<\/li>\n<\/ul>\n<h1>Attach a floating IP<\/h1>\n<pre class=\"lang:sh decode:true \" title=\"Allocate\/attach a floating IP\">#\n# allocate a floating IP requires a floating IP (must be created) and a port id\n#\nneutron net-external-list\n+--------------------------------------+---------------------+-----------------------------------------------------+\n| id                                   | name                | subnets                                             |\n+--------------------------------------+---------------------+-----------------------------------------------------+\n| f79385f6-e878-4450-9ed9-e906f6985149 | floating-198-18-0   | 7b9a75c2-fbbc-455b-9aa7-1a1bf286571e 198.18.0.0\/20  |\n| 97d1c4c7-c5a2-4399-9d12-cf9bf6bef739 | floating-198-18-16  | 3af17d23-8229-4022-a49f-f8b41939adc9 198.18.16.0\/20 |\n+--------------------------------------+---------------------+-----------------------------------------------------+\n#\nneutron floatingip-create f79385f6-e878-4450-9ed9-e906f6985149\nneutron floatingip-list\n+--------------------------------------+------------------+---------------------+---------+\n| id                                   | fixed_ip_address | floating_ip_address | port_id |\n+--------------------------------------+------------------+---------------------+---------+\n| a0a7dea2-4461-4005-94d6-8ebcc5e5ebbf |                  | 198.18.0.3          |         |\n+--------------------------------------+------------------+---------------------+---------+\n\n#\n# get the fixed IP of the VM\n#\nnova list\n+--------------------------------------+---------+--------+------------+-------------+----------------+\n| ID                                   | Name    | Status | Task State | Power State | Networks       |\n+--------------------------------------+---------+--------+------------+-------------+----------------+\n| 189d0c60-d6ad-4652-b61c-bea390c6c507 | testvm1 | ACTIVE | -          | Running     | n1=192.168.1.2 |\n+--------------------------------------+---------+--------+------------+-------------+----------------+\n#\n# list all neutron ports\n#\nneutron port-list\n#\nneutron port-list\n+--------------------------------------+------+-------------------+------------------------------------------------------------------------------------+\n| id                                   | name | mac_address       | fixed_ips                                                                          |\n+--------------------------------------+------+-------------------+------------------------------------------------------------------------------------+\n| 11db8e63-6d88-404a-93a1-1d741568ad36 |      | fa:16:3e:2b:26:f1 | {\"subnet_id\": \"a107c408-08e2-4158-b75b-4ed74abc4e18\", \"ip_address\": \"192.168.1.1\"} |\n| b4370b20-d588-4109-b681-b4f600062e2f |      | fa:16:3e:b4:c8:c9 | {\"subnet_id\": \"a107c408-08e2-4158-b75b-4ed74abc4e18\", \"ip_address\": \"192.168.1.3\"} |\n| f609efc7-15a3-4928-9785-88bfcecd858c |      | fa:16:3e:84:09:ff | {\"subnet_id\": \"a107c408-08e2-4158-b75b-4ed74abc4e18\", \"ip_address\": \"192.168.1.2\"} |\n+--------------------------------------+------+-------------------+------------------------------------------------------------------------------------+\n#\n# associate the floating ip\n#\nneutron floatingip-associate a0a7dea2-4461-4005-94d6-8ebcc5e5ebbf f609efc7-15a3-4928-9785-88bfcecd858c<\/pre>\n<p>The set up is now:<\/p>\n<div id=\"attachment_838\" style=\"width: 951px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-838\" class=\"size-large wp-image-838\" src=\"http:\/\/www.opencloudblog.com\/wp-content\/uploads\/2015\/02\/cnsn-floating1-1-1920x1175.png\" alt=\"Add a floating IP address for the VM\" width=\"941\" height=\"576\" srcset=\"https:\/\/www.opencloudblog.com\/wp-content\/uploads\/2015\/02\/cnsn-floating1-1-1920x1175.png 1920w, https:\/\/www.opencloudblog.com\/wp-content\/uploads\/2015\/02\/cnsn-floating1-1-150x92.png 150w, https:\/\/www.opencloudblog.com\/wp-content\/uploads\/2015\/02\/cnsn-floating1-1-960x588.png 960w, https:\/\/www.opencloudblog.com\/wp-content\/uploads\/2015\/02\/cnsn-floating1-1-768x470.png 768w, https:\/\/www.opencloudblog.com\/wp-content\/uploads\/2015\/02\/cnsn-floating1-1.png 1921w\" sizes=\"(max-width: 941px) 100vw, 941px\" \/><p id=\"caption-attachment-838\" class=\"wp-caption-text\">Add a floating IP address for the VM<\/p><\/div>\n<p>The floating IP address of the VM is attached as an additional IP address on the uplink of the router. In addition 1:1 NAT rules are created on the router to provide a unique mapping for the fixed IP address of the VM.<\/p>\n<p><a title=\"Part 6\" href=\"http:\/\/www.opencloudblog.com\/?p=796\">Continue reading (part 7)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now it is time to start a VM. Up to now, no DHCP server is running for the tenant&#8217;s network n1. # # first we need the ID of the image to be used # glance image-list +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8211;+ | ID | Name | Disk Format | Container Format | Size | Status | +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8211;+ | [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"_links":{"self":[{"href":"https:\/\/www.opencloudblog.com\/index.php?rest_route=\/wp\/v2\/posts\/740"}],"collection":[{"href":"https:\/\/www.opencloudblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.opencloudblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.opencloudblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.opencloudblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=740"}],"version-history":[{"count":14,"href":"https:\/\/www.opencloudblog.com\/index.php?rest_route=\/wp\/v2\/posts\/740\/revisions"}],"predecessor-version":[{"id":840,"href":"https:\/\/www.opencloudblog.com\/index.php?rest_route=\/wp\/v2\/posts\/740\/revisions\/840"}],"wp:attachment":[{"href":"https:\/\/www.opencloudblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.opencloudblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.opencloudblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}