Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
KVM Network Bridge (starting tuntap device)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
zolom
n00b
n00b


Joined: 07 Apr 2012
Posts: 17

PostPosted: Thu Oct 17, 2013 12:54 am    Post subject: KVM Network Bridge (starting tuntap device) Reply with quote

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
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8592

PostPosted: Thu Oct 17, 2013 2:17 am    Post subject: Reply with quote

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
View user's profile Send private message
AngelKnight
Tux's lil' helper
Tux's lil' helper


Joined: 14 Jan 2003
Posts: 118

PostPosted: Thu Oct 17, 2013 10:40 am    Post subject: Re: KVM Network Bridge (starting tuntap device) Reply with quote

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
View user's profile Send private message
zolom
n00b
n00b


Joined: 07 Apr 2012
Posts: 17

PostPosted: Thu Oct 17, 2013 4:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8592

PostPosted: Thu Oct 17, 2013 7:44 pm    Post subject: Reply with quote

What happens when you run /etc/init.d/net.tap0 start?
Back to top
View user's profile Send private message
zolom
n00b
n00b


Joined: 07 Apr 2012
Posts: 17

PostPosted: Thu Oct 17, 2013 8:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8592

PostPosted: Thu Oct 17, 2013 9:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum