Virtual machine qemu为什么要打开很多UDP端口

Virtual machine qemu为什么要打开很多UDP端口,virtual-machine,virtualization,qemu,kvm,libvirt,Virtual Machine,Virtualization,Qemu,Kvm,Libvirt,当我启动来宾操作系统时,netstatanp命令显示有很多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

当我启动来宾操作系统时,
netstatanp
命令显示有很多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

netstatanp
输出如下所示:

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

我相信在您使用-net时,用户qemu将为您执行从本地主机端口到来宾端口的用户模式端口转换。e、 g.如果您在guest中运行bgp,则需要监听端口179。但你当然不希望你的主人这样做。因此,端口转换将发生在离开您的虚拟机到主机的数据包上,反之亦然;有点像纳特。Qemu必须为您设置此转换,以便使TCP/UDP通信看起来天衣无缝。它不适用于IMCP;因此,ping将失败

查看以了解更多信息

总而言之,我相信你的端口是客人交流的结果,导致了这些翻译的产生


hth

你想问什么?我不理解问题对不起,我已经更新了问题。我不会在qemu ifup中添加任何端口转发代码。我已经把内容贴出来了。