2014-03-04 48 views
0

當我啓動guest os時,netstat anp命令顯示有很多UDP端口被打開。啓動命令是:爲什麼qemu打開很多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 
+1

什麼是你想用問嗎? –

+0

我不明白問題 – Chaos

+0

對不起,我已經更新了這個問題。 – leeyiw

回答

0

我相信,你正在使用-net用戶QEMU會從本地主機端口的顧客端口做用戶模式端口轉換爲您服務。例如如果你在你的客戶中運行bgp,那麼這將需要在端口179上監聽。但是當然你不希望你的主機這樣做。所以端口轉換將發生在離開虛擬機到主機的數據包上,反之亦然。有點像NAT。 Qemu必須爲您設置此翻譯,以便TCP/UDP流量看起來無縫。它不適用於IMCP;所以ping會失敗。

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

因此,在總結你的口,我相信正在創建

心連心導致這些翻譯客戶通信的結果

+0

我沒有在qemu-ifup中添加任何端口轉發代碼。我已發佈內容。 – leeyiw