Umview+Umnet
Umview starts the first process running inside the (partial) virtual machine. This process and all its offspring run under the control of umview.
The command:
$ umview xterm
starts an xterm running inside the virtual machine. It is possible to use rxvt or bash instead of xterm.
Before loading any module umview does nothing. Processes running inside the umview machine behave in the same way of all the others processes.
Contents |
umnet
The umnet module supports virtual networking stacks:
The simplest way to start it is:
$ um_add_service umnet
umnetlwipv6
Networking stacks can be mounted:
$ mount -t umnetlwipv6 none /dev/net/default $ ip addr 1: lo0: <LOOPBACK,UP> mtu 0 link/loopback inet6 ::1/128 scope host inet 127.0.0.1/8 scope host 2: vd0: <BROADCAST> mtu 1500 link/ether 02:02:38:bd:cd:06 brd ff:ff:ff:ff:ff:ff $
The output of the ip command shows the default interfaces defined by lwipv6: lo0 i.e. localhost and a vde interface. (we support ip for network configuration instead of ifconfig because ip has a complete and consistent management of IPv6 multiple addresses and it is based on the portable AF_NETLINK interface. ifconfig instead uses /proc to read info. ip is usually part of the iproute packet).
Lwipv6 is able to create several interfaces connected to different vde switches, to tun or tap interfaces.
The following commands:
$ mount -t umnetlwipv6 -o vd0=/tmp/v1 none /dev/net/default $ mount -t umnetlwipv6 -o vd0=/tmp/v1,vd1=tmp/v2 none /dev/net/default $ mount -t umnetlwipv6 -o vd0=/tmp/v1,tp0=tap2,tn0=tun2 none /dev/net/default
- attach a vde interface to a specific switch;
- create two vde interfaces connected to two different switches;
- create a vde, a tap and a tun interface;
respectively.
In the latter case the user must have the permissions to create virtual interfaces. For kernels 2.6.18 and above this means that the system administrator must have already created the interfaces in advance in this way:
# tunctl -u username -t tap2 # tunctl -u username -t tun2
umnetlwipv6
Networking stacks can be mounted:
$ mount -t umnetlwipv6 none /dev/net/default $ ip addr 1: lo0: <LOOPBACK,UP> mtu 0 link/loopback inet6 ::1/128 scope host inet 127.0.0.1/8 scope host 2: vd0: <BROADCAST> mtu 1500 link/ether 02:02:38:bd:cd:06 brd ff:ff:ff:ff:ff:ff $
The output of the ip command shows the default interfaces defined by lwipv6: lo0 i.e. localhost and a vde interface. (we support ip for network configuration instead of ifconfig because ip has a complete and consistent management of IPv6 multiple addresses and it is based on the portable AF_NETLINK interface. ifconfig instead uses /proc to read info. ip is usually part of the iproute packet).
Lwipv6 is able to create several interfaces connected to different vde switches, to tun or tap interfaces.
The following commands:
$ mount -t umnetlwipv6 -o vd0=/tmp/v1 none /dev/net/default $ mount -t umnetlwipv6 -o vd0=/tmp/v1,vd1=tmp/v2 none /dev/net/default $ mount -t umnetlwipv6 -o vd0=/tmp/v1,tp0=tap2,tn0=tun2 none /dev/net/default
- attach a vde interface to a specific switch;
- create two vde interfaces connected to two different switches;
- create a vde, a tap and a tun interface;
respectively.
In the latter case the user must have the permissions to create virtual interfaces. For kernels 2.6.18 and above this means that the system administrator must have already created the interfaces in advance in this way:
# tunctl -u username -t tap2 # tunctl -u username -t tun2
Setting IP addresses
Lwipv6 interfaces can be configured using the ip command like any other interface. Virtual interfaces start in down state, thus they must be activated.
$ ip link set vd0 up $ ip addr add 192.168.1.1/24 dev vd0
Lwipv6 supports ipv6 autoconfiguration, thus if there is a radv server running on the virtual network the interface get automagically configured.
It is also possible to run a dhcp client.
For example this is the command to set up a vde interface using the udhcpc tool:
$ ip link set vd0 up $ /sbin/udhcpc -i vd0 -q -s ~/etc/udhcpc/default.script udhcpc (v0.9.9-pre) started Nothing to flush. Nothing to flush. Sending discover... Sending select for 192.168.1.1... Lease of 192.168.1.1 obtained, lease time 600 Nothing to flush. Nothing to flush. adding dns 192.168.1.254 $
The contents of the ~/etc/udhcpc directory can be downloaded here: udhcpc.tar.bz2
running several stacks at the same time
In the examples above we have mounted the stack on /dev/net/default (default network). We can have several stacks mounted on different pathnames. E.g.
$ mount -t umnetlwipv6 -o vd0=/tmp/v1 none /dev/net/net1 $ mount -t umnetlwipv6 -o vd0=/tmp/v1,vd1=tmp/v2 none /dev/net/net2 $ mount -t umnetlwipv6 -o vd0=/tmp/v1,tp0=tap2,tn0=tun2 none /dev/net/net3
mstack is the command to decide which stack to use for a command:
$ mstack /dev/net/net1 ip addr $ mstack /dev/net/net2 ssh cs.myuniv.edu $ exec mstack /dev/net/net3 bash
ip addr will use net1, the ssh connection uses net2 and after the third command the standard stack is net3.