> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pmk/how-to/how-to-identify-the-virtual-interface-of-a-pod-in-the-root-name.md).

# How-To: Identify The Virtual Interface of a Pod in the Root Namespace Using Flannel as the Network B

## Problem

Identify the virtual interface of a particular pod in the root namespace of the node using ***flannel*** as Network backend.

## Environment

* Platform9 Managed Kubernetes - All Versions
* Flannel

## Procedure

1. Use the ***docker*** command to identify the ***pause*** container for the pod as it holds the network namespace for the pod.

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

```none
# docker ps | grep -i busybox2 | grep pause

f15ae72287e0 k8s.gcr.io/pause:3.1 "/pause" 2 minutes ago Up 2 minutes k8s_POD_mybusybox2_default_2a12aac4-ed54-4c99-aa0e-be32f793f41d_0
```

{% endtab %}
{% endtabs %}

2. Run docker inspect on the container Id obtained from the above command and look for the SandboxKey to get the namespace created for the pod.

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

```none
# docker inspect f15ae72287e0 | grep -i sandboxkey

"SandboxKey": "/var/run/docker/netns/5048a1a60e3b",
```

{% endtab %}
{% endtabs %}

3. Use ***nsenter*** to get the interface details within the pod namespace.

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

```none
# nsenter --net=/var/run/docker/netns/5048a1a60e3b ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever

3: eth0@if27: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1472 qdisc noqueue state UP group default
link/ether 86:5f:a6:c3:8a:61 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.20.88.6/24 brd 10.20.88.255 scope global eth0
valid_lft forever preferred_lft forever
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Note**

***ip netns*** command can not be used for the docker namespaces as it only knows about namespaces listed in ***/var/run/netns/***
{% endhint %}

4. Run ***ethtool*** on the interface with the pod's IP in the namespace above to obtain the peer index of the *Veth*-pair for the interface

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

```none
# nsenter --net=/var/run/docker/netns/5048a1a60e3b ethtool -S eth0 | grep -i peer

peer_ifindex: 27
```

{% endtab %}
{% endtabs %}

5. List the network interface on the node (root namespace) using ***ip*** command, the interface listed at the index obtained in the above step ( 27 in this case ) is the virtual interface for the pod in the root namespace.

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

```none
# ip a
.
.
27: vetha2fb55e7@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1472 qdisc noqueue master cni0 state UP group default
link/ether b6:76:f3:c9:a4:3c brd ff:ff:ff:ff:ff:ff link-netnsid 2
inet6 fe80::b476:f3ff:fec9:a43c/64 scope link
valid_lft forever preferred_lft forever
```

{% 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://platform9.com/kb/pmk/how-to/how-to-identify-the-virtual-interface-of-a-pod-in-the-root-name.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
