From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BpV3Y-0000uD-9V for qemu-devel@nongnu.org; Tue, 27 Jul 2004 12:44:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BpV3W-0000sm-Jw for qemu-devel@nongnu.org; Tue, 27 Jul 2004 12:43:59 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BpV3W-0000sh-Fz for qemu-devel@nongnu.org; Tue, 27 Jul 2004 12:43:58 -0400 Received: from [159.178.60.122] (helo=trend1.shands.ufl.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BpV06-0002Vu-KA for qemu-devel@nongnu.org; Tue, 27 Jul 2004 12:40:26 -0400 Message-Id: Date: Tue, 27 Jul 2004 12:40:04 -0400 From: "Thomas Munn" Subject: Re: [Qemu-devel] TUN network Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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