qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] tun network
@ 2004-05-14 20:10 vaise
       [not found] ` <20040515173848.GA22840@yuri.org.uk>
  0 siblings, 1 reply; 10+ messages in thread
From: vaise @ 2004-05-14 20:10 UTC (permalink / raw)
  To: qemu-devel

On Mandrake 10, I have /dev/net/tun, but no /dev/net/tun0
Is it normal ? 

so Renzo Script tells me :
SIOCSIFADDR: No such device
tun0: unknown interface: No such device

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

* Re: [Qemu-devel] tun network
       [not found] ` <20040515173848.GA22840@yuri.org.uk>
@ 2004-05-17 19:37   ` vaise
  0 siblings, 0 replies; 10+ messages in thread
From: vaise @ 2004-05-17 19:37 UTC (permalink / raw)
  To: qemu-devel

On Saturday 15 May 2004 18:38, you wrote:
> On Fri, May 14, 2004 at 09:10:05PM +0100, vaise@votreservice.com wrote:
> > On Mandrake 10, I have /dev/net/tun, but no /dev/net/tun0
> > Is it normal ?
>
> Yes this is normal, qemu creates the corresponding network
> device when it is started.  THe /dev/net/tun is used
> for all tun interfaces for communication with userspace.
>
> If you interface up script fails to run for whatever reason
> i think it may not allocated it.  You can work arround this
> by setting -n /bin/true # then manually configuring the tunN
> interface that will come into existance.
>

I found my mistake !
"-1 the device node /dev/net/tun with read/write permissions" !!! 
so :
crw-rw----  1 me root 10, 200 Jan  1  1970 /dev/net/tun

I, too, should learn to read...


just a litle thing : it could be a good idea to remane the files 
"bin00004.bin" and "bin00005.bin".
-they are not binaries
-it is not very clear who is who

Thank you again Renzo for your very good work.

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

* Re: [Qemu-devel] TUN network
@ 2004-07-27 16:40 Thomas Munn
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Munn @ 2004-07-27 16:40 UTC (permalink / raw)
  To: qemu-devel

You might find the list a little non-comunicative.  You will need a
qemu-ifup script which you can call with the -n paramater.

You also need to compile the "tun/tap" device for your kernel or insert
the module if you already have it.  e.g. modprobe tun.

Additionally you will need to turn on ip-forwarding, by

echo 1>/proc/sys/net/ipv4/ip_forward 

Hope this helps.  Thomas Still haven't figured out how to iptables the
host, tho!

FYI the tun0 device doesn't exist until AFTER you start the program.  It
disappears when you quit qemu.

Here is my qemu-ifup script (you have to run qemu twice, but it
eventually works)
-----------------------------------
#!/bin/bash
## Set your host os to the following
## IP - 192.168.1.1
## Mask - 255.255.255.0
## Gateway - 192.168.1.254
## DNS - whatver is in your resolv.conf

# Remember to have the following in sysctl.conf and do sysctl -p
# net.ipv4.ip_forward = 1

# Set these to the IP/mask you want to your qemu vm to have on the
network
qemu_ip="1.1.1.1"
qemu_netmask="255.255.255.0"

# Setup an interface for the vm to use
ifconfig eth0:1 up $qemu_ip netmask $qemu_netmask

# Clear iptables
iptables -t nat -F PREROUTING
iptables -t nat -F POSTROUTING

# Setup NAT
iptables -t nat -A PREROUTING -d $qemu_ip \
	-j DNAT --to-destination 192.168.1.1
	iptables -t nat -A POSTROUTING -s 192.168.1.1 \
		-j SNAT --to-source $qemu_ip
		# Bring up the TUN interface
		exec /sbin/ifconfig $1 192.168.1.254 running for 
the qemu virtual machine, has any one had any exprience with this? 
 
the instructions say to modprobe tun to get the tun module loaded and 
then to run the following command 
 
ifconfig tun0 192.168.0.3 netmask 255.255.255.0 
 
to get the interface configured. 
 
lsmod shows that there is a device module loaded and there is a device 
in the dev directory /dev/net/tun 
 
but I get the following error. 
 
SIOCSIFADDR: No such device 
tun0: unknown interface: No such device 
SIOCSIFNETMASK: No such device 
 
if any one can point me to the right Docs then Id appreciate it, Im sure

its something that Im not doing right 
 
thanks DarR!N 
 
 
 
 
 
 
 

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

* Re: [Qemu-devel] TUN network
  2004-07-28  3:11 Darrin Ritter
@ 2004-07-27 21:25 ` Joe Menola
  2004-07-27 22:07   ` Joe Menola
  0 siblings, 1 reply; 10+ messages in thread
From: Joe Menola @ 2004-07-27 21:25 UTC (permalink / raw)
  To: qemu-devel

I setup tun0 with 2 scripts in /etc.

/etc/q-ifup

#!/bin/sh
sudo /sbin/ifconfig $1 192.168.1.1
sudo /etc/qemu-iptables

/etc/qemu-iptables

#!/bin/sh
/etc/rc.d/init.d/iptables stop
echo "1" >&/proc/sys/net/ipv4/ip_forward
/etc/rc.d/init.d/iptables start

You cannot set ip_forward with iptables running, hence the stop/start thing.
You must also setup /etc/sudoers file, so that both scripts can run as root. 
This is a bit complex...see http://www.aplawrence.com/Basics/sudo.html for 
info on how to set this up.

-jm

On Tue July 27 2004 10:11 pm, Darrin Ritter wrote:
> hi
>
> Im currently trying to get a tun networking interface up and running for
> the qemu virtual machine, has any one had any exprience with this?
>
> the instructions say to modprobe tun to get the tun module loaded and
> then to run the following command
>
>  ifconfig tun0 192.168.0.3 netmask 255.255.255.0
>
> to get the interface configured.
>
> lsmod shows that there is a device module loaded and there is a device
> in the dev directory /dev/net/tun
>
> but I get the following error.
>
> SIOCSIFADDR: No such device
> tun0: unknown interface: No such device
> SIOCSIFNETMASK: No such device
>
> if any one can point me to the right Docs then Id appreciate it, Im sure
> its something that Im not doing right
>
> thanks DarR!N
>
>
>
>
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel

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

* Re: [Qemu-devel] TUN network
  2004-07-27 21:25 ` Joe Menola
@ 2004-07-27 22:07   ` Joe Menola
  2004-07-29  2:52     ` Darrin Ritter
  0 siblings, 1 reply; 10+ messages in thread
From: Joe Menola @ 2004-07-27 22:07 UTC (permalink / raw)
  To: qemu-devel

On Tue July 27 2004 4:25 pm, Joe Menola wrote:
> I setup tun0 with 2 scripts in /etc.
>
> /etc/q-ifup
>
> #!/bin/sh
> sudo /sbin/ifconfig $1 192.168.1.1
> sudo /etc/qemu-iptables
>
> /etc/qemu-iptables
>
> #!/bin/sh
> /etc/rc.d/init.d/iptables stop
> echo "1" >&/proc/sys/net/ipv4/ip_forward
> /etc/rc.d/init.d/iptables start
>
> You cannot set ip_forward with iptables running, hence the stop/start
> thing. You must also setup /etc/sudoers file, so that both scripts can run
> as root. This is a bit complex...see
> http://www.aplawrence.com/Basics/sudo.html for info on how to set this up.

I forgot to mention that 
 iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
must also be set. I have this rule permenant in iptables, which starts on 
boot.
Also the reason for 2 scripts is that with a single script ip_forward was 
sometimes getting set before ifconfig created $1, and tun0 would fail to get 
ip_forwarding. 
Many ways to do this, most probably better then mine, but it works for me. :)

-jm

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

* [Qemu-devel] TUN network
@ 2004-07-28  3:11 Darrin Ritter
  2004-07-27 21:25 ` Joe Menola
  0 siblings, 1 reply; 10+ messages in thread
From: Darrin Ritter @ 2004-07-28  3:11 UTC (permalink / raw)
  To: LinuxSA, qemu

hi

Im currently trying to get a tun networking interface up and running for 
the qemu virtual machine, has any one had any exprience with this?

the instructions say to modprobe tun to get the tun module loaded and 
then to run the following command

 ifconfig tun0 192.168.0.3 netmask 255.255.255.0

to get the interface configured.

lsmod shows that there is a device module loaded and there is a device 
in the dev directory /dev/net/tun

but I get the following error.

SIOCSIFADDR: No such device
tun0: unknown interface: No such device
SIOCSIFNETMASK: No such device

if any one can point me to the right Docs then Id appreciate it, Im sure 
its something that Im not doing right

thanks DarR!N

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

* Re: [Qemu-devel] TUN network
  2004-07-29  2:52     ` Darrin Ritter
@ 2004-07-28 11:36       ` vaise
  2004-07-29 15:10         ` Darrin Ritter
  0 siblings, 1 reply; 10+ messages in thread
From: vaise @ 2004-07-28 11:36 UTC (permalink / raw)
  To: qemu-devel

On Thursday 29 July 2004 04:52, Darrin Ritter wrote:
> currently i have the tun0 on the Host configures to 192.168.1.10 and the
> guest to 192.168.0.11 and the netmask on both to
>
> 255.255.255.0
>

>
> tun0      Link encap:Ethernet  HWaddr 00:FF:CC:26:27:8E
>           inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0

Humm...shouln'd your guest be 192.168.1.11 ??
also, try without any firewall on both size.
Dsant

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

* Re: [Qemu-devel] TUN network
  2004-07-29 15:10         ` Darrin Ritter
@ 2004-07-29  1:58           ` Joe Menola
  0 siblings, 0 replies; 10+ messages in thread
From: Joe Menola @ 2004-07-29  1:58 UTC (permalink / raw)
  To: qemu-devel

On Thu July 29 2004 10:10 am, Darrin Ritter wrote:
> HI
>
> I have tried all diferent types of configs arround the IP adresses with
> the host at 192.168.1.10 and the win98 guest at 198.168.1.10 or
> 198.168.1.11 set staticly I cant seem to ping the host at 192.168.1.254
> or the freesco router at 192.168.0.1
>
> any ideas?
>
Let's try things manually?

Check if  iptables is setup as in
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
(I used webmin to check firewall settings not sure how else to do it)

If host tun0 is 192.168.1.10, Win98 should be configured staticly to 
192.168.1.<anything but 10>
Set win98 gateway and dns server to 192.168.1.10.

Shutdown Windows, in terminal as root do

/etc/rc.d/init.d/iptables stop
echo "1" >&/proc/sys/net/ipv4/ip_forward
/etc/rc.d/init.d/iptables start

verify that the contents of /proc/sys/net/ipv4/ip_forward is "1"
if content is "0" then ip_forward is not being set, and tun will fail.

start qemu with -n <path to ifup script> (make sure -user-net is not included 
in start command)

If this works then the problem lies in your ifip script(s). If not, I'm lost.

-jm

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

* Re: [Qemu-devel] TUN network
  2004-07-27 22:07   ` Joe Menola
@ 2004-07-29  2:52     ` Darrin Ritter
  2004-07-28 11:36       ` vaise
  0 siblings, 1 reply; 10+ messages in thread
From: Darrin Ritter @ 2004-07-29  2:52 UTC (permalink / raw)
  To: qemu-devel

thanks I was able to get the tun0 interface configured
I looked at both scripts and the one written by Joe did the trick for me 
and now I have the tun0 interface,
however i am unable to ping from the VM to the Host and from the Host to 
the VM so there is no network connection
using the -user-net option I am able to access my swat configuration as 
well as the internet

currently i have the tun0 on the Host configures to 192.168.1.10 and the 
guest to 192.168.0.11 and the netmask on both to

255.255.255.0

just a note the win98 VM sees a realtek pci network card and not a 
NE2000 that I was expecting that the Docs talk about

any Ideas on the network will be appreciated

DarR!N



tun0      Link encap:Ethernet  HWaddr 00:FF:CC:26:27:8E
          inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::2ff:ccff:fe26:278e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)




Joe Menola wrote:

>On Tue July 27 2004 4:25 pm, Joe Menola wrote:
>  
>
>>I setup tun0 with 2 scripts in /etc.
>>
>>/etc/q-ifup
>>
>>#!/bin/sh
>>sudo /sbin/ifconfig $1 192.168.1.1
>>sudo /etc/qemu-iptables
>>
>>/etc/qemu-iptables
>>
>>#!/bin/sh
>>/etc/rc.d/init.d/iptables stop
>>echo "1" >&/proc/sys/net/ipv4/ip_forward
>>/etc/rc.d/init.d/iptables start
>>
>>You cannot set ip_forward with iptables running, hence the stop/start
>>thing. You must also setup /etc/sudoers file, so that both scripts can run
>>as root. This is a bit complex...see
>>http://www.aplawrence.com/Basics/sudo.html for info on how to set this up.
>>    
>>
>
>I forgot to mention that 
> iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
>must also be set. I have this rule permenant in iptables, which starts on 
>boot.
>Also the reason for 2 scripts is that with a single script ip_forward was 
>sometimes getting set before ifconfig created $1, and tun0 would fail to get 
>ip_forwarding. 
>Many ways to do this, most probably better then mine, but it works for me. :)
>
>-jm
>
>
>_______________________________________________
>Qemu-devel mailing list
>Qemu-devel@nongnu.org
>http://lists.nongnu.org/mailman/listinfo/qemu-devel
>
>  
>

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

* Re: [Qemu-devel] TUN network
  2004-07-28 11:36       ` vaise
@ 2004-07-29 15:10         ` Darrin Ritter
  2004-07-29  1:58           ` Joe Menola
  0 siblings, 1 reply; 10+ messages in thread
From: Darrin Ritter @ 2004-07-29 15:10 UTC (permalink / raw)
  To: qemu-devel

HI

I have tried all diferent types of configs arround the IP adresses with 
the host at 192.168.1.10 and the win98 guest at 198.168.1.10 or 
198.168.1.11 set staticly I cant seem to ping the host at 192.168.1.254 
or the freesco router at 192.168.0.1

any ideas?


vaise@votreservice.com wrote:

>On Thursday 29 July 2004 04:52, Darrin Ritter wrote:
>  
>
>>currently i have the tun0 on the Host configures to 192.168.1.10 and the
>>guest to 192.168.0.11 and the netmask on both to
>>
>>255.255.255.0
>>
>>    
>>
>
>  
>
>>tun0      Link encap:Ethernet  HWaddr 00:FF:CC:26:27:8E
>>          inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0
>>    
>>
>
>Humm...shouln'd your guest be 192.168.1.11 ??
>also, try without any firewall on both size.
>Dsant
>
>
>_______________________________________________
>Qemu-devel mailing list
>Qemu-devel@nongnu.org
>http://lists.nongnu.org/mailman/listinfo/qemu-devel
>
>  
>

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

end of thread, other threads:[~2004-07-29  2:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-27 16:40 [Qemu-devel] TUN network Thomas Munn
  -- strict thread matches above, loose matches on Subject: below --
2004-07-28  3:11 Darrin Ritter
2004-07-27 21:25 ` Joe Menola
2004-07-27 22:07   ` Joe Menola
2004-07-29  2:52     ` Darrin Ritter
2004-07-28 11:36       ` vaise
2004-07-29 15:10         ` Darrin Ritter
2004-07-29  1:58           ` Joe Menola
2004-05-14 20:10 [Qemu-devel] tun network vaise
     [not found] ` <20040515173848.GA22840@yuri.org.uk>
2004-05-17 19:37   ` vaise

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).