I am setting up multiple UML machines to simulate multiple machines communicating through a router using "http://read.cs.ucla.edu/click/" .
So, I need separate virtual interfaces for each UML so that the router can see several machines.

Actually, I figured out the problem of why my second UML machine is not able to talk to the world.
It sends arp request for which there is no response.

When the first UML machines runnning on tap2 asks for arp requests:

[root@host machine]# tcpdump -i tap2
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on tap2, link-type EN10MB (Ethernet), capture size 96 bytes
01:30:06.156300 arp who-has 192.168.1.3 tell 192.168.1.157
01:30:06.159457 arp reply 192.168.1.3 is-at 7e:6c:d7:2b:4b:c2 (oui Unknown)

But, there is no reply when UML 2 asks :

[root@host machine]# tcpdump -i tap3
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on tap3, link-type EN10MB (Ethernet), capture size 96 bytes
01:30:47.696259 arp who-has 192.168.1.2 tell 192.168.1.221
01:30:48.687073 arp who-has 192.168.1.2 tell 192.168.1.221
01:30:49.687283 arp who-has 192.168.1.2 tell 192.168.1.221
01:30:50.699133 arp who-has 192.168.1.2 tell 192.168.1.221
01:30:51.699274 arp who-has 192.168.1.2 tell 192.168.1.221


Is there any reason why this should happen ?

The commands that I used for setting up tap2 and tap3 are :

tunctl -t tap2
ifconfig tap2 192.168.1.2 up
echo 1 > /proc/sys/net/ipv4/conf/tap2/proxy_arp
iptables -I FORWARD -o tap2 -j ACCEPT
iptables -I FORWARD -i tap2 -j ACCEPT

tunctl -t tap3
ifconfig tap3 192.168.1.3 up
echo 1 > /proc/sys/net/ipv4/conf/tap3/proxy_arp
iptables -I FORWARD -o tap3 -j ACCEPT
iptables -I FORWARD -i tap3 -j ACCEPT

route add -host 192.168.1.2 dev tap2
route add -host 192.168.1.3 dev tap3

arp -Ds 192.168.1.2 eth0 pub
arp -Ds 192.168.1.3 eth0 pub

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE

echo 512 > /proc/sys/net/ipv4/neigh/default/gc_thresh1
echo 1024 > /proc/sys/net/ipv4/neigh/default/gc_thresh2
echo 2048 > /proc/sys/net/ipv4/neigh/default/gc_thresh3
echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp


Any help is very much appreciated

-Leo


On Mon, Apr 26, 2010 at 1:57 AM, Rahul Gauba <rahul_gauba@yahoo.com> wrote:
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