You are not logged in.

#1 2010-04-30 16:21:45

pokraka
Member
From: Brussels
Registered: 2009-01-15
Posts: 63

problem with setting up tap networking (for use in QEMU)

Hi,

I followed the instructions at http://wiki.archlinux.org/index.php/Qem … _with_QEMU but after that I can't access Internet from my host computer (and from my virtual machine neither).
I have to restore settings in /etc/rc.conf and restart my computer to get access to Internet again (doing "/etc/rc.d/network restart" doesn't work, I have to reboot, I don't know if it's normal).

Does someone has any idea of what is going wrong?

Thanks.

Last edited by pokraka (2010-04-30 16:22:33)

Offline

#2 2010-05-04 17:30:40

pokraka
Member
From: Brussels
Registered: 2009-01-15
Posts: 63

Re: problem with setting up tap networking (for use in QEMU)

nobody knows?

Offline

#3 2010-05-04 19:18:51

Sin.citadel
Member
Registered: 2008-01-22
Posts: 267

Re: problem with setting up tap networking (for use in QEMU)

post your rc.conf file (both original and altered)

Offline

#4 2010-05-04 20:53:44

pokraka
Member
From: Brussels
Registered: 2009-01-15
Posts: 63

Re: problem with setting up tap networking (for use in QEMU)

original /etc/rc.conf :

MOD_AUTOLOAD="yes"
MODULES=(!snd_pcsp kvm kvm-amd !bridge !tun)

HOSTNAME="superboes"

eth0="dhcp"
INTERFACES=(eth0)

#eth0="eth0 up"
#br0="dhcp"
#INTERFACES=(eth0 br0)

gateway="default gw 192.168.0.1"
ROUTES=(!gateway)

DAEMONS=(syslog-ng dbus hal network !netfs crond alsa @tor @privoxy)

altered /etc/rc.conf :

MOD_AUTOLOAD="yes"
MODULES=(!snd_pcsp kvm kvm-amd bridge tun)

HOSTNAME="superboes"

#eth0="dhcp"
#INTERFACES=(eth0)

eth0="eth0 up"
br0="dhcp"
INTERFACES=(eth0 br0)

gateway="default gw 192.168.0.1"
ROUTES=(!gateway)

DAEMONS=(syslog-ng dbus hal network !netfs crond alsa @tor @privoxy)

/etc/conf.d/bridges :

bridge_br0="eth0"
BRIDGE_INTERFACES=(br0)

Last edited by pokraka (2010-05-04 20:54:22)

Offline

#5 2010-05-05 06:03:42

Sin.citadel
Member
Registered: 2008-01-22
Posts: 267

Re: problem with setting up tap networking (for use in QEMU)

the problem seems to be for the default route or dns, post /etc/resolv.conf and the route -n output (for both original rc.conf, and altered rc.conf)

Offline

#6 2010-05-09 16:41:19

pokraka
Member
From: Brussels
Registered: 2009-01-15
Posts: 63

Re: problem with setting up tap networking (for use in QEMU)

Sin.citadel wrote:

the problem seems to be for the default route or dns, post /etc/resolv.conf and the route -n output (for both original rc.conf, and altered rc.conf)

resolv.conf, with original rc.conf :

# Generated by dhcpcd from eth0
# /etc/resolv.conf.head can replace this line
domain lan
nameserver 192.168.1.254
# /etc/resolv.conf.tail can replace this line

route -n output, with original rc.conf :

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     202    0        0 eth0
0.0.0.0         192.168.1.254   0.0.0.0         UG    202    0        0 eth0

with the altered rc.conf, there is nothing :

# Generated by dhcpcd
# /etc/resolv.conf.head can replace this line
# /etc/resolv.conf.tail can replace this line
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

thanks for your help.

Offline

#7 2010-05-10 03:42:30

fede
Member
Registered: 2007-06-29
Posts: 126

Re: problem with setting up tap networking (for use in QEMU)

I'm trying to do the same and am at exactly the same spot... What is happening to resolv.conf, what is emptying it? I suppose it has to do with dhcpcd, but why is it working with the regular adapter and not with the tap configuration?

Offline

#8 2010-05-10 04:35:32

fede
Member
Registered: 2007-06-29
Posts: 126

Re: problem with setting up tap networking (for use in QEMU)

Some findings:
I. To avoid a blank resolv.conf, see http://wiki.archlinux.org/index.php/Resolv.conf (I used /etc/resolv.conf.head)
II. To fix the network by disabling the bridge config it is not necessary to restart, you can get the network to run again by:

1. Return to the previous config in rc.conf
2. Comment out /etc/conf.d/bridges
3. Remove the modules
modprobe -r tun
modprobe -r bridge
4. Restart the network

I couldn't get the network going unless I did all these steps... so I must be doing something wrong with bridge / tun.
I believe I've followed closely the instructions in the wiki for bridge networking in the QEMU page, so perhaps there is something missing there as well.

Last edited by fede (2010-05-10 04:36:41)

Offline

#9 2010-05-10 10:32:36

Sin.citadel
Member
Registered: 2008-01-22
Posts: 267

Re: problem with setting up tap networking (for use in QEMU)

if dhcpcd is causing these problems, it would be better if you switched to static ip address, configure a static ip and default gateway, and add your dns servers to the resolv.conf file.

Offline

#10 2010-05-10 14:14:36

fede
Member
Registered: 2007-06-29
Posts: 126

Re: problem with setting up tap networking (for use in QEMU)

Thanks for the suggestion; but that doesn't work either.

The problem is that I cannot get the bridge setup to work neither with a static nor with a dynamic ip. Using resolv.conf.head as specified in the resolv.conf wiki I've got a properly populated resolv.conf under all configs, so I don't suppose that the problem lies there.

**EDIT: I've later seen that what I say below is wrong, route -n shows a gateway but the connection is not working outside of QEMU***
route -n shows no gateway both with static and dynamic IP under the bridge config, and in my setup I'm using a gateway. Only with the regular config does it use the gateway, it's as if the gateway line in rc.conf did nothing under the bridge setup. Here's my rc.conf:

# -----------------------------------------------------------------------
# NETWORKING
# -----------------------------------------------------------------------
#
# HOSTNAME: Hostname of machine. Should also be put in /etc/hosts
#
HOSTNAME="luminous"

# Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available interfaces.
#
# Interfaces to start at boot-up (in this order)
# Declare each interface then list in INTERFACES
#   - prefix an entry in INTERFACES with a ! to disable it
#   - no hyphens in your interface names - Bash doesn't like it
# 
# DHCP:     Set your interface to "dhcp" (eth0="dhcp")
# Wireless: See network profiles below
#

# Bridge networking for KVM
eth0="eth0 up"
br0="br0 192.168.1.3 netmask 255.255.255.0 broadcast 192.168.1.255 up"
#br0="dhcp"
INTERFACES=(eth0 br0)

## Normal setup with no bridge
#eth0="eth0 192.168.1.3 netmask 255.255.255.0 broadcast 192.168.1.255"
##eth0="dhcp"
#INTERFACES=(eth0)

# Routes to start at boot-up (in this order)
# Declare each route then list in ROUTES
#   - prefix an entry in ROUTES with a ! to disable it
#
gateway="default gw 192.168.1.1"
ROUTES=(gateway)
 
# Enable these network profiles at boot-up.  These are only useful
# if you happen to need multiple network configurations (ie, laptop users)
#   - set to 'menu' to present a menu during boot-up (dialog package required)
#   - prefix an entry with a ! to disable it
#
# Network profiles are found in /etc/network.d
#
# This now requires the netcfg package
#
#NETWORKS=(main)

# -----------------------------------------------------------------------
# DAEMONS
# -----------------------------------------------------------------------
#
# Daemons to start at boot-up (in this order)
#   - prefix a daemon with a ! to disable it
#   - prefix a daemon with a @ to start it up in the background
#
DAEMONS=(syslog-ng @network netfs crond alsa hal !avahi-daemon kdm)

and /etc/conf.d/bridges:

#
# Settings for layer-2 bridges
#
# For each bridge interface declared in INTERFACES (in rc.conf), declare
# a bridge_${IF} variable that contains the real ethernet interfaces that
# should be bridged togeether.
#
# Then list the bridge interface name in the BRIDGE_INTERFACES array.
#

# example:
#
# in /etc/rc.conf:
#    eth0="eth0 up"
#    eth1="eth1 up"
#    br0="br0 192.168.0.2 netmask 255.255.255.0 up"
#    INTERFACES=(lo eth0 eth1 br0)
#
# in /etc/conf.d/bridges
#    bridge_br0="eth0 eth1"
#    BRIDGE_INTERFACES=(br0)
#


bridge_br0="eth0"
BRIDGE_INTERFACES=(br0)

Last edited by fede (2010-05-10 15:24:01)

Offline

#11 2010-05-10 14:26:29

Sin.citadel
Member
Registered: 2008-01-22
Posts: 267

Re: problem with setting up tap networking (for use in QEMU)

it could be that the default route is overwritten by QEMU, show the output of ifconfig after qemu is attached to bridge.

Offline

#12 2010-05-10 14:49:52

fede
Member
Registered: 2007-06-29
Posts: 126

Re: problem with setting up tap networking (for use in QEMU)

I just discovered that what I said about the gateway is wrong: route -n now shows a gateway under the bridge config. Sorry! Moreover, I've got internet connection within QEMU (I hadn't tested net within the qemu guest before, was just trying to get it to continue working for the host), even while the host's connection is not working.

This is the info under the bridge setup:

[~]$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 br0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
[~]$ cat /etc/resolv.conf
# Generated by dhcpcd
# DNS Local Router
nameserver 192.168.1.1
# /etc/resolv.conf.tail can replace this line
[~]$ ifconfig
br0       Link encap:Ethernet  HWaddr 00:1A:92:90:2D:54  
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21a:92ff:fe90:2d54/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:84 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:6557 (6.4 Kb)  TX bytes:468 (468.0 b)

eth0      Link encap:Ethernet  HWaddr 00:1A:92:90:2D:54  
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21a:92ff:fe90:2d54/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:17911 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18537 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:16339651 (15.5 Mb)  TX bytes:2411871 (2.3 Mb)
          Interrupt:27 Base address:0x4000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:196 errors:0 dropped:0 overruns:0 frame:0
          TX packets:196 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:28363 (27.6 Kb)  TX bytes:28363 (27.6 Kb)

tap0      Link encap:Ethernet  HWaddr B2:25:AC:32:A5:FD                                   
          inet6 addr: fe80::b025:acff:fe32:a5fd/64 Scope:Link                             
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1                      
          RX packets:11 errors:0 dropped:0 overruns:0 frame:0                             
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0                           
          collisions:0 txqueuelen:500                                                     
          RX bytes:1546 (1.5 Kb)  TX bytes:2788 (2.7 Kb)                                  
                                                                                          
[~]$

Offline

#13 2010-05-10 16:06:31

Sin.citadel
Member
Registered: 2008-01-22
Posts: 267

Re: problem with setting up tap networking (for use in QEMU)

as you can see from the ifconfig, br0 and eth0 both have same ip address, this is causing ip conflicts, since th0 is in the brdige, you should remove its ip settings and only assign the bridge the ip address (QEMU guest works because they are bridged and get different ip addresses)

Offline

#14 2010-05-10 19:40:47

fede
Member
Registered: 2007-06-29
Posts: 126

Re: problem with setting up tap networking (for use in QEMU)

GREAT! Thanks!

I used

eth0="eth0 0.0.0.0 up"

in rc.conf to stop eth0 from getting the same IP. Is this the right way to do it?

I don't understand where it was getting the IP from when I was just saying eth0="eth0 up", not specifying any IP. In any case, it works now. I post the modified rc.conf for reference:

# -----------------------------------------------------------------------
# NETWORKING
# -----------------------------------------------------------------------
#
# HOSTNAME: Hostname of machine. Should also be put in /etc/hosts
#
HOSTNAME="luminous"

# Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available interfaces.
#
# Interfaces to start at boot-up (in this order)
# Declare each interface then list in INTERFACES
#   - prefix an entry in INTERFACES with a ! to disable it
#   - no hyphens in your interface names - Bash doesn't like it
# 
# DHCP:     Set your interface to "dhcp" (eth0="dhcp")
# Wireless: See network profiles below
#

# Bridge networking for KVM
eth0="eth0 0.0.0.0 up"
br0="br0 192.168.1.3 netmask 255.255.255.0 broadcast 192.168.1.255 up"
#br0="dhcp"
INTERFACES=(eth0 br0)
#OPTIONS="promisc"

## Normal setup with no bridge
#eth0="eth0 192.168.1.3 netmask 255.255.255.0 broadcast 192.168.1.255"
##eth0="dhcp"
#INTERFACES=(eth0)

# Routes to start at boot-up (in this order)
# Declare each route then list in ROUTES
#   - prefix an entry in ROUTES with a ! to disable it
#
gateway="default gw 192.168.1.1"
ROUTES=(gateway)

Offline

Board footer

Powered by FluxBB