Networking with UMLs -- Robert McCabe, Spring 2008 It is possible to do lab2b with only two machines. This is my setup:: ____Machine #10___ | _____ | | |UML1| | | |.180| | | | | Machine | __|__ | _#11__ | |UML2| | | | | |.181|---.254|.10 ----.11 | | |________________| |____| On Machine #10 I have two uml's running UML1 is the kernel that will capture the TCP statistics. UML2 is the kernel that is running the modified version of ip_forward.c (to drop packets in a deterministic manner). Machine #11 is simply the sink of the sock program. Unfortunately, to get UML1 to route through UML2 (and not directly to the .254 interface) takes some work. Here are the steps: First on the host machine configure the tap0 interface to allow multiple uml instances (otherwise each uml gets its own tap interface -- which effectively acts as a point-to-point link): machine10-host# uml_switch -tap tap0 -unix /tmp/umlsw -daemon This will start a background process called uml_switch. Manually bring up the tap0 interface and do the book-keeping normally done by the uml_utilities: machine10-host# ifconfig tap0 192.168.0.254 netmask 255.255.255.0 up machine10-host# echo 1 > /proc/sys/net/ipv4/ip_forward machine10-host# route del -net 192.168.0.0 dev tap0 netmask 255.255.255.0 machine10-host# route add -host 192.168.0.181 dev tap0 machine10-host# route add -net 192.168.0.176 dev tap0 netmask 255.255.255.240 gw 192.168.0.181 machine10-host# echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp machine10-host# arp -Ds 192.168.0.181 eth0 pub Start your two uml instances: machine10-host# ./linux_tcp_show ubd0=root_fs_cow1,root_fs umid=uml1 mem=128M eth0=daemon,,unix,/tmp/umlsw machine10-host# ./linux_drop_pkt ubd0=root_fs_cow2,root_fs umid=uml2 mem=128M eth0=daemon,,unix,/tmp/umlsw In both UML1 and UML2 do: uml1&2# for f in /proc/sys/net/ipv4/conf/*/*redirects; do echo 0 > $f;done (without this UML2 will send back "route re-direct" messages to UML1 and UML1 will start to route directly to .254) you need to restart the network for setting to take effect uml1&2# /etc/rc.d/init.d/network restart Set up routing table in uml1: ifconfig eth0 192.168.0.180 route del -host 192.168.0.254 dev eth0 route del default gw 192.168.0.254 route del -net 192.168.0.0 dev eth0 netmask 255.255.255.0 route add -host 192.168.0.181 dev eth0 route add default gw 192.168.0.181 set up routing table in uml2: ifconfig eth0 192.168.0.181 route del -net 192.168.0.0 dev eth0 netmask 255.255.255.0 route add -host 192.168.0.254 dev eth0 route add -host 192.168.0.180 dev eth0 route add default gw 192.168.0.254 echo 1 > /proc/sys/net/ipv4/ip_forward Give machine #11 a route to UML1 machine11# route add -host 192.168.0.180 gw 192.168.0.10 dev eth0 IP address : 192.168.0.180 IP network number : 3019942080 IP address : 192.168.0.254 IP network number : 4261456064