Skip to main content
IMHCloud Logo
Back to support home

Detaching Network Interfaces from OpenStack Instances

Learn how to safely detach network interfaces from running OpenStack instances using Horizon and CLI, with key considerations to prevent connectivity loss.

Introduction

Detaching network interfaces from instances allows you to disconnect virtual machines from specific networks when those connections are no longer needed. This operation is useful when restructuring your network architecture, decommissioning networks, or reconfiguring instance connectivity without rebuilding the entire instance.

This guide shows you how to safely detach network interfaces from running instances using both the Horizon dashboard and the OpenStack command-line interface (CLI).

Prerequisites

Before detaching network interfaces, ensure you have:

  • An active InMotion Cloud account with at least one running instance
  • Horizon dashboard access or OpenStack CLI installed and configured
  • Administrative permissions to modify instance network configurations
  • Identification of the specific network interface or port to detach
  • Confirmation that removing the interface will not break critical connectivity

Key Considerations Before Detaching

Detaching network interfaces requires careful planning to avoid disrupting your instance connectivity:

Primary Interface Protection

Never detach the primary network interface if it provides the only route to your instance. Doing so will leave the instance unreachable, requiring console access or a complete rebuild to recover connectivity.

Verify Interface Count

Before detaching, confirm your instance has multiple network interfaces. If only one interface exists, detaching it will completely isolate the instance from all networks.

Check interface count in Horizon by navigating to the instance's Interfaces tab, or use the CLI:

1openstack port list --server <instance-name-or-id>

Active Connections

Detaching an interface immediately terminates all active network connections using that interface. Ensure no critical services, database connections, or active SSH sessions rely on the interface you plan to remove.

Port Deletion

When you detach a network interface, OpenStack removes the associated port from the Neutron database. If you need to preserve port configurations (security groups, fixed IPs, etc.), document them before detaching.

Detaching Interfaces Using Horizon

The Horizon dashboard provides a straightforward method for detaching network interfaces with visual confirmation.

Step 1: Navigate to Instances

Log in to your OpenStack Horizon dashboard and navigate to Project > Compute > Instances.

Step 2: Open Instance Actions

Locate the instance from which you want to detach a network interface. Click the dropdown arrow in the Actions column for that instance.

Step 3: Select Detach Interface

From the Actions menu, select Detach Interface. This opens the interface detachment dialog.

Step 4: Choose the Port to Remove

In the Port dropdown menu, select the specific port you want to detach. The dropdown displays each port with its associated network name and IP address to help you identify the correct interface.

Warning: Carefully verify you are selecting the correct port. Detaching the wrong interface can disconnect critical services.

Step 5: Confirm Detachment

Click Detach Interface to complete the operation.

The interface is removed immediately. The port disappears from the instance's interface table within a few seconds.

Detaching Interfaces Using CLI

The OpenStack CLI provides precise control for detaching interfaces, allowing you to specify ports by ID or IP address.

Detach by Port ID

To detach a specific port from an instance:

1openstack server remove port <instance-name-or-id> <port-id>

Example:

1openstack server remove port web-server-01 a1b2c3d4-e5f6-7890-abcd-ef1234567890

Detach by IP Address

To detach an interface by its IP address:

1openstack server remove fixed ip <instance-name-or-id> <ip-address>

Example:

1openstack server remove fixed ip web-server-01 192.168.1.100

Note: If the instance has multiple ports on the same network, this command detaches all ports with that IP address. Use the port ID method for precise control.

List Ports Before Detaching

To identify the correct port ID before detaching:

1openstack port list --server <instance-name-or-id>

This displays all ports attached to the instance with their IDs, IP addresses, MAC addresses, and associated networks.

View Port Details

For detailed information about a specific port:

1openstack port show <port-id>

This shows the port's security groups, fixed IPs, and device owner, helping you confirm it is safe to detach.

Verifying Detachment

After detaching an interface, verify it was removed successfully from both OpenStack and the instance operating system.

Check in Horizon

Navigate to Project > Compute > Instances, click on your instance name, and select the Interfaces tab. The detached interface should no longer appear in the list.

Check Using CLI

List remaining ports attached to the instance:

1openstack port list --server <instance-name-or-id>

The detached port should not appear in the results.

Verify the port was deleted from Neutron:

1openstack port show <port-id>

This should return an error indicating the port no longer exists.

Verify Inside the Instance

SSH into your instance and confirm the network interface no longer appears in the operating system:

Linux:

1ip addr show

Windows (PowerShell):

1Get-NetAdapter

The removed interface should disappear from the interface list, though a system reboot may be required on some operating systems.

Troubleshooting Common Issues

Cannot Detach Interface: "Detach Prohibited"

Cause: You are attempting to detach the last remaining interface on the instance.

Solution: OpenStack prevents you from completely isolating an instance by detaching all network interfaces. You must attach a replacement interface before detaching the current one, or delete the instance entirely.

Detached Interface Still Appears in Instance OS

Cause: The operating system has not released the network interface configuration.

Solution: Restart the network service inside the instance, or reboot the instance to fully remove the interface:

Linux:

1sudo systemctl restart networking

Or reboot:

1sudo reboot

Instance Becomes Unreachable After Detachment

Cause: You detached the primary interface or the only interface with a route to your management network.

Solution: Use the Horizon console to access the instance, then reattach a network interface with proper connectivity. Alternatively, rebuild the instance from a snapshot if console access is unavailable.

Port Detachment Fails with "Port in Use"

Cause: The port may be locked or in use by another process.

Solution: Verify the port is attached to the correct instance:

1openstack port show <port-id>

If the port is attached to a different instance, you are targeting the wrong port. If it shows the correct instance but still fails, try stopping the instance before detaching:

1openstack server stop <instance-name-or-id>
2openstack server remove port <instance-name-or-id> <port-id>
3openstack server start <instance-name-or-id>

Related Resources

Related Articles

Read article

Attaching Network Interfaces to OpenStack Instances

Learn how to attach additional network interfaces to running OpenStack instances using Horizon dashboard and CLI commands for multi-network configurations.

Read article

Configuring Multiple Network Interfaces Inside Your OpenStack Instance

Learn how to configure multiple network interfaces at the operating system level inside your OpenStack instances for Linux and Windows systems.