[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: KVM networking.



Thank You for Your time and answer, Arno:

>> >Just remember to leave eth0 unconfigured...
>> 
>> Then how do host's app.s will get to Internet?
>
>Through the bridge. I can't tell what's missing until you show us your
>bridge configuration, if you have any. I'll show my config for
>comparison:

OK. Now host's app.s have access to Internet through the bridge. At the
beginning I mixed up things w/ bridge because I tried to set LAN also
at the same time - I just did not follow the howto. :) Pardon.

But I can not start kvm. That's what I do:

$ /usr/bin/kvm -localtime -m 256 -no-reboot -boot c
-hda da -net nic,macaddr=$(printf
'DE:AD:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256))) -net tap

kvm: -net tap: could not configure /dev/net/tun (tap%d): Operation not
permitted

kvm: -net tap: Device 'tap' could not be initialized

I run it under normal user - as You have guessed already - yet in
sudoers I have for the user (as I understand all the commands
involved in tap bringing up by KVM):

vmuser     ALL = /sbin/ifconfig *, /sbin/ifup br0, /sbin/ifdown
br0, /sbin/ip *, /sbin/brctl *, /usr/sbin/tunctl *, /sbin/route add
-host *

How I can solve this?

By the way, to overrun the permission problem I have tried running it
under sudo (root) user when I got the following error:

No protocol specified
Could not initialize SDL(No available video device) - exiting

So it needs a screen for KVM window running. Do You know how I can
launch it in such case? - Except to allow root user. :)

>> >> 2. As a workstation - it does not provide access from host to the
>> >> guest.
>> >> 
>> >You mean networking access? I've never needed it, but it should work
>> >once your host apps have networking access... (just tested: ping
>> >between host and vm works fine for me).
>> 
>> I mean that DHCP of KVM gives Internet access to guest and having no
>> interface from host to guest, I can not reach the guest from host. Of
>> course, host app.s and guest's app.s - both have Internet connection,
>> but not host-guest connection.
>
>I'm not sure exactly what you're trying to do, but KVM only does DHCP
>and basic routing with -net user and not with -net tap FAFAIK.

As it does this. But as I want to access the guest from host, this
solution does seem to be appropriate.

>> >> 3. W/ tap - You have seen already the problem - some unknown to me
>> >> permission problem - do You know why is it so?
>> >> 
>[..]
>> 
>> Now it works - regarding the permission problem, but I need the
>> interface (tap).
>> 
>> Of course I can create by root w/:
>> 
>> ifconfig tap0 192.168.1.1 up
>> 
>> route add -host 192.168.1.1 dev tap0
>> 
>> but I want w/o root.
>
>Then you should consider using -net user instead of -net tap, I think.
>I agree that it is slightly weird that you can't configure a tap
>interface even when you own it, but it makes sense: you're not just
>configuring the tap interface (which you can do from inside the VM),
>you're also changing the host's routing table.

Now I have performed that under normal user. And I can reach the guest
from host. My problem here is that I can not give Internet access to
the guest. I tried w/ NAT on host and routing tables on both host and
guest, but w/o success. For those movements please read my previous
letter.

>See my other mail. You can get the network working by using the correct
>routes (I hope). But that won't get you internet access from the VM
>without either NAT or reconfiguring your modem.

My host is connected to router. Do You mean that I need NAT at the
router or host? - I thought host only.

Thanks for Your time!


Reply to: