> For the complete documentation index, see [llms.txt](https://prosbcdocs.telcobridges.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://prosbcdocs.telcobridges.com/telecom-references/sip-and-voip/voip-ethernet-capture.md).

# VoIP Ethernet Capture

The [Tmedia](https://telcobridges.com/media-gateways/products/tmedia-gateways/) product can configure one of its VoIP Ethernet ports to do [Port Mirroring](http://en.wikipedia.org/wiki/Port_mirroring). This is useful when investigating RTP, Codecs or IP Tones issues.

#### Preparing the Tmedia for capture (enable ports mirroring)

* If the traffic to be captured is on a 802.1Q VLAN and the [Tctrl](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/concepts/tctrl/README.md) version is >= 2.8, an IP interface with the 'MANAGEMENT' service must be created through the Web Portal. The IP interface must be assigned to a virtual port that is assigned to the capture port and uses the 802.1Q VLAN ID that is targeted by the capture.
* Access the [Tmedia](https://telcobridges.com/media-gateways/products/tmedia-gateways/) unit using SSH.
* Access the telecom baseboard from the [Tmedia](https://telcobridges.com/media-gateways/products/tmedia-gateways/) using telnet. telnet 172.31.1.1
* Type in the mv88eMonitor command to get the list of ports on the unit: mv88eMonitor
* A list (such as the one below) should appear: Port Mapping: PortDesc : eth0 eth1 voip0 voip1 mspeedsw1 mspeedsw2 fpga0 fpga1 host cpu PortNumber : 0 1 2 3 4 5 6 7 8 9 PortMask : 0x1 0x2 0x4 0x8 0x10 0x20 0x40 0x80 0x100 0x200
* The 'PortNumber' is the **destination** port for the capture.
  * If the traffic is to be captured on the **internal host** of the TMG unit, use the number below the **host** port (in the above example, 8).
  * If the traffic is to be captured on an **external host** (laptop, PC, or specialized equipment), choose the number below the desired target port (for example, 0 for eth0).
* The 'PortMask' is the **source** mask for the capture. On the above example, traffic going through the voip0 port would be captured using the 0x4 mask.
* Use the mv88eMonitor command in order to mirror traffic as desired. Here is the syntax: mv88eMonitor
  * The 'IngressPortMask' is the mask used for capturing traffic that is sent to the TMG.
  * The 'EgressPortMask' is the mask used for capturing traffic that is sent from the TMG.
  * The 'PortNumber' is where the captured traffic should be mirrored to.
  * The 'TimeoutInSeconds' is the time the mirror operation is active before being automatically stopped.
* Here is an example to mirror all the voip0 traffic to a TMG3200's internal host, for 60 seconds: mv88eMonitor 0x4 0x4 8 60
* Here is an example to mirror the incoming voip0 traffic on a TMG3200 to an external host connected to the eth1 port: mv88eMonitor 0x4 0 1 60

#### Start the capture

* Exit the telecom baseboard's shell (type "exit")
* If the capture is to be done on an external host, use a tool such as 'Wireshark' to capture and analyze the mirrored traffic.
  * When configuring a port as a mirror, it is important to connect that Ethernet port directly to a host (like a laptop). Otherwise, it could cause issues such as an Ethernet loop.
  * If capturing 802.1Q tagged traffic, make sure the receiving equipment is actually configured to process 802.1Q tagged traffic.
* If the capture is to be done on the TMG's internal host:
  * Use the [**tbinfo**](https://github.com/telcobridges-main/tmedia-wiki/tree/main/tmedia/operations/get-product-type/README.md) command to find out which product is currently used.
  * Use the following table to know on which Linux interface to capture the traffic:

| TMG800    | TMG3200  | 802.1Q capture                                         |
| --------- | -------- | ------------------------------------------------------ |
| **mgmt0** | **int0** | **vlanXXXX**, where XXXX is the VLAN ID (e.g. vlan333) |

* Use the "tcpdump" tool to capture mirrored packets: tcpdump -i mgmt0 -s 1500 -w capture\_file.cap
* To capture 802.1Q tagged traffic, use the correct VLAN interface: tcpdump -i vlan333 -s 1500 -w capture\_file.cap

#### Stop the Capture

When you're ready, stop the capture by

* pressing control-C on the shell that was running tcpdump command
* Access the telecom baseboard from the [Tmedia](https://telcobridges.com/media-gateways/products/tmedia-gateways/) using telnet. telnet 172.31.1.1
* Stop the capture mv88eMonitor 0 0 0

#### Download the Capture

To download the capture, use SSH secure copy ("sftp") to the Tmedia management port. This can be done on Windows using tools like Filezilla.

### Procedure

* [VoIP Ethernet Capture for v3.2](https://github.com/telcobridges-main/tmedia-wiki/tree/main/tmedia/configuration/tmedia-tdev-and-tsig-web-portal-3-2-troubleshooting/README.md#voip-ethernet-capture)
* [VoIP Ethernet Capture for v3.0](https://github.com/telcobridges-main/tmedia-wiki/tree/main/tmedia/configuration/tmedia-tdev-and-tsig-web-portal-3-0-troubleshooting/README.md#voip-ethernet-capture)
* [VoIP Ethernet Capture for v2.10](https://github.com/telcobridges-main/tmedia-wiki/tree/main/tmedia/configuration/tmedia-tdev-and-tsig-web-portal-2-10-troubleshooting/README.md#voip-ethernet-capture)
* [VoIP Ethernet Capture for v2.9](https://github.com/telcobridges-main/tmedia-wiki/tree/main/tmedia/configuration/web-portal-2-9-troubleshooting/README.md#voip-ethernet-capture)
* [VoIP Ethernet Capture for v2.8](https://github.com/telcobridges-main/tmedia-wiki/tree/main/tmedia/configuration/web-portal-2-8-troubleshooting/README.md#voip-ethernet-capture)
* [VoIP Ethernet Capture for v2.7](https://github.com/telcobridges-main/tmedia-wiki/tree/main/tmedia/configuration/tmedia-tsig-and-tdev-web-portal-2-7-tutorial-guide/README.md#voip-ethernet-capture)


---

# 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://prosbcdocs.telcobridges.com/telecom-references/sip-and-voip/voip-ethernet-capture.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.
