[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Two taps, one IP?

Can you suggest any way for me to configure my Ubuntu host or Debian qemu guests such that the host can access each webserver running in both guests?

(I originally posted this to the qemu list, but I'm starting to think it's not a qemu issue; rather, I think qemu is fine but I'm configuring either my Debian guests or Ubuntu host wrong. I expect it's the sort of thing that the right person will say "ah, obviously!" -- are you that person?)

In particular, I'm able to access the webserver on one image just fine, but not the other: wget fails with "Connecting to failed: No route to host."

Can you explain why and set me straight?

I have two Debian qemu images (0 and 1), identical in all respects except that image0 and image1 are configured to use static IPs and, respectively. I've launched both simultaneously with the following commands:

sudo qemu -kernel-kqemu -net nic,macaddr=00:00:00:00:00:00 -net tap image0.raw

sudo qemu -kernel-kqemu -net nic,macaddr=00:00:00:00:00:11 -net tap image1.raw

This creates two tap interfaces (0 and 1) on the Ubuntu host, curiously with the same IP:

tap0      Link encap:Ethernet  HWaddr 00:ff:84:12:9d:72
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::2ff:84ff:fe12:9d72/64 Scope:Link
          RX packets:18 errors:0 dropped:0 overruns:0 frame:0
          TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:1336 (1.3 KB)  TX bytes:4704 (4.5 KB)

tap1      Link encap:Ethernet  HWaddr 00:ff:af:9a:48:29
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::2ff:afff:fe9a:4829/64 Scope:Link
          RX packets:24 errors:0 dropped:0 overruns:0 frame:0
          TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:1656 (1.6 KB)  TX bytes:4664 (4.5 KB)

Furthermore, each image is configured with the following /etc/network/interfaces:

auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet static
address  <--- image1 has: address

The upshot is "wget"; and "wget"; each work fine inside their respective VMs. But each is unable to wget the other's webserver.

Furthermore, and most unusual, the host is able to wget image0's webserver fine, but not image1. Specifically, the second wget fails as follows:

david@SonOfLappy:/svn/staging$ wget
           => `index.html.1'
Connecting to failed: No route to host.

The error message suggests some sort of routing problem, and the routing table is:

david@SonOfLappy:/svn/staging$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface     *      UH    0      0        0 ppp0      *          U     0      0        0 tap0      *          U     0      0        0 tap1
default         *              U     0      0        0 ppp0

However, I'll admit I don't know much about the routing layer and thus I'm not sure how to diagnose beyond that. But it seems very strange to me to have two network interfaces with the same IP.

With this in mind, if I shut down image0, the tap0 interface goes away, and now the wget to image1 works fine. Again, this is suggesting there's some kind of conflict where the second tap interface is somehow "blocked" by the first.

Anyway, that's as far as I can get. Can you suggest any way I can configure the host's routing table in order to access image1? Or can I manually create and share a single tap device? (I tried setting fd=tap0 on the second launch command, but this had no effect.)

(Incidentally, I also tried putting the second image onto a different vlan by replacing adding "vlan=0" with "vlan=1" to each image's respective launch command, but that had no effect -- the results were identical.)

Any suggestions?  Thanks for any tips you can provide!


Reply to: