How to add wireshark to the ndsdn-tutorial?

I am now analyzing the experiment and need to use Wireshark tool to analyze the data packets of each P4 switch,

but I don’t know how to use Wireshark in the docker environment in ONOS tutorial to view the data packets of specific switches.

I would be very grateful if I could get help!

The main problems are as follows:

I enter mininet’s container, can’t download Wireshark, and can’t use sudo.

image

Hi,

For this particular use case I recommend either onos-dev mail list or the repository itself since the question is not as much related to P4. I will answer anyway.

Some time ago, I prepared a script for this use case:

#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

if [ -z $2 ]; then
  echo "usage: $0 host"
  exit 1
fi

file=$3.pcap

set -e

echo "*** Starting tcpdump on ${iface}... Ctrl-c to stop capture"
echo "*** Pcap file will be written in ngsdn-tutorial/tmp/${file}"
docker exec -it $1 tcpdump -i $2 -w /tmp/"${file}"

docker cp $1:/tmp/"${file}" $HOME/ngintent-scenario/util

if [ -x "$(command -v wireshark)" ]; then
  echo "*** Opening wireshark... Ctrl-c to quit"
  wireshark "${DIR}/../tmp/${file}"
fi

I think I used t run it as:

script.sh container_name interface_name file_name

Place the script code at a file name script.sh in util folder. Give execution rights (chmod +x). In this way you can run tcpdump at the container, then use the typical interface names used by mininet like s2-eth0 and so on and give it a name to the pcap file. After you sniff come packets, type CONTROL+C and the pcap will be available at util folder. Then you can open it with the VM Wireshark.

Cheers,

Thank you,

ederollora,

Your answer is too timely. Thank you again. I will try to solve the problem with this solution

Maybe my English is a little poor.

Hi friends,

I want to connect to the virtual host in mininet for testing in the ngsdn-tutorial, but it doesn’t seem to support xterm in docker. I want to know how to connect to the terminal of mininet virtual host.Or is there any way to install xterm under mininet in docker?

Thank you!

Hi,

Since the question is not directly related to P4, I recommened you ask the question here: Issues · opennetworkinglab/ngsdn-tutorial · GitHub . Other users can also help in the repository tab I linked :slight_smile:

To prevent from leaving you without an answer… did you try to connect to the container bash terminal and then to the host? Not sure if I tried it in the past because of the lack of xterm.

I will reference myself in a previous answer in the repository tab for issues:

You can still get a direct CLI to the host (without using Mininet).

The first thing is to access Mininet container CLI:
sudo docker exec -it mininet bash

To get a CLI for h1a or any name:
lsns | grep h1a -m1 | awk '{print $4}'

The number from the previous command should replace PID_HERE:
nsenter --target PID_HERE --mount --uts --ipc --net --pid

Cheers,