FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 07-16-2008, 02:57 AM
David Barrett
 
Default 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 172.20.0.3:80...
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
172.20.0.2 and 172.20.0.3, 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:172.20.0.1 Bcast:172.20.255.255 Mask:255.255.0.0
inet6 addr: fe80::2ff:84ff:fe12:9d72/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
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:172.20.0.1 Bcast:172.20.255.255 Mask:255.255.0.0
inet6 addr: fe80::2ff:afff:fe9a:4829/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
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 172.20.0.2 <--- image1 has: address 172.20.0.3
netmask 255.255.0.0
gateway 172.20.0.1


The upshot is "wget http://172.20.0.2" and "wget http://172.20.0.3" 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 http://172.20.0.3
--18:17:12-- http://172.20.0.3/
=> `index.html.1'
Connecting to 172.20.0.3:80... failed: No route to host.
david@SonOfLappy:/svn/staging$

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

68.28.57.85 * 255.255.255.255 UH 0 0 0 ppp0
172.20.0.0 * 255.255.0.0 U 0 0 0 tap0
172.20.0.0 * 255.255.0.0 U 0 0 0 tap1
default * 0.0.0.0 U 0 0 0 ppp0
david@SonOfLappy:/svn/staging$

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!

-david



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-16-2008, 04:07 AM
Alex Samad
 
Default Two taps, one IP?

Sorry for the top post.

But the problem is you have 2 interfaces in the same non connected
network


if .3 is on tap1 then add

ip r a 172.20.0.3/32 dev tap1
ip r a 172.20.0.2/32 dev tap0


Your solution use vde to link the tap's or change the ip network so they
are not the same

Alex

On Tue, Jul 15, 2008 at 07:57:04PM -0700, David Barrett wrote:
> 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 172.20.0.3:80...
> 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
> 172.20.0.2 and 172.20.0.3, 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:172.20.0.1 Bcast:172.20.255.255 Mask:255.255.0.0
> inet6 addr: fe80::2ff:84ff:fe12:9d72/64 Scope:Link
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> 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:172.20.0.1 Bcast:172.20.255.255 Mask:255.255.0.0
> inet6 addr: fe80::2ff:afff:fe9a:4829/64 Scope:Link
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> 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 172.20.0.2 <--- image1 has: address 172.20.0.3
> netmask 255.255.0.0
> gateway 172.20.0.1
>
>
> The upshot is "wget http://172.20.0.2" and "wget http://172.20.0.3" 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 http://172.20.0.3
> --18:17:12-- http://172.20.0.3/
> => `index.html.1'
> Connecting to 172.20.0.3:80... failed: No route to host.
> david@SonOfLappy:/svn/staging$
>
> 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
> 68.28.57.85 * 255.255.255.255 UH 0 0 0 ppp0
> 172.20.0.0 * 255.255.0.0 U 0 0 0 tap0
> 172.20.0.0 * 255.255.0.0 U 0 0 0 tap1
> default * 0.0.0.0 U 0 0 0 ppp0
> david@SonOfLappy:/svn/staging$
>
> 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!
>
> -david
>
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a
> subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
>

--
But it does move!
-- Galileo Galilei
 
Old 07-16-2008, 04:24 AM
David Barrett
 
Default Two taps, one IP?

Alex Samad wrote:

Sorry for the top post.

But the problem is you have 2 interfaces in the same non connected
network


if .3 is on tap1 then add


ip r a 172.20.0.3/32 dev tap1
ip r a 172.20.0.2/32 dev tap0


Your solution use vde to link the tap's or change the ip network so they
are not the same

Alex


Yep, you're completely right. I was just in the process of writing:

Success! I didn't go the VDE route, I just fixed it so tap0 and tap1
have different IPs. It's so obvious I don't know why it didn't occur to
me before.


I did this by simply skipping the default "qemu-ifup" script, which is:

david@SonOfLappy:/svn/staging$ cat /etc/qemu-ifup
#!/bin/sh
sudo -p "Password for $0:" /sbin/ifconfig $1 172.20.0.1
david@SonOfLappy:/svn/staging$

And instead creating separate image0-ifup and image1-ifup scripts as:

david@SonOfLappy:/svn/staging$ cat image0-ifup
#!/bin/sh
sudo -p "Password for $0:" /sbin/ifconfig $1 172.20.0.1
david@SonOfLappy:/svn/staging$ cat image1-ifup
#!/bin/sh
sudo -p "Password for $0:" /sbin/ifconfig $1 172.21.0.1
david@SonOfLappy:/svn/staging$

Then I start it with:

sudo qemu -kernel-kqemu -net nic,macad0:00:00:00 -net
tap,script=image0-ifup image0.raw


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


Now it works great, I can wget from the host to both guests. Granted,
the guests can't talk to each other, but that's actually a good thing as
I'm explicitly trying to segment them apart. Hooray for qemu, and
thanks for all your help!


-david


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 01:19 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org