简体   繁体   English

如何在mininet上运行wireshark?

[英]How to run wireshark on mininet?

I am trying to run wireshark on mininet using a ssh session but it does not work I have this error : 我试图使用ssh会话在mininet上运行wireshark但它不起作用我有这个错误:

  error: XDG_RUNTIME_DIR not set in the environment.

and also this error : 还有这个错误:

  (wireshark:1945): Gtk-WARNING **: cannot open display:

I will appreciate your help thanks !! 我将感谢您的帮助,谢谢!

1) Make sure the ssh connection is started with -X or -Y option. 1)确保使用-X或-Y选项启动ssh连接。 Example: ssh -X usernme@ipaddress 示例:ssh -X usernme @ ipaddress

2) Restart the ssh connection, that is just exit and log in again! 2)重新启动ssh连接,即退出并再次登录!

Make sure you've added an host-only network adapter and connected it to the VM. 确保已添加仅主机网络适配器并将其连接到VM。

In order to so this on Virtual Box: 为了在Virtual Box上这样做:

  1. Open the VirtualBox preferences menu by clicking on File → Preferences 单击File → Preferences打开VirtualBox首选项菜单

  2. Click on Network 单击“ Network

  3. Click on the tab Host-only Network 单击“ Host-only Network ”选项卡

  4. Click on Add (the small green “plus” icon on the right side of the window) 单击Add (窗口右侧的绿色小“加”图标)

An adapter called vboxnet0 will be created. 将创建一个名为vboxnet0的适配器。 The default settings should be acceptable 默认设置应该是可以接受的

Then, from the VM settings assign the adapter to the Macine: 然后,从VM设置将适配器分配给Macine:

  1. Click on the VM 单击VM

  2. Click on Settings 单击“ Settings

  3. Click on Network 单击“ Network

  4. Change Network Adapter to be attached to "Host-only Adapter" 更改要连接到“仅主机适配器”的网络适配器

    • You can also use Adapter 2 and leave Adapter 1 connected by NAT to the Internet 您还可以使用Adapter 2并将通过NAT连接的Adapter 1保留在Internet上
  5. Make sure the adapter you've just added is selected 确保选中刚刚添加的适配器

Only then, you'll be able to connect to the VM with ssh -X usernme@ipaddress as @shr wrote. 只有这样,你才能用@shr写的ssh -X usernme@ipaddress连接到VM。

If you ran info more issues, please read the setup notes 如果您运行了更多信息,请阅读设置说明

I got the same error like the ones mentioned in the question. 我得到的问题与问题中提到的错误相同。

In my fix(after you ssh -X usernme@ipaddress), I changed to directory mininet/util and ran the shell script install.sh. 在我的修复程序中(在你使用ssh -X usernme @ ipaddress之后),我改为目录mininet / util并运行了shell脚本install.sh。 So basically 所以基本上

  1. cd mininet/util. cd mininet / util。
  2. sh install.sh. sh install.sh。
  3. "sudo wireshark &". “sudo wireshark&”。 to start wireshark and you will get warning, just hit Ok 启动wireshark,你会收到警告,只需点击确定

对于你想要观察的每个主机(比方说h1):在mininet上: xterm h1xterm h1 xterm上尝试: wireshark-gtk而不是wireshark

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM