WIN10最简步骤配置本地X server通过SSH X11 forwarding访问虚拟机图形程序

本文详细介绍了在Windows 10环境下,如何通过X11转发功能实现在WSL Ubuntu和VirtualBox虚拟机中运行图形界面程序的过程。重点讲解了Xserver的选择与配置,以及SSH的X11转发设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

背景说明

我的环境清单:

  • Win10宿主机
  • WSL Ubuntu 20.04 UWP
  • Virtual Box 6.1下使用mininet-2.2.2镜像文件创建的虚拟机

起因是按照mininet官网说明执行虚拟机内的wireshark, 这需要在宿主机上运行X server, 开启WSL下SSH的X11 forwarding功能, 并连接到虚拟机, 之后即可正常运行虚拟机内的图形程序

配置步骤
  • X server

X server 在Win10下主要有两种开源实现:

Xming和vcxsrv, 前者内置捐赠, 等于变相付费, 后者免费并且使用Windows原生VS C++进行编译, 无脑选2

由此下载vsxsrv

下载完成后点击开始菜单XLaunch一路默认即可

  • 开启客户端和服务端X11 forwarding

X11 forwarding needs to be enabled on both the client side and the server side.

On the client side, the -X (capital X) option to ssh enables X11 forwarding, and you can make this the default (for all connections or for a specific conection) with ForwardX11 yes in ~/.ssh/config.

On the server side, X11Forwarding yes must specified in /etc/ssh/sshd_config. Note that the default is no forwarding (some distributions turn it on in their default /etc/ssh/sshd_config), and that the user cannot override this setting.

以上引自此链接

所以主要是设置好WSL的sshd配置文件

  • 大功告成, 执行ssh
ssh -X mininet@mininet-vm
最终效果

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值