qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Thomas Munn" <munntj@shands.ufl.edu>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] TUN network
Date: Tue, 27 Jul 2004 12:40:04 -0400	[thread overview]
Message-ID: <s1064d38.049@GW-FS1.SHANDS.UFL.EDU> (raw)

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 
 
 
 
 
 
 
 

             reply	other threads:[~2004-07-27 16:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-27 16:40 Thomas Munn [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-07-28  3:11 [Qemu-devel] TUN network 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s1064d38.049@GW-FS1.SHANDS.UFL.EDU \
    --to=munntj@shands.ufl.edu \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).