View previous topic :: View next topic |
Author |
Message |
zolom n00b
Joined: 07 Apr 2012 Posts: 34
|
Posted: Thu Oct 17, 2013 12:54 am Post subject: KVM Network Bridge (starting tuntap device) |
|
|
Hi all,
I'm trying to get a Windows VM set up in KVM/QEMU under Gentoo for gaming. I thought getting the VGA passthrough working would be the hard part but instead I'm having trouble with the network bridge! I don't think there's anything seriously wrong here, I'm sure I'm just missing a step.
I'm not sure how the tun device is supposed to be created through rc. From rc.log:
Code: |
* Bringing up interface br0
* Creating bridge br0 ...
set hello timer failed: Numerical result out of range
* Adding ports to br0
* enp3s0 ...
[ ok ]
* tap0 ...
* Cannot add non-existent interface tap0 to br0
|
If I run "tunctl -t tap0" and reset the br0 service after the computer starts then everything works great (so far I have not planned past running the VM as root). I can think of a few things to try to make tunctl happen before it tries to start br0, but I know that everything I'm thinking of is the Wrong Way so I thought I'd come here to see if anyone knew the Right Way.
Thanks for any help!
My /etc/conf.d/net:
Code: |
config_enp3s0="null"
bridge_br0="enp3s0 tap0"
config_br0="dhcp"
brctl_br0="setfd 0
sethello 30
stp off"
config_tap0="null"
tuntap_tap0="tap" |
|
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21633
|
Posted: Thu Oct 17, 2013 2:17 am Post subject: |
|
|
You told openrc not to configure tap0, so it did not configure it. You should tell openrc how to configure the interface, so that it can prepare it before adding it to the bridge.
Code: | config_tap0="192.168.0.1 netmask 255.255.255.0"
mac_tap0="52:54:00:00:00:01"
modules_tap0='iproute2 !plug'
tuntap_tap0='tap'
tunctl_tap0='-u kvmuser' |
|
|
Back to top |
|
|
AngelKnight Tux's lil' helper
Joined: 14 Jan 2003 Posts: 127
|
Posted: Thu Oct 17, 2013 10:40 am Post subject: Re: KVM Network Bridge (starting tuntap device) |
|
|
zolom wrote: | I'm not sure how the tun device is supposed to be created through rc. From rc.log:
Code: |
* Bringing up interface br0
* Creating bridge br0 ...
set hello timer failed: Numerical result out of range
|
|
That bit looks bad. It looks a lot like rc was failing to set up your bridge device for this reason.
With the option "stp off", you're turning Spanning Tree off anyway. Remove the "setfd 0" line
zolom wrote: | My /etc/conf.d/net:
Code: |
config_enp3s0="null"
bridge_br0="enp3s0 tap0"
config_br0="dhcp"
brctl_br0="setfd 0
sethello 30
stp off"
config_tap0="null"
tuntap_tap0="tap" |
|
|
|
Back to top |
|
|
zolom n00b
Joined: 07 Apr 2012 Posts: 34
|
Posted: Thu Oct 17, 2013 4:39 pm Post subject: |
|
|
AngelKnight,
I removed the setfd line as you suggested and it removed the out of range error.
Hu,
I gave your changes a shot but I'm still getting the same in rc.log:
Code: | * tap0 ...
* Cannot add non-existent interface tap0 to br0
|
The settings did decrease the amount of time it takes to get a dhcp lease when I bring the bridge up after booting. I based my /etc/conf.d/net off of these two sources:
http://www.linux-kvm.org/page/KvmOnGentoo
https://forums.gentoo.org/viewtopic-t-918390-start-0.html
What I want to do is write an init script to run tunctl before it tries to bring up the bridge, but I feel that this must be achievable through configuring /etc/conf.d/net correctly.
My current /etc/conf.d/net:
Code: | config_enp3s0="null"
bridge_br0="enp3s0 tap0"
config_br0="dhcp"
brctl_br0=" sethello 30
stp off"
config_tap0="192.168.0.1 netmask 255.255.255.0"
mac_tap0="52:54:00:00:00:01"
tuntap_tap0="tap"
tunctl_tap0="-u zolom"
modules_tap0='iproute2 !plug'
|
|
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21633
|
Posted: Thu Oct 17, 2013 7:44 pm Post subject: |
|
|
What happens when you run /etc/init.d/net.tap0 start? |
|
Back to top |
|
|
zolom n00b
Joined: 07 Apr 2012 Posts: 34
|
Posted: Thu Oct 17, 2013 8:47 pm Post subject: |
|
|
Ah-ha! That's where I misunderstood. I hadn't seen anything about adding net.tap0 so I didn't. Because you are supposed to remove net.eth0 from rc and because eth0 and tap0 were supposed to be "null" in /etc/conf.d/net, I presumed that you wouldn't make an init script for tap0. That was pretty dumb!
It also wanted to start net.br0 first so I had to tack net.tap0 into the boot section instead of the default section.
Thanks for the help! |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21633
|
Posted: Thu Oct 17, 2013 9:37 pm Post subject: |
|
|
The bridge_br0 declaration should have caused it to start the tap device before starting the bridge. However, as you discovered, you must have a net.tap0 initscript. |
|
Back to top |
|
|
|