|
Quick Demo: Networking |
Note: Before trying this demo, you should be sure to try Quick Demo: Basics first to install SBUML and make sure it works on your machine.
SBUML uses UML's tun/tap interface, which uses a utility called uml_net to set up IP forwarding and routing. To do this, uml_net must be given root privileges, as explained in the User-Mode Linux project website: Virtual Networking
SBUML makes it easy to give uml_net root privileges by popping up a window the first time a networking device is brought up. If SBUML is freshly installed and networking has never been used, you can do the following:
- Boot a new machine:
[(sbumldemo subshell) sbumldemo]$ sbumlboot m toms
- Login to Toms filesystem with username root and password root.
- Bring up networking with a free IP address on your subnet. So if the host machine IP address is h1.h2.h3.h4 do:
# ifconfig eth0 h1.h2.h3.123
If h1.h2.h3.123 is used by another machine. Replace 123 with some other number that is free.
If uml_net has not been installed already, SBUML will now bring up an xterm window asking that you install it. A choice of two methods will be given. Method #1 only works if the sudo command is setup for your user account, but is harmless to try regardless. Method #2 always works, if you have the root password:
- Select option 2:
#? 2
Then follow the four steps that are displayed:
- Become root:
$ su
- Execute the utility to make uml_net setuid root:
# ./sbuml--install_uml_net_as_root
- Exit the root shell:
# exit
- Exit the pop-up xterm:
$ exit
And then the UML virtual machine should finish executing the ifconfig command. From inside the UML machine you should now be able to ping the host:
# ping h1.h2.h3.h4
The uml_net utility is the only part of SBUML that runs with root privileges. The rest, including all of the code in snapshots, runs with normal user restrictions.
|
Networking in Snapshots
Web Page Snapshots can come with networking preconfigured. When the following two snapshots are restored together, they will ping each other. (This has been tested on Redhat 8.0 and Knoppix hosts. Sometimes it takes 10 to 30 seconds for the first ping to get though, for reasons that I am interested in learning.)
Ping1 (80KB delta from test1/toms) : Machine with IP 10.0.0.2 pinging 10.0.0.1
Ping2 (80KB delta from test1/toms) : Machine with IP 10.0.0.1 pinging 10.0.0.2
Here is a similar example with an active socket connection between two machines. Typing in the virtual console of one machine and pressing return will send the characters to the other machine's virtual console. (This has been tested on Redhad 8.0 and Knoppix hosts. Sometimes it takes 10 to 30 seconds for the first characters to get though, for reasons that I am interested in learning. There also may be timeout issues that will eventually break this demo, so be amazed if it works :-) At the very least, you should be able to type ^C in each virtual console and then type ^P to recall the nc commands and reestablish the connection from scratch.
nc-server (72KB delta from ping1/test1/toms) : Machine with IP 10.0.0.2 doing nc -l -p 1234
nc-client (72KB delta from ping2/test1/toms) : Machine with IP 10.0.0.1 doing nc 10.0.0.2 1234
|
|
|
|