【问题标题】:why qemu open a lot of UDP port为什么qemu打开很多UDP端口
【发布时间】:2014-03-04 01:39:23
【问题描述】:

当我启动来宾操作系统时,netstat anp 命令显示有很多 UDP 端口被打开。启动命令是:

./qemu-system-i386 -cpu host -smp 1 -m 1024 -hda win2008.qcow2 -usb -usbdevice tablet \
    -vnc :1 -net nic,macaddr=00:16:3e:1d:f2:6f -net user \
    -net nic,macaddr=00:16:3e:51:a7:be -net tap,ifname=tap_M,script=qemu-ifup,downscript=no \
    -enable-kvm

客户操作系统是win2008。

netstat anp 输出如下所示:

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
udp        0      0 0.0.0.0:33076           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:53045           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:53046           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:50487           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:36151           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:58167           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:44856           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:34104           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:38200           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:46393           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:45369           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:60218           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:40762           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:38203           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:36155           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:38716           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:35645           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:45885           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:49470           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:45374           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:50494           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:53567           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:56639           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:50495           0.0.0.0:*                           20472/qemu-system-i
udp        0      0 0.0.0.0:36160           0.0.0.0:*                           20472/qemu-system-i

我想知道qemu为什么要开这么多udp端口,有什么用?


qemu-ifup 内容:

#!/bin/bash

switch=br0

if [ -n "$1" ]; then
    ip link set $1 up
    sleep 1
    brctl addif ${switch} $1
    exit 0
else
    echo "Error: no interface specified"
    exit 1
fi

【问题讨论】:

  • 你想问什么?
  • 我没看懂问题
  • 对不起,我已经更新了问题。

标签: virtual-machine virtualization qemu kvm libvirt


【解决方案1】:

我相信当您使用 -net user qemu 时,会为您进行用户模式端口从本地主机端口到访客端口的转换。例如如果您在您的客人中运行 bgp,则需要在端口 179 上进行侦听。但您当然不希望您的主机这样做。因此,端口转换将发生在将您的 VM 发送到主机的数据包上,反之亦然;有点像NAT。 Qemu 必须为您设置此转换,以便 TCP/UDP 流量看起来无缝。它不适用于 IMCP;所以 ping 会失败。

查看http://wiki.qemu.org/Documentation/Networking 了解更多信息

所以总而言之,我认为您的端口是访客交流导致创建这些翻译的结果

【讨论】:

  • 我没有在 qemu-ifup 中添加任何端口转发代码。我已经发布了内容。
猜你喜欢
  • 1970-01-01
  • 2011-08-18
  • 1970-01-01
  • 2013-08-07
  • 2017-06-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-11
相关资源
最近更新 更多