[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] TUN network
From: |
Joe Menola |
Subject: |
Re: [Qemu-devel] TUN network |
Date: |
Tue, 27 Jul 2004 17:07:28 -0500 |
User-agent: |
KMail/1.6.2 |
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