On 19 Sep 2006 00:59:56 -0400, Jonas M. Meyer 01 <Jonas.M.Meyer.01@alum.dartmouth.org> wrote:

---ben@666.com wrote ---
> i'm trying to get uml working with modules.  i downloaded
the latest kernel
>, compiled using the `defconfig', obtained the
root fs from
> http://uml.nagafix.co.uk/Debian-3.1/ (which claims to have
been updated sept
> 13 2006), and ran ./linux.
> note, my host machine is running, ubuntu 5.04
"hoary hedgehog".
--- End of quote ---

You need to do the following to get networking to work (note
that this is under dapper drake, so you may need to upgrade
the host.  It works with breezy badger guests though).

make sure appropriate packages are installed (uml-utilities
kernel-patch-skas screen).
add the user who is running the guest to the group uml-net
make a directory as root under /etc/uml
modify your /etc/rc.local file to be as follows:

# Set up UML Networking

# make it so umls can use taptun
chown root:uml-net /dev/net/tun

# make the host forward low level ip packets from umls to
local subnet
# This lets routers and stuff know how to find the uml
echo 1 > /proc/sys/net/ipv4/ip_forward

# Crank up the UMLs
exit 0

Under /etc/uml create a shell script and make it executable.
Name it #INSERT VM MACHINE NAME HERE#.sh and make it read
as follows, replacing user names and ip addresses as

#!/bin/sh -e

# Set global variables

# make a tap interface (fake ethernet link that the host and
guest communicate via
tunctl -u jmeyer -b -t jmeyertap
ifconfig jmeyertap $HOST_IP up netmask

# tell the host how to talk to the uml
route add -host $GUEST_IP dev jmeyertap

# make the host forward low level ip packets from umls to
local subnet
# This lets routers and stuff know how to find the uml
echo 1 > /proc/sys/net/ipv4/conf/jmeyertap/proxy_arp

# now do it back the other way to the uml
arp -Ds $GUEST_IP eth0 pub

# Crank up UMLs
screen -d -m -S jmeyer su - jmeyer -c "cd /home/jmeyer ;
/usr/bin/linux ubd0=root_fs ubd1=swap eth0=tuntap,jmeyertap

Name the root_fs "root_fs" and put it in the home directory
of the user.
Use dd to make a swap file:
dd if=/dev/zero of=swap bs=1G seek=1 count=0
(Note that this makes a sparse swap file, which could be
VERY BAD if the host runs out of disk space and the swap
file isn't full size yet).
mkswap swap

Change /etc/fstab to make your /tmp use tmpfs.  Otherwise
your guests' memory will be on disk, which is very slow.

Now boot the uml (you don't have to restart, you can just
"sudo /etc/rc.local ; sudo /etc/uml/#INSERT VM NAME HERE#.sh").

use screen -r to get to the uml bootup messages. (Use
ctrl-a, ctrl-d to get out again).

Now that you are in the guest, you need to set up the guest
side of networking.  Edit /etc/resolv.conf to point at a
nameserver that is valid for you.  Edit
/etc/network/interfaces as follows (.11 is my guest, and .51
is my host, so change the file so that it works for your ip

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        up route add -host dev eth0
        up route add default gw
        down route del -host dev eth0
        down route del default gw

bring up eth0 (ifup eth0) and everything should be all set.

thanks for the detailed directions.

i used the ubuntu root fs on uml.nagafix.co.uk, followed all your directions and i get

root@ubuntu:~# ifup eth0
SIOCSIFFLAGS: Permission denied
SIOCSIFFLAGS: Permission denied
Failed to bring up eth0.

why is networking so insanely difficult to get working?  this is about the 8th time i've tried to get it up.

on uml.nagafix.co.uk it gives "simple" directions for getting your UML to work with dhcp.  but it doesn't work either.  for one thing, the directions don't say what to put in /etc/network/interfaces on the guest.  i tried

iface eth0 inet dhcp

but that didn't work; when you `ifup eth0', you get an intro message from the dhcp client and then it hangs the terminal entirely.

any ideas?