Starting a UML session

Now we need to start a UML session and connect it to our tap device. The following line is merely an example and will most likely not work "out of the box". The important thing to notice is that "eth0" is connected to a tuntap device. Anything after the first comma is considered extra parameters, for tuntap we need only specify the name of the tun device on the host we wish to connect to.

# ./linux ubd0=./root_fs mem=64M con=null con0=fd:0,fd:1 \
devfs=nomount eth0=tuntap,uml-conn0

Presuming we've now managed to get into the UML session the next step is to login as the superuser and configure the devices. For the network in our example we want to configure our UML with an IP of 192.168.0.X and a subnet mask of 255.255.255.0.

# ifconfig eth0 192.168.0.201 netmask 255.255.255.0 up

We should now be able to communicate with other machines on the local network! Test this by pinging other hosts on the network, connecting to services etc. On the network in the example our gateway to networks other than our own (the Internet, for example) is 192.168.0.100, which can be set as follows.

# route add default gw 192.168.0.100
[Note] Note

We do not need to set the gateway in order for our UML to communicate with other machines on the network. It just happens that in this example our gateway to the internet is the same host that is running the UML session.

[Important] Important

Don't forget to create /etc/resolv.conf on the UML filesystem with nameserver information. It should be sufficient to copy this from the host. See man resolv.conf for more information.

We should now have a host with a bridge running on it that sends traffic around to our UML sessions. If there is a gateway and it is set inside the UML session we should also be able to access the internet.