[ARMedslack] qemu-network-tun.sh modified script
Davide
louigi600 at yahoo.it
Fri Apr 29 08:06:44 UTC 2011
If anyone else finds this handy this works with dhcp client on both host and guest and also gets rid of all rc.local requirements.
On the guest os you will need to config interface once system is up (static or via dhcp)
Needs fixing for static ip reconfiguration/rerouting on host system after bridge creation.
I apologize for my non standard indentation ...
#!/bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1024 > /proc/sys/dev/rtc/max-user-freq
if [ $(ifconfig |grep "Link encap" |grep -c "^br0") -lt 1 ]
then
if [ $(ps -eo pid,cmd |grep -v grep |grep -c dhcpcd) -ge 1 ]
then
RESTART_NET="dhcpcd -t 10 br0"
killall dhcpcd
else
RESTART_NET="to be fixed for static networking ifconfig and route"
ifconfig eth0 0.0.0.0 down
fi
brctl addbr br0
brctl stp br0 off
brctl setfd br0 1
brctl addif br0 eth0
$RESTART_NET
fi
/sbin/ifconfig $1 0.0.0.0 promisc up
/sbin/brctl addif br0 $1
sleep 1
brctl show
More information about the ARMedslack
mailing list