Hi!,
 
    I think you can still work with a single tap device and keep it simple. I generally run 4-5 UML on a single host and all of them are reachable from other machines on the LAN. Assuming that my machine as a static IP 10.121.32.231, I run multiple UML instances as:
./linux-2.6.24-rc7 mem=1400M ubda=./Fedora_fs eth0=tuntap,,,10.121.32.231
 
When the UML comes UP, login to the UML instance, assign a static IP to eth0 and add a default route on each UML instance. This should get all your UMLs on the LAN.
 
Thanks,
Rahul

 


From: Leo Prasath <leo.prasath@gmail.com>
To: user-mode-linux-user@lists.sourceforge.net
Sent: Mon, April 26, 2010 10:04:40 AM
Subject: [uml-user] UML Networking setup

Hi All,

I am having trouble setting up networking with multiple UML instances on the same machine.

The host machine is on a subnet with IP 128.105.104.106.

I am creating two UML instances and I want to make sure they both can communicate with each other.
I do not want to use a bridge ( because I want all the packets to go through the host machine so that I can play around with Click router simulator ).

I first tried creating two tap devices in the same subnet 192.168.0.0/24. And I started two UML instances on each of these tap devices.
The first one could connect to outside world. But the second UML instance had problems.
So, I tried with each of the tap devices on two different subnets like below :


tap2      Link encap:Ethernet  HWaddr 4E:E2:99:EE:A5:A1 
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::4ce2:99ff:feee:a5a1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:524 errors:0 dropped:0 overruns:0 frame:0
          TX packets:407 errors:0 dropped:27 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:55603 (54.2 KiB)  TX bytes:62939 (61.4 KiB)

tap3      Link encap:Ethernet  HWaddr C6:04:42:8B:80:47 
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::c404:42ff:fe8b:8047/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:259 errors:0 dropped:0 overruns:0 frame:0
          TX packets:94 errors:0 dropped:27 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:19790 (19.3 KiB)  TX bytes:16796 (16.4 KiB)

I have run the following commands for each of the tap devices :

iptables -t nat -I POSTROUTING -o tap3 -j MASQUERADE
iptables -I FORWARD -o tap2 -j ACCEPT
iptables -I FORWARD -i tap2 -j ACCEPT

I start my UML instances with the following commands:

./kernel64-2.6.33.2_64 ubda=CentOS5-AMD64-root_fs_64_2 eth0=tuntap,tap3,fe:f0:00:00:00:03,192.168.1.3  con0=fd:0,fd:1 mem=256M
./kernel64-2.6.33.2_64 ubda=CentOS5-AMD64-root_fs_64_1 eth0=tuntap,tap2,fe:f0:00:00:00:03,192.168.0.2  con0=fd:0,fd:1 mem=256M

Can someone give me some pointers on how to setup 2 or more UML instances on the same host ?

Thanks,
-Leo