I've been out of UML for a while, but perhaps I can still throw something
useful in the mix.

rh

#!/bin/bash
#  
# tuntap script
#
# Create and configure the tap devices for UML users
# This script will do a maximum of 10 (0-9), but can easily be changed
#
# You can delete (or rename) the "uml_net" helper to remove a security hole.
# UML users will not be able to reconfigure their network TAP device and
# will not be able to use another. As far as I know?!?!?!?
#
# The UMLaddr should be "real" so the UML server can be seen.
# The HOSTaddr can be "fake" or any address you like.  You can conserve IP
# addresses this way.  Of course, they can be real as well.
#
# The UML client is setup the normal way.  The default route gateway is
# the IP address for eth0.
#
# I use the following example ethernet specification on my command line:
#           eth0=tuntap,tap0,FE:FF:C0:A8:01:C8,10.50.15.200
#
# 2004.08.13.Richard Hagemeyer,VE3UNW   Initial script  (a Friday)
#
############################################################################
##############################
#
#  Some variables to keep things easy
#
NETWORK="192.168.1.0/24"                                                #
Your network address/netmask
UMLaddr="192.168.1.20"          #ex: 192.168.1.200-209                  # IP
addr prefix of the UML end
HOSTaddr="10.50.15.20"          #ex: 10.50.15.200-209                   # IP
addr prefix of the HOST end
UMLuser="uml"                   #ex: uml0,uml1,eml2....                 #
The uml username "prefixes"
ETH="eth0"                                                              #
The real ethernet device

route del -net 169.254.0.0/16                                           #
Don't need this route
modprobe tun                                                            #
Get the tun module loaded
echo 1 > /proc/sys/net/ipv4/ip_forward                                  #
Allow the host to forward

for i in 0 1 2 3 4 ; do                                                 #
Loop to create devices/users
        tunctl -u ${UMLuser}${i} -t tap${i}                             #
Create the TAP device
        ip link set dev tap${i} up                                      #
Add the TAP device
        ifconfig tap${i} ${HOSTaddr}${i} netmask 255.255.255.255 up     #
Configure the TAP device
        route add -host ${UMLaddr}${i} tap${i}                          #
Need a route to the device
        route del -net ${NETWORK}                                       #
Delete the default route created
        echo 1 > /proc/sys/net/ipv4/conf/tap${i}/proxy_arp              #
Allow dynamic configuration
        arp -Ds ${UMLaddr}${i} ${ETH} pub                               #
eth0 should respond to the UMLip
done

route add -net ${NETWORK} ${ETH}                                        #
Add the default route back

ifconfig                                                                #
See what we've done
route -n
arp -n


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to