How to get the ID of the router to which the VM is attached?

asked 2019-02-04 08:50:23 -0600

vathanlal gravatar image


In a project in our OpenStack environment we have lot of VM's and there are couple of virtual routers also. From Horizon looking at the Network topology I can identify the ID of the router to which the VM I am trouble shooting is attached. But I want to do it from command line. Guys what is the easiest method to do this??

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-02-04 19:28:10 -0600

Note that a VM can be connected to more than one network, and a network can be connected to more than one router. Ergo, a VM can be connected to numerous routers.

Step 1: The command openstack server show tells you the network(s) to which the instance is connected. See the field addresses.

Step 2: The command openstack router show tells you the network(s) to which a router is connected. Alternatively, you should be able to add network information to the openstack router list command, using the -c option, but I currently don't know exactly what is the correct column name.

Another option for step 2 is openstack port list. You can add device_owner and device_id to the columns. Device-owner tells you which ports are owned by a router, and device_id tells you which router that is. The networks that ports are connected to are also displayed.

Step 1 gave the list of the networks to which the instance is connected, and step 2 the list of the routers including their networks. You need to combine the two.

I would agree that it is easier to use a network diagram. A great illustration of "a picture says more than a thousand words".

edit flag offensive delete link more


The problem is in step two it is difficult to find the correct router ID for openstack router show because I have plenty of routers in the project I am troubleshooting. I dont want to do openstack router show on all routers one by one to see the correct router.

vathanlal gravatar imagevathanlal ( 2019-02-05 02:47:10 -0600 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2019-02-04 08:50:23 -0600

Seen: 370 times

Last updated: Feb 04 '19