> For the complete documentation index, see [llms.txt](https://docs.platform9.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.platform9.com/managed-openstack/accessing-vm/accessing-vms-vmware-vnc.md).

# Enabling VNC on Existing KVM Instances

This article outlines the steps needed to enable VNC on existing virtual machines.

## KVM

### Step 1 - Shutdown the Instance

SSH into the host where the virtual machine of interest resides. To shut down the virtual machine gracefully, invoke the following command on the terminal:

{% tabs %}
{% tab title="Bash" %}

```bash
virsh shutdown test-vm
```

{% endtab %}
{% endtabs %}

where test-vm is the name of the virtual machine.

Check to see if the instance is in the shut off state by invoking the following:

{% tabs %}
{% tab title="Bash" %}

```bash
virsh list --all
```

{% endtab %}
{% endtabs %}

You may also SSH into the instance and power off the instance from the terminal.

If all else fails, you may want to shutdown the instance ungracefully.

{% hint style="warning" %}
**Warning**

This is the equivalent of pulling the power cord
{% endhint %}

{% tabs %}
{% tab title="Bash" %}

```bash
virsh destroy test-vm
```

{% endtab %}
{% endtabs %}

### Step 2 - Edit the Virtual Machine's XML Configuration

After verifying that the instance is shut off, open the instance's XML configuration:

{% tabs %}
{% tab title="Bash" %}

```bash
virsh edit test-vm
```

{% endtab %}
{% endtabs %}

Add the following inside the `<devices>` element:

It should look similar to this:

{% tabs %}
{% tab title="Bash" %}

```bash
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'>
  <listen type='address' address='127.0.0.1'/>
  </graphics>
```

{% endtab %}
{% endtabs %}

### Step 3 - Start the Instance

Start the instance after saving the configuration:

{% tabs %}
{% tab title="Bash" %}

```bash
virsh start test-vm
```

{% endtab %}
{% endtabs %}

To verify whether the configuration succeeded, run the following on the terminal:

{% tabs %}
{% tab title="Bash" %}

```bash
virsh vncdisplay test-vm
```

{% endtab %}
{% endtabs %}

You should see something similar to this:

{% tabs %}
{% tab title="Bash" %}

```bash
root@localhost:~# virsh vncdisplay test-vm
127.0.0.1:0
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.platform9.com/managed-openstack/accessing-vm/accessing-vms-vmware-vnc.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
