我使用的是 mininet 版本 2.1.0。我的设置是这样的,我必须运行 mininet 来自远程机器的命令,例如
ssh -X 用户@IP python mininet.py
X11转发好像没问题。 X 转发不能仅在 mininet shell 中工作,但可以在 SSH shell 中工作。
但是,我无法在 mininet 上运行 xterm 命令。我没有得到任何 运行 xterm 命令后的输出。
mininet> pingall
*** Ping: testing ping reachability
h1 -> h2 h3
h2 -> h1 h3
h3 -> h1 h2
*** Results: 0% dropped (6/6 received)
mininet> xterm h1
mininet> h1 xterm
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted in
this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm: Xt error: Can't open display: %s
当我从本地计算机启动 mininet 时,xterm 会工作并打开一个 新窗口。
在这种情况下我应该在哪里查找 xterm 相关日志?
我已经在这上面花了一天多了。我也更新了mininet版本到最新的2.2.1,但是还是没有成功。
提前致谢!
“h1 xterm”命令在 mininet 控制台下不起作用的原因是:
如果您运行:“h1 echo $DISPLAY $XAUTHORITY”,则两个重要的 xterm 相关环境变量( $XAUTHORITY 、 $DISPLAY )不会传递到 mininet 控制台;两个变量都将返回空白。
为了保持主机环境变量不变,请在 mn 命令中添加 -E 参数。 “sudo -E mn”,然后就可以成功运行“h1 xterm”了。
当我迁移到 Ubuntu 18.04 时,Mininet xterm 停止工作。 我所做的只是在 Ubuntu 中安装 xterm“sudo apt install xterm”。 之后我启动了 mininet (sudo mn) 并调用 mininet>xterm h1。 xterm 窗口像往常一样弹出。 希望这会有所帮助。
你必须先设置显示,从远程计算机(我假设你的Windows PC),安装xming服务器来设置和显示MININET代码结果,>>运行xlunch>>选择显示编号>>然后使用ssh或putty登录并在选定的显示中显示结果,它对我来说效果很好。
对于所有来到这篇文章寻找如何跑步答案的人
mininet> xterm h1
echo $DISPLAY
mininet> xterm h1
步骤:
xauth list $DISPLAY
sudo -s
xauth add LINE_YOU_COPIED_IN_STEP1