View previous topic :: View next topic |
Author |
Message |
marcelvs n00b
Joined: 10 Sep 2005 Posts: 30
|
Posted: Mon Jul 18, 2011 11:52 pm Post subject: KVM Bridged with NetworkManager |
|
|
Hello, is there a way to create a virtual machine that is visible in a network with KVM and the host uses NetworkManager ?
Why that ? Because I want to create kvm guests in my notebook using the wlan0 interface. I noticed NetworkManager does not work with the TUN/TAP bridge ( because NM does not deal with the br0 interface ).
A nat solution was possible but I could not connect my guest from outside.
I tried a VDE network but VDE promisses a lot and it deliveres a little ( I read a lot of howtos and VDE makes everything I was already able to do easier but there is no plus, no way of tell to connect my host and guests in the outside network).
If some one have any idea I would be glad.
Thanks in advance,
Marcelo. |
|
Back to top |
|
|
Mad Merlin Veteran
Joined: 09 May 2005 Posts: 1155
|
|
Back to top |
|
|
marcelvs n00b
Joined: 10 Sep 2005 Posts: 30
|
Posted: Fri Jul 22, 2011 1:12 am Post subject: |
|
|
This one works partially, I could communicate between the VM and the host, but the routing did not work (no communication with my gateway ) . I think it might be something wrong with my configuration, kernel options, etc.
The nat stuff I did not try because I think the routing solution is the best solution. I think would be more clever to know why I cannot route packets. If there is some gentoo howto about routing ( not how to do a router ). I found some but it did not work. I am probably missing something.
The second step is to learn how to use wisely KVM ( with libvirt and virt-manager ) in order to be free of the ugly command line of KVM. I know RedHat works out-of-the-box with virt-manager, so I must be able to discover how with Gentoo.
Anyway, thanks for your help. |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21498
|
Posted: Fri Jul 22, 2011 2:16 am Post subject: |
|
|
How did you determine that the guest was not communicating with the gateway? |
|
Back to top |
|
|
marcelvs n00b
Joined: 10 Sep 2005 Posts: 30
|
Posted: Fri Jul 22, 2011 11:07 am Post subject: |
|
|
Hu wrote: | How did you determine that the guest was not communicating with the gateway? |
Because the guest was able to ping the host, but could not ping the gateway ( my router ) nor my other computer in the network. One other strange thing that happened was I could ssh to the guest but I could not mount a windows xp samba share from the guest in my host ( I tested with debian and Windows XP VMs). So locally I could do everything between host and guest, except samba shares and outside the host nothing worked. |
|
Back to top |
|
|
Mad Merlin Veteran
Joined: 09 May 2005 Posts: 1155
|
Posted: Sun Jul 24, 2011 2:55 am Post subject: |
|
|
That doesn't indicate that your wireless card bridged successfully. Assuming you gave the bridge itself an IP, your host can talk to the guest directly through it when the guest's tap is bridged into the bridge. _________________ Game! - Where the stick is mightier than the sword! |
|
Back to top |
|
|
radzior n00b
Joined: 19 May 2007 Posts: 12 Location: Katowice, PL
|
Posted: Mon Jun 10, 2013 8:45 am Post subject: |
|
|
networkmanager as of version 0.9.8 (not in the portage yet?) is now supposed to have support for bridging |
|
Back to top |
|
|
alinefr Tux's lil' helper
Joined: 05 Jul 2009 Posts: 113 Location: São Paulo, Brasil
|
Posted: Mon Jun 10, 2013 8:48 pm Post subject: |
|
|
I did it with a tap interface in a laptop with wicd, but it didn't involve wicd at all (and it shouldn't involve network-manager, of course!)
My /etc/conf.d/net
Code: |
preup() {
if [ ${IFACE} = tap0 ]; then
/usr/bin/tunctl -u aline -t ${IFACE} > /dev/null 2>&1
fi
return 0
}
postdown() {
if [ ${IFACE} = tap0 ]; then
/usr/bin/tunctl -d ${IFACE} > /dev/null 2>&1
fi
return 0
}
config_tap0="10.0.0.1 netmask 255.255.255.0 broadcast 192.168.254.255"
|
My iptables rules:
Code: |
#!/bin/bash
IPTABLES='/sbin/iptables'
WLANIF=wlp2s0
ETHIF=eno1
TAPIF=tap0
$IPTABLES -t nat -A POSTROUTING -o $WLANIF -j MASQUERADE
$IPTABLES -t nat -A POSTROUTING -o $ETHIF -j MASQUERADE
$IPTABLES -I FORWARD 1 -i $TAPIF -j ACCEPT
$IPTABLES -I FORWARD 1 -o $TAPIF -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
WLANIF and ETHIF are my wifi and wired interfaces, respectively.
Then, in the guest (Windows 7, my one) I did configure a static IP:
IP address: 10.0.0.2
netmask: 255.255.255.0
Gateway: 10.0.0.1
And started qemu-kvm with:
-net tap,ifname=tap0,script=no |
|
Back to top |
|
|
_______0 Guru
Joined: 15 Oct 2012 Posts: 521
|
Posted: Wed Jun 12, 2013 11:05 am Post subject: |
|
|
First link broken.
And question about the second one. Same procedure for ipv6? When a system has two nics for them to talk to each other and forgoing bridging solutions routing is the only way?
How to do this with ipv6?
thanks |
|
Back to top |
|
|
|