I spent some time today refining and adding to my ethernet interface
for user-mode linux. I is a bit more resiliant now, still not one hundred
percent though. I am attaching the diff vs uml pre6 version. I put the
userland utils (uml-net and uml-set) into the linux/drivers/net/uml-net
directory. I know this against the rules, but it make my life easier
for now.
Here is how to use it: (starting from a raw Linux 2.3.99-pre6 kernel)
(first add the UML patch - patch-2.3.99-pre6.bz2)
cd linux
bzip2 -dc ../patch-2.3.99-pre6.bz2
(then my patch)
patch -p1 < ../uml.diff
(nothing new here)
make menuconfig
make linux
(the userland uml-net utils)
cd drivers/net/uml-net/
make
(mount the uml root file systems so you can copy a utility into them)
mount -o loop -t ext2 root_fs /mnt
cp uml-set /mnt/root/
Now start start them up:
(in window one start 'uml-net' from linux/drivers/net/uml-net/)
./uml-net
(in window two start a uml kernel)
(in window three start another uml kernel)
NOTE!! you should be using seperate root file systems for these!!
(in windows two, after logging in in as root)
ifconfig eth0 hw ether 0:0:10:0:0:1
ifconfig eth0 10.0.0.1
ifconfig eth1 hw ether 0:0:11:0:0:1
ifconfig eth1 11.0.0.1
./uml-set eth1 101
(in windows three, after logging in in as root)
ifconfig eth0 hw ether 0:0:10:0:0:2
ifconfig eth0 10.0.0.2
ifconfig eth1 hw ether 0:0:11:0:0:2
ifconfig eth1 11.0.0.2
./uml-set eth1 101
This is kinda of lame example because its not really fun connecting
2 uml's together with two ethernet :-)
In theory you should be able to start up as many uml's as you like, and
then network them together in any way you want.
A couple of notes:
- by default each uml has 4 ethenets (eth0-3), this is hard coded, I don't
know how to write my code to respect the "ether=,,,eth0" kernel command line
- 'uml-set' set's which broadcast domain (net_num) you want the interface to be
in. (the default net_num in 100 all interface be default are a member of it)
- just execute the uml-set command on any interface on any uml that you
want to 'hear' packets for a particular broadcast domain (net_num)
- you can only set the hw address when the interface is down
- you can only set the uml broadcast domain (net_num) when the interface
is up
- the best order of operation is to set the hw address as soon as the uml comes
up. You can bring up the interface right after that. They feel
free to change the IP address and broadcast domain as much as you want
just don't be bringing down the interfaces!
- don't be bringing interface up then down too much, the uml's tend to crash :-)
- don't be shutting down the uml-net process when uml's are connected to it
the uml's tend to crash :-)
- for some reason one uml thread stays behind after shutting down a uml
you'll want to kill these, unless you have CPU cycles to burn :-)
- you'll notice weird delays between pings. I'm not sure where this is coming
from. I think uml's are experiencing time warps :-)
- multicast doesn't work yet, that's the next feature to add.
Have fun.
Jim
--
James R. Leu
|