[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: no tap0 device available while `tun' module loaded.



Scott Edwards wrote:
While attempting to install debian within a uml setup, I've
encountered problems with networking.  I've narrowed the problem down
to a missing tap0 interface on the host (the uml is fine).  The tun
module is loaded (according to lsmod).  This kernel supports the tun
device (CONFIG_TUN=m).

ifconfig -a doesn't show a tun device (just lo and eth0).

I suppose this is the biggest reason ifconfig isn't listing the
module.  Are there module parameters required?  I've reviewed the docs
from Documentation/network/tuntap.txt, and some googling, but answers
are scarce and/or vague.

Any help would be appreciated.

Thank you,



Scott Edwards
Daxal Communications - http://www.daxal.com
Surf the USA - http://www.surfthe.us


To deal with UML networking, i first installed these:
aptitude install uml-utilities bridge-utils

Then:

# adduser uml
# adduser uml uml-net
# chgrp uml-net /dev/net/tun
# chmod 660 /dev/net/tun

I then load a script at boot to set up bridging:
=========================== set up tap devices =======================
#!/bin/sh

# your IP address
HOST_IP="192.168.0.3"

# netmask
HOST_NETMASK="255.255.255.0"

# your internet gateway
HOST_GATEWAY="192.168.0.1"

# internet interface
HOST_IFACE="eth0"

# name of the bridge
UML_BRIDGE="br0"

# the syntax of UML_IFACES is as follows:
# UML_IFACES="<iface1>:<user1>[ <iface2>:<user2>[...]]"
#
# for instance you have two UMLs, the first runs as user 'tom'
# and the second as 'uml':
#      UML_IFACES="tap1:tom tap2:uml"
UML_IFACES="tap0:uml"

###############

if [ "x$1" = "x-v" ]; then
        VERBOSE=1
        shift
else
        VERBOSE=0
fi

e() { test $VERBOSE = 1 && echo $@; $@; }

case "$1" in
        start)
                echo -n "Setting up UML bridge"
                test $VERBOSE = 1 && echo

                # set up the bridge
                e ifconfig $HOST_IFACE 0.0.0.0 promisc up
                e brctl addbr $UML_BRIDGE
                e brctl setfd $UML_BRIDGE 0
                e brctl sethello $UML_BRIDGE 0
                e brctl stp $UML_BRIDGE off

                # add the host interface
                e ifconfig $UML_BRIDGE $HOST_IP netmask $HOST_NETMASK up
                e route add default gw $HOST_GATEWAY
                e brctl addif $UML_BRIDGE $HOST_IFACE

                # and the UML interface(s)
                for ITMP in $UML_IFACES; do
                        IFACE=`echo $ITMP | cut -d ':' -f 1`
                        IUSER=`echo $ITMP | cut -d ':' -f 2`
                        test `echo $ITMP | grep ':'` || IUSER=root
                        e tunctl -u $IUSER -t $IFACE > /dev/null
                        e ifconfig $IFACE 0.0.0.0 promisc up
                        e brctl addif $UML_BRIDGE $IFACE
                        echo -n " $IFACE"
                done

                echo "."
                ;;
        stop)
                echo -n "Removing UML bridge"
                test $VERBOSE = 1 && echo

                e ifconfig $UML_BRIDGE down
                e brctl delif $UML_BRIDGE $HOST_IFACE
                for ITMP in $UML_IFACES; do
                        IFACE=`echo $ITMP | cut -d ':' -f 1`
                        e brctl delif $UML_BRIDGE $IFACE
                        e tunctl -d $IFACE > /dev/null
                        echo -n " $IFACE"
                done
                e brctl delbr $UML_BRIDGE
                e ifconfig $HOST_IFACE $HOST_IP netmask $HOST_NETMASK up
                e route add default gw $HOST_GATEWAY

                echo "."
                ;;
        reload | force-reload | restart)
                $0 stop
                $0 start
                ;;
        *)
                echo "Usage: $0 {start|stop|restart}"
esac
=========================== set up tap devices =======================

I found that script somewhere (i didn't make it)
I placed it in /etc/init.d/uml-bridge and then did a
"update-rc.d uml-bridge defaults 99"

As one of the startup params for my uml i then specify eth0
eth0=tuntap,tap0

Hope this helps.

Regards,
Benedict

--
Benedict Verheyen                   Debian User
http://www.heimdallitservices.be    Public Key 0x712CBB8D



Reply to: