Unable to ssh to instance after creation - no route to host

asked 2019-04-01 08:07:34 -0500

marievi gravatar image

I am trying to build a server instance inside an Openstack controller VM. The steps I use are the following:

PART A: Create and configure a disk on my host machine, as root:

1. qemu-img create -f qcow2 /var/lib/libvirt/xenial.qcow2 10G
2. cd /var/lib/libvirt/images    //I have downloaded the ubuntu ISO here
3. virt-install --virt-type kvm --name xenial --ram 4024   --cdrom=ubuntu-16.04.1-server-amd64.iso   --disk /var/lib/libvirt/xenial.qcow2,format=qcow2   --network network=default   --graphics vnc,listen= --noautoconsole   --os-type=linux --os-variant=ubuntu16.04
4. install ubuntu according to: https://docs.openstack.org/image-guide/ubuntu-image.html
5. virsh start xenial

PART B: Inside the created VM:

6. Set proxy settings as I work for a company and we have a proxy policy:

   In ~/.bashrc:

   In /etc/apt/apt-conf:
       Acquire::http::proxy "...";
       Acquire::https::proxy "...";

(as root):
7. apt-get install cloud-init
8. dpkg-reconfigure cloud-init (everything is selected in the prompt, I just press Enter)
9. /sbin/shutdown -h now

PART C: On my host machine as root again, to clean up the VM and transfer it to Openstack:

10. virt-sysprep -d xenial
11. virsh undefine xenial

PART D: Inside Openstack Controller VM:

13 . admin-openrc
14. openstack flavor create --id 42 --vcpus 1 --ram 4000 --disk 11 m1.ok
15. openstack image create --file="./xenial.qcow2" --container-format=bare --disk-format=qcow2 xenial-image
16. openstack server create --flavor m1.ok --image xenial-image   --nic net-id={PROVIDER'S_NETWORK_ID} --security-group default --key-name mykey xenial-instance

After these steps, the instance gets created and gets a floating IP:

root@controller:~# openstack server list
| ID            | Name            | Status  |    Networks            | Image         | Flavor  |
| {...ID...}    | xenial-instance | ACTIVE  | provider= | xenial-image   | m1.ok   |

I can ping to the created VM, but when I try to ssh into the VM using the floating IP, I get the following:

ssh: connect to host port 22: No route to host

The default security group's rules are:

root@controller:~# openstack security group rule list default
| ID                                   | IP Protocol | IP Range  | Port Range  | Remote Security Group |
| 13c1bd61-d3cb-474d-a161-8c0d795bb20e | None        | None      |             | None                  |
| 1ed0cb55-c28a-4946-8197-1680803012c0 | tcp         | | 49997:49997 | None                  |
| 271ed550-ad5a-41f0-b0e3-9c4ff19fcbc3 | icmp        | |             | None                  |
| 8218978e-71d3-42cd-9be7-c71e9cf18001 | None        | None      |             | None                  |
| fda7b84b-f570-4d35-991a-0f5f9c6fccd9 | tcp         | | 22:22       | None                  |

Any ideas why I am unable to ssh?

edit retag flag offensive close merge delete


Use the instance’s console log to check if it gets an IP address. My guess: There is no DHCP server on the provider network, and the instance tries unsuccessfully to find out its address.

By the way, this is not called a Floating IP.

Bernd Bausch gravatar imageBernd Bausch ( 2019-04-01 09:20:11 -0500 )edit

What do you mean "instance's console log"? The thing is, I have built another instance exactly the same way and I can ssh successfully.

marievi gravatar imagemarievi ( 2019-04-01 09:45:58 -0500 )edit

I mean openstack console log show xenial-instance. Perhaps it helps you understand how the two instances differ?

Bernd Bausch gravatar imageBernd Bausch ( 2019-04-01 10:36:45 -0500 )edit

I ran the command for both instances but they show nothing at all...

marievi gravatar imagemarievi ( 2019-04-02 01:54:35 -0500 )edit

Then something is wrong with your setup, but perhaps you can access the live console? Get the URL from openstack console url show xenial-instance and put it in a browser. However, the browser must have have a route to this URL.

Or access the console from the OpenStack dashboard.

Bernd Bausch gravatar imageBernd Bausch ( 2019-04-02 05:14:22 -0500 )edit