Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

KVM Network Bridge (starting tuntap device)

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
7 posts • Page 1 of 1
Author
Message
zolom
n00b
n00b
Posts: 34
Joined: Sat Apr 07, 2012 5:33 pm

KVM Network Bridge (starting tuntap device)

  • Quote

Post by zolom » Thu Oct 17, 2013 12:54 am

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: Select all

 * 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: Select all

config_enp3s0="null" 
bridge_br0="enp3s0 tap0"
config_br0="dhcp" 
brctl_br0="setfd 0
             sethello 30
             stp off"
config_tap0="null"
tuntap_tap0="tap"
Top
Hu
Administrator
Administrator
Posts: 24403
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Thu Oct 17, 2013 2:17 am

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: Select all

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'
Top
AngelKnight
Tux's lil' helper
Tux's lil' helper
Posts: 127
Joined: Tue Jan 14, 2003 3:21 am

Re: KVM Network Bridge (starting tuntap device)

  • Quote

Post by AngelKnight » Thu Oct 17, 2013 10:40 am

zolom wrote:I'm not sure how the tun device is supposed to be created through rc. From rc.log:

Code: Select all

 * 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: Select all

config_enp3s0="null" 
bridge_br0="enp3s0 tap0"
config_br0="dhcp" 
brctl_br0="setfd 0
             sethello 30
             stp off"
config_tap0="null"
tuntap_tap0="tap"
Top
zolom
n00b
n00b
Posts: 34
Joined: Sat Apr 07, 2012 5:33 pm

  • Quote

Post by zolom » Thu Oct 17, 2013 4:39 pm

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: Select all

 *     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
http://forums.gentoo.org/viewtopic-t-91 ... art-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: Select all

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'
Top
Hu
Administrator
Administrator
Posts: 24403
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Thu Oct 17, 2013 7:44 pm

What happens when you run /etc/init.d/net.tap0 start?
Top
zolom
n00b
n00b
Posts: 34
Joined: Sat Apr 07, 2012 5:33 pm

  • Quote

Post by zolom » Thu Oct 17, 2013 8:47 pm

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!
Top
Hu
Administrator
Administrator
Posts: 24403
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Thu Oct 17, 2013 9:37 pm

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.
Top
Post Reply

7 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic