All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Help with tun/tap with qemu
@ 2004-08-10 15:06 jesus.salvo
  2004-08-10 15:50 ` Bartosz Fabianowski
  0 siblings, 1 reply; 6+ messages in thread
From: jesus.salvo @ 2004-08-10 15:06 UTC (permalink / raw)
  To: qemu-devel


Host OS: Fedora Core 1
Guest OS on Qemu: RedHat 7.2

I have installed RH 7.2 as the guest OS within qemu, and was using ( by
default ) the user mode network stack. However, that would not allow ( ?? )
the guest OS to talk to the LAN where the host OS is connected to, although I
could get to the external websites ( www.google.com, www.redhat.com, etc. )
and so forth.

So I am trying TUN/TAP.  The guest and host OS can ping each other.
( qemu says "Connected to host network interface: tun0" )
However, the guest OS cannot ping any other host, not even the websites that
was working when using user mode network stack. I tried adding the nameservers
in the guest OS' /etc/resolv.conf, turing off ipchains/ iptables on both guest
and host OS, adding a default gateway on the guest OS, etc ...

Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Help with tun/tap with qemu
  2004-08-10 15:06 [Qemu-devel] Help with tun/tap with qemu jesus.salvo
@ 2004-08-10 15:50 ` Bartosz Fabianowski
  2004-08-10 18:52   ` Antony T Curtis
  0 siblings, 1 reply; 6+ messages in thread
From: Bartosz Fabianowski @ 2004-08-10 15:50 UTC (permalink / raw)
  To: qemu-devel

> So I am trying TUN/TAP.  The guest and host OS can ping each other.
> However, the guest OS cannot ping any other host

If the setup on Linux is any similar to that on FreeBSD (and I am sure 
it is), the problem probably is routing. The guest and host are on 
different networks. So, you need to tell your host to forward packets to 
and from the guest's network. You didn't have that problem in slirp, 
because slirp bridges between the two networks for you, it implicitly 
does the forwarding.

Unfortunately, I can't tell you how to add the route under Linux due to 
my lack of experience with that platform.

- Bartosz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Help with tun/tap with qemu
  2004-08-10 15:50 ` Bartosz Fabianowski
@ 2004-08-10 18:52   ` Antony T Curtis
  2004-08-11  2:45     ` Jesus M. Salvo Jr.
  0 siblings, 1 reply; 6+ messages in thread
From: Antony T Curtis @ 2004-08-10 18:52 UTC (permalink / raw)
  To: qemu-devel

On Tue, 2004-08-10 at 16:50, Bartosz Fabianowski wrote:
> > So I am trying TUN/TAP.  The guest and host OS can ping each other.
> > However, the guest OS cannot ping any other host
> 
> If the setup on Linux is any similar to that on FreeBSD (and I am sure 
> it is), the problem probably is routing. The guest and host are on 
> different networks. So, you need to tell your host to forward packets to 
> and from the guest's network. You didn't have that problem in slirp, 
> because slirp bridges between the two networks for you, it implicitly 
> does the forwarding.
> 
> Unfortunately, I can't tell you how to add the route under Linux due to 
> my lack of experience with that platform.
> 
> - Bartosz

When I am using TAP on FreeBSD, I use ng_bridge so the guest is on the
same network as the host.

Info for configuring ng_bridge is in
/usr/share/examples/netgraph/ether.bridge


-- 
Antony T Curtis, BSc.                   UNIX, Linux, *BSD, Networking
antony.t.curtis@ntlworld.com            C++, J2EE, Perl, MySQL, Apache
                                        IT Consultancy.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Help with tun/tap with qemu
  2004-08-10 18:52   ` Antony T Curtis
@ 2004-08-11  2:45     ` Jesus M. Salvo Jr.
  2004-08-11  2:50       ` Jesus M. Salvo Jr.
  2004-08-11  5:10       ` Jesus M. Salvo Jr.
  0 siblings, 2 replies; 6+ messages in thread
From: Jesus M. Salvo Jr. @ 2004-08-11  2:45 UTC (permalink / raw)
  To: qemu-devel

Antony T Curtis wrote:

>On Tue, 2004-08-10 at 16:50, Bartosz Fabianowski wrote:
>  
>
>>>So I am trying TUN/TAP.  The guest and host OS can ping each other.
>>>However, the guest OS cannot ping any other host
>>>      
>>>
>>If the setup on Linux is any similar to that on FreeBSD (and I am sure 
>>it is), the problem probably is routing. The guest and host are on 
>>different networks. So, you need to tell your host to forward packets to 
>>and from the guest's network. You didn't have that problem in slirp, 
>>because slirp bridges between the two networks for you, it implicitly 
>>does the forwarding.
>>
>>Unfortunately, I can't tell you how to add the route under Linux due to 
>>my lack of experience with that platform.
>>
>>- Bartosz
>>    
>>
>
>When I am using TAP on FreeBSD, I use ng_bridge so the guest is on the
>same network as the host.
>
>Info for configuring ng_bridge is in
>/usr/share/examples/netgraph/ether.bridge
>
>  
>
OK, I have now setup a bridge on linux as follows.
On the host OS, I have the following script and ran it as root:

#!/bin/sh
/usr/sbin/brctl addbr br0
/sbin/ifconfig eth2 0.0.0.0 promisc up
/sbin/ifconfig tap0 0.0.0.0 promisc up
/sbin/ifconfig br0 192.168.0.199 netmask 255.255.255.0 broadcast 
192.168.0.255 up
/usr/sbin/brctl stp br0 off
/usr/sbin/brctl setfd br0 1
/usr/sbin/brctl sethello br0 1
/usr/sbin/brctl addif br0 eth2
/usr/sbin/brctl addif br0 tap0
/sbin/route add default gw 192.168.0.1

I can confirm that the host still has network connectivity using the bridge.

Now the question is, what to do on the qemu side ??
If I just run qemu as normal, qemu says:

    Connected to host network interface: tun0

... because of the /etc/qemu-ifup script on the host OS ( and of course, 
tun0 has an IP address )
Shouldn't qemu use tap0 as per the bridge configuration on the host OS ?
If so, how do u tell qemu to use tap0 instead of tun0 ?
Or should I change the bridge configuration to use tun0 instead of tap0 
on the host OS ?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Help with tun/tap with qemu
  2004-08-11  2:45     ` Jesus M. Salvo Jr.
@ 2004-08-11  2:50       ` Jesus M. Salvo Jr.
  2004-08-11  5:10       ` Jesus M. Salvo Jr.
  1 sibling, 0 replies; 6+ messages in thread
From: Jesus M. Salvo Jr. @ 2004-08-11  2:50 UTC (permalink / raw)
  To: qemu-devel

Jesus M. Salvo Jr. wrote:

> Antony T Curtis wrote:
>
>> On Tue, 2004-08-10 at 16:50, Bartosz Fabianowski wrote:
>>  
>>
>>>> So I am trying TUN/TAP.  The guest and host OS can ping each other.
>>>> However, the guest OS cannot ping any other host
>>>>     
>>>
>>> If the setup on Linux is any similar to that on FreeBSD (and I am 
>>> sure it is), the problem probably is routing. The guest and host are 
>>> on different networks. So, you need to tell your host to forward 
>>> packets to and from the guest's network. You didn't have that 
>>> problem in slirp, because slirp bridges between the two networks for 
>>> you, it implicitly does the forwarding.
>>>
>>> Unfortunately, I can't tell you how to add the route under Linux due 
>>> to my lack of experience with that platform.
>>>
>>> - Bartosz
>>>   
>>
>>
>> When I am using TAP on FreeBSD, I use ng_bridge so the guest is on the
>> same network as the host.
>>
>> Info for configuring ng_bridge is in
>> /usr/share/examples/netgraph/ether.bridge
>>
>>  
>>
> OK, I have now setup a bridge on linux as follows.
> On the host OS, I have the following script and ran it as root:
>
> #!/bin/sh
> /usr/sbin/brctl addbr br0
> /sbin/ifconfig eth2 0.0.0.0 promisc up
> /sbin/ifconfig tap0 0.0.0.0 promisc up
> /sbin/ifconfig br0 192.168.0.199 netmask 255.255.255.0 broadcast 
> 192.168.0.255 up
> /usr/sbin/brctl stp br0 off
> /usr/sbin/brctl setfd br0 1
> /usr/sbin/brctl sethello br0 1
> /usr/sbin/brctl addif br0 eth2
> /usr/sbin/brctl addif br0 tap0
> /sbin/route add default gw 192.168.0.1
>
> I can confirm that the host still has network connectivity using the 
> bridge.
>
> Now the question is, what to do on the qemu side ?? 

Not clear enough.
What I have done so far on the guest OS side is:

/sbin/ifconfig eth0 192.168.0.98 up
/sbin/route add default gw 192.168.0.1

However, the host and guest OS could not ping each other.

Also, how does one setup a bridge in the case where one only has a 
dial-up modem to the ISP, where all I have on the host OS is a ppp 
interface ?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Help with tun/tap with qemu
  2004-08-11  2:45     ` Jesus M. Salvo Jr.
  2004-08-11  2:50       ` Jesus M. Salvo Jr.
@ 2004-08-11  5:10       ` Jesus M. Salvo Jr.
  1 sibling, 0 replies; 6+ messages in thread
From: Jesus M. Salvo Jr. @ 2004-08-11  5:10 UTC (permalink / raw)
  To: qemu-devel

Jesus M. Salvo Jr. wrote:

>>
> OK, I have now setup a bridge on linux as follows.
> On the host OS, I have the following script and ran it as root:
>
> #!/bin/sh
> /usr/sbin/brctl addbr br0
> /sbin/ifconfig eth2 0.0.0.0 promisc up
> /sbin/ifconfig tap0 0.0.0.0 promisc up
> /sbin/ifconfig br0 192.168.0.199 netmask 255.255.255.0 broadcast 
> 192.168.0.255 up
> /usr/sbin/brctl stp br0 off
> /usr/sbin/brctl setfd br0 1
> /usr/sbin/brctl sethello br0 1
> /usr/sbin/brctl addif br0 eth2
> /usr/sbin/brctl addif br0 tap0
> /sbin/route add default gw 192.168.0.1
>

Works now. Changed references of tap0 to tun0 in the above script.
I have to run the script just after running qemu, since the tun0 
interface is not created until qemu is ran.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-08-11  5:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-10 15:06 [Qemu-devel] Help with tun/tap with qemu jesus.salvo
2004-08-10 15:50 ` Bartosz Fabianowski
2004-08-10 18:52   ` Antony T Curtis
2004-08-11  2:45     ` Jesus M. Salvo Jr.
2004-08-11  2:50       ` Jesus M. Salvo Jr.
2004-08-11  5:10       ` Jesus M. Salvo Jr.

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.