Jump to content
Read the Funtoo Newsletter: Summer 2023 ×

Help w/ networking for KVM guests


Recommended Posts

Hi all,

 

I'm a longtime gentoo user who recently switched to funtoo (for the no-systemd subprofile).  I have most things working but cannot get networking to work correctly in KVM guests running under funtoo (neither windows nor linux guests work and it looks like no packets are ever received).  Since the networking scripts differ from gentoo I assume I have something misconfigured. 

 

Here's my /etc/conf.d/net from gentoo:

 

bridge_br0="eth0 tap0 tap1 tap2 tap3"
brctl_br0="setfd 0 sethello 0 stp off"
rc_net_br0_need="net.tap0 net.tap1 net.tap2 net.tap3"

config_br0="192.168.2.110/24"
routes_br0="default via 192.168.2.1"
dns_domain_br0="homenetwork"
dns_servers_br0="192.168.2.1"
dns_search_br0="homenetwork"

config_tap0="null"
tuntap_tap0="tap"
tunctl_tap0="-u lance"
carrier_timeout_tap0="0"

config_tap1="null"
tuntap_tap1="tap"
tunctl_tap1="-u lance"
carrier_timeout_tap1="0"

config_tap2="null"
tuntap_tap2="tap"
tunctl_tap2="-u lance"
carrier_timeout_tap2="0"

config_tap3="null"
tuntap_tap3="tap"
tunctl_tap3="-u lance"
carrier_timeout_tap3="0"

config_eth0="null"
modules_eth0="!plug"

 

mtu_eth0="7000"
mtu_br0="7000"
mtu_tap0="7000"
mtu_tap1="7000"
mtu_tap2="7000"
mtu_tap3="7000"
 

and here are the corresponding files under funtoo:

 

/etc/conf.d/net.br0:

ipaddr="192.168.2.110/24"
gateway="192.168.2.1"
nameservers="192.168.2.1"
domain="lshome"
mtu="7000"
slaves="net.eth0 net.tap0 net.tap1 net.tap2 net.tap3"
stp="off"
forwarding=1
 

/etc/conf.d/net.eth0:

template="interface"
 

/etc/conf.d/net.tap0:

template="tap"
group="kvm"
mac_replace="4c:61:6e:63:65:00"
mtu="7000"
 

(note: net.tap1 to net.tap3 are the same except for the mac address)

 

Here's the output of brtl show on funtoo :

# brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.002522b0f029       no              eth0
                                                        tap0
                                                        tap1
                                                        tap2
                                                        tap3
 

And here are the network-related options passed to qemu when launching a VM:

 

  -net nic,vlan=0,macaddr=4c:61:6e:63:65:03 \
  -net tap,vlan=0,ifname=tap2,script=no \
 

Any suggestions?  Is there any (relatively easy) way to revert the funtoo network scripts back to use the ones from gentoo?

 

Thanks in advance.

Link to comment
Share on other sites

http://www.funtoo.org/Networking#Bridge_Configuration

Your /etc/conf.d/net.eth0 has template="interface"

If net.eth0 is a slave then template="interface-noip"

Your /etc/conf.d/net.br0 needs template="bridge"

 

Thanks.  I  did have interface="bridge" in net.br0 but somehow didn't paste that line into my question above.  I changed eth0 from interface to inteterface-noip and rebooted but I still have the same error.  Any other ideas? 

 

I did find that some scripts under /etc/netif.d/ have hard-coded paths to /sbin/sysctl but it's under /usr/sbin/.  I created a symlink so the scripts would find it but it still didn't help.

Link to comment
Share on other sites

  • 3 weeks later...

Just to clarify things, for bridge to work, you need two configs (tap & bridge)

 

config for tap should look like this:

file: /etc/conf.d/net.tap0


template="tap"

 

config for br0 should look like this:

file: /etc/conf.d/net.br0

template="bridge"
ipaddr="192.168.2.1/24"
slaves="net.tap0"
stp="on"
forwarding="1"

 

If these two configs work, then add stuff like domains, nameservers, routes, mtu's etc...

also make sure, that you actually have IP forwarding enabled on your system (echo 1 > /proc/sys/net/ipv4/ip_forward)

 

Actual network templates are located in /etc/netif.d/

If you don't like them, you can create custom ones!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...