Skip to contentSkip to conversation

network between host and guest

DISCUSSION Thanasis 2 participants 5 messages May 10, 2010 – May 13, 2010 2 messages not in the archive KVM

lore
Share & tools
lore

Thanasis

author
#0 lore raw

I have installed kvm (app-emulation/qemu-kvm-0.12.3-r1) on linux (a laptop with gentoo linux) and MS Windows 7 as guest. Here is what info I get about the network on each one:
1) on linux (host):

eth0 Link encap:Ethernet HWaddr 00:03:25:43:7f:93

          inet addr:192.168.0.13  Bcast:255.255.255.255  Mask:255.255.255.0
          inet6 addr: fe80::203:25ff:fe43:7f93/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1492  Metric:1
          RX packets:406972 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5268868 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:132098724 (125.9 MiB)  TX bytes:7683259267 (7.1 GiB)
          Interrupt:26 Base address:0x2000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:505 errors:0 dropped:0 overruns:0 frame:0 TX packets:505 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0
RX bytes:65800 (64.2 KiB) TX bytes:65800 (64.2 KiB)

wlan0 Link encap:Ethernet HWaddr 00:16:44:8e:5a:0b
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

2) on the guest (sorry I could't find a way copy, so I took a screenshot):
http://i999.photobucket.com/albums/af112/aggman/Screenshot-QEMU.jpg

Question: Where is my interface on linux with IP address of 10.0.2.2 ? The guest can actually access the internet (via the host), but where can I see that hidden routing that linux provides to it?

PS: forgive my ignorance, I am new to kvm.

#1 lore raw
Quoted 5 lines · 在 星期一 10 5月 2010 18:46:20,Thanasis 写道:

Question: Where is my interface on linux with IP address of 10.0.2.2 ? The guest can actually access the internet (via the host), but where can I see that hidden routing that linux provides to it?

I think you are using user networking(slirp) , with user networking, etch tcp connection is mapped to a tcp connection in host's kvm process, and there is no host route to the guest. Please visit
http://wiki.qemu.org/Documentation/Networking
for detailed information.

Signature · 2 lines
Liang Guo
http://bluestone.cublog.cn
author
#4 lore raw

on 05/10/2010 09:28 PM Thanasis wrote the following:

Quoted 3 lines

Probably it's slirp.
The url you provided doesn't help much though.

Anyone to provide some more help?

author
#6 lore raw
In reply to a message not in the archive

on 05/13/2010 10:48 PM [email protected] wrote the following:

Quoted 12 lines

Ar 10.05.10 10:46, scríobh Thanasis:

Quoted 4 lines

I have installed kvm (app-emulation/qemu-kvm-0.12.3-r1) on linux (a laptop with gentoo linux) and MS Windows 7 as guest. Here is what info I get about the network on each one:
1) on linux (host):

[snip]

Hi there:

The precise KVM command would be useful in determining what's going on.

Quoted 9 lines

Since I'm guessing, I may as well presume you used "-net nic,(options...) -net user". If you did, the magick is in the qemu binary which is both providing a DHCP service to the guest and performing the necessary outbound source NAT.

But as others have mentioned, more information on how you started KVM might be useful to determine what's going on. The reason is that there are several ways to set up networking in KVM.

The command is (and running as a user, not root):

$ kvm win7kvm.img -m 1024 -boot c -usb -usbdevice tablet
$ which kvm
/usr/bin/kvm
$ ls -l /usr/bin/kvm
lrwxrwxrwx 1 root root 17 Apr 21 15:10 /usr/bin/kvm -> /usr/bin/qemu-kvm
$ file /usr/bin/qemu-kvm
/usr/bin/qemu-kvm: POSIX shell script text executable
$ cat /usr/bin/qemu-kvm
#!/bin/sh
exec /usr/bin/qemu-system-x86_64 --enable-kvm "$@"
$ file /usr/bin/qemu-system-x86_64
/usr/bin/qemu-system-x86_64: ELF 64-bit LSB executable, x86-64, version
1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9,
stripped
$