Community discussions

 
fred410
just joined
Topic Author
Posts: 17
Joined: Mon Mar 21, 2011 8:30 pm

linux kvm ghost accessing host network

Thu Apr 07, 2011 8:14 pm

Sorry to bother, but again the "manuals" here are pretty useless when it comes to kvm stuff.

i have an x86 Mikrotik v5.0 and have Debian kvm guest.

but cant for the life of me get the kvm to access any network anything outside the kvm ( ie, wont access host network abilities )

i have tried various kvm guest "/etc/network/interfaces" configurations.
tried various mikrotik interfaces, dhcp configs, bridges - combinations of all these - to no avail.

is there some guide to how you setup the Kvm guest and mikrotik device so that the kvm can get to network (the internet, etc)??
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: linux kvm ghost accessing host network

Fri Apr 08, 2011 4:28 pm

see this page -
http://wiki.mikrotik.com/wiki/Kvm#Adding_Interfaces

that specifies that you can create type dynamic (vill create dynamic interface in virtual ethernet automaticaly), or type=static (have to create interface yourself)

after that you have interface that is connected to your host as any other interface on the router, and if you want to, you can bridge or route traffic to your guest.
 
fred410
just joined
Topic Author
Posts: 17
Joined: Mon Mar 21, 2011 8:30 pm

Re: linux kvm ghost accessing host network

Fri Apr 08, 2011 7:14 pm

acknowledged.

the first step, setting up the dynamic virtual interface in mikrotik i had already done, but deleted and recreated according to the manual page.

the problem is must be the linux kvm setup?!

what should the /etc/network/interfaces file look like?
mine has:
  • auto lo
    iface lo inet loopback

    allow-hotplug eth0
    iface eth0 inet dhcp

    iface default inet dhcp


i do find in the modprobe.conf file a line that says:
  • alias eth0 virtio_net


btw, the mikrotik package "ipv6" is disabled.
DHCP doesnt appear to work on the Mikrotik

ANY ideas what to do/check - something im missing?
You do not have the required permissions to view the files attached to this post.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: linux kvm ghost accessing host network

Mon Apr 11, 2011 8:32 am

from what you have given everything looks fine. By default KVM uses virtio as ethernet interface as that is fastest option.
 
fred410
just joined
Topic Author
Posts: 17
Joined: Mon Mar 21, 2011 8:30 pm

Re: linux kvm ghost accessing host network

Mon Apr 11, 2011 5:49 pm

virtio - should be the fastest.. makes since. and since there is an alias of eth0 to virtio - it should work.

but doesnt!
thats why i am wondering if something is missing in KVM instance or in Mikrotik config itself.
routes.jpg
ping.jpg
i found some network help page that said to:
delete the /etc/udev/rules.d/70-persistent-net.rules file and reboot kvm (so network adapter hardware stuff gets regenerated)

so i did that, still doesnt help
what does Mikrotik actually do with its "qemu" command in the background?

What do i Have Setup Wrong??

above i am told to "bridge or route" traffic to guest - but since one can screw with the kvm settings and the mikrotik settings - i am lost on where to start and what to set.
You do not have the required permissions to view the files attached to this post.
 
fred410
just joined
Topic Author
Posts: 17
Joined: Mon Mar 21, 2011 8:30 pm

Re: linux kvm ghost accessing host network

Thu Apr 21, 2011 12:37 am

Resolved Issue:
forget all the stuff above about reconfiguring the various KVM guest files
issue was primarily the Mikrotik kvm setup:

what I did to fix:
Create a “bridge” component
/interface bridge add name=bridge1

Then create connecting port/ether to bridge
/interface bridge port add bridge= bridge1 interface=ether8
( ether8 is primary gateway lan port )

Then with KVM configuration, add connecting interface to KVM guest
/kvm interface add dynamic-bridge=bridge1 virtual-machine={….}
{....} name of VM such as: Debian KVM

that worked.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: linux kvm ghost accessing host network

Tue Apr 26, 2011 10:25 am

did you have default route in your guest system? As that is what seems to be missing. Now you have bridged these so no routing is required.

If you do not desire to use bridge, check if your guest has correct routes set, so it knows how address you try to reach is reachable.
 
fred410
just joined
Topic Author
Posts: 17
Joined: Mon Mar 21, 2011 8:30 pm

Re: linux kvm ghost accessing host network

Tue Apr 26, 2011 6:02 pm

i dont think (or in fact know) that I had a default route setup on the guest.

the problem was i wasnt really sure about how to configure the routes in the kvm guest.

i know it was able to see the virtual adapter with the "discover -t network" command, so I knew i was close; but didnt know how to configure the guest, so started trying to fix it on the outside of the guest.

and that worked.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: linux kvm ghost accessing host network

Wed Apr 27, 2011 11:52 am

if you want the guest appear on same network level as host, you configuration is fine. And in virtualized environments usually guest is presented to the network in this manner (via bridge)
 
fred410
just joined
Topic Author
Posts: 17
Joined: Mon Mar 21, 2011 8:30 pm

Re: linux kvm ghost accessing host network

Thu Apr 28, 2011 4:04 am

yes, your right i can see the host, which is good, makes it easy to transfer files into guest through the mikrotik files.

acknowledged, so normally (ie. not my setup) a bridge is created IN the KVM guest, correct?
Last edited by fred410 on Thu Apr 28, 2011 4:52 pm, edited 2 times in total.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: linux kvm ghost accessing host network

Thu Apr 28, 2011 8:29 am

bridge is created on the host as you have done, but that is not the only option that is available. there are cases when routing is required. For example you mange firewall on the host to allow external access to guest systems only to certain ports. You should look at it not as guest/host situation, but in scope of routed or bridged network and what is required in your situation.

Who is online

Users browsing this forum: No registered users and 1 guest