RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Ubuntu Eye for the Debian Guy: Running Linux on Linux : Page 2

Take a journey around the world of Ubuntu 7.10 without exiting from Debian. Along the way, you'll learn how to run multiple Linux-in-Linux instances for development and study.

The Linux Host Setup
The following is the setup for my scenario:
  • Machines in my LAN (host network) have IP addresses such as 192.168.0.X.
  • The host IP address is
  • The two UML guest machines are named Uml1 and uml2 and their addresses are and, respectively.
  • The Internet gateway in the LAN has the IP address

I had to add a bridge instance in the host machine using brctl, the utility provided by the bridge-util package for Ethernet bridge administration:

brctl addbr the_bridge

You can set other bridge parameters with the brctl utility as well (such as settings for variables affecting the Spanning Tree protocol), but these are related to complex network topologies and are beyond the scope of this article.

I then started up the bridge interface as I do with a normal network interface, by calling it the_bridge and assigning the IP address with a relative netmask that I would assign to the host if it were normally on the LAN:

ifconfig the_bridge netmask up

Once the bridge was up (you can check it with ifconfig), it was like I had a physical Ethernet switch with sockets to connect the other machines in the network. The first machine I needed to connect was the host itself. Every connection to the bridge consists of the configuration of a standard eth0 interface as a promiscuous one with the IP address, which has to be successively added to the bridge:

ifconfig eth0 promisc up
brctl addif the_bridge eth0

Then I needed to add my default gateway to access the Internet:

route add default gw

Figure 1. Logic Schema of Network Solution: I had to plug in all the other UML machines that I wanted to power on inside the Linux host.

Next, I had to plug in all the other UML machines that I wanted to power on inside the Linux host. Each UML in the host required that I:

  • create the TAP interface to be associated to the network interface eth0 of UML and assign it to a particular user (host-user);
  • configure and rise up the TAP as a promiscuous interface;
  • add the TAP interface to the bridge.

For the first and second UML machines, I run as follows (see Figure 1):

tunctl -u host-user -t the_uml_conn1
ifconfig the_uml_conn1 promisc up
brctl addif the_bridge the_uml_conn1

tunctl -u host-user -t the_uml_conn2
ifconfig the_uml_conn2 promisc up
brctl addif the_bridge the_uml_conn2

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date