[OpenVPN home] [Date Prev] [Date Index] [Date Next]
[OpenVPN mailing lists] [Thread Prev] [Thread Index] [Thread Next]
Google
 
Web openvpn.net

RE: [Openvpn-users] Question: Multiple clients on one server; Set ting up tap0 on boot (Debian)


  • Subject: RE: [Openvpn-users] Question: Multiple clients on one server; Set ting up tap0 on boot (Debian)
  • From: Daniel Berger <db@xxxxxxxx>
  • Date: Tue, 19 Oct 2004 14:17:29 +0200

> Another 'Debian' question not related to the upper one:
> Is it posible to set up 'tap0' device during Debian boot?
> As I know it is needed to send a special IOCTL call to the 
> /dev/net/tun
> character device. This register the tap0 with the kernel.
> 
> I would like to set tap0 in promisc mode and add it to br0 
> bridge that is
> set up on boot from /etc/network/interfaces . I would like to 
> avoid adding
> my own program for tap0 registration. Is there anything 
> similar already
> implemented in Debian that can be configured e.g. in interfaces file?

I use my own skripts to configure a bridge and add the tap's.
This is based on a script of Florin Andrei.
My solution has the backdraw that if you change the ip of your server,
you need to do this not only in /etc/network/interfaces but in
/etc/bridge/start-bridge + stop-bridge too.
Maybe there would be a solution to read out the interfaces file and parse
it, to get the correct ip+netmask.
Someone already done that? Maybe with perl?

At last, I added the /etc/init.d/bridge and /etc/init.d/openvpn to the
runlevels with update-rc

*** start-bridge ***
maxtap=0
modprobe tun
modprobe bridge
for i in `seq 0 ${maxtap}`; do
	openvpn --mktun --dev tap${i}
done
ifconfig eth0 down
sleep 1
brctl addbr vpnbr0
brctl addif vpnbr0 eth0
sleep 1
for i in `seq 0 ${maxtap}`; do
	brctl addif vpnbr0 tap${i}
done
for i in `seq 0 ${maxtap}`; do
	ifconfig tap${i} 0.0.0.0 promisc up
done
sleep 1
ifconfig eth0 0.0.0.0 promisc up
sleep 1
ifconfig vpnbr0 192.168.17.7 netmask 255.255.255.0 broadcast 192.168.17.255
# route add default gw 192.168.17.1
*** start-bridge ***

*** stop-bridge ***
maxtap=0
ifconfig vpnbr0 down
brctl delif vpnbr0 eth0
for i in `seq 0 ${maxtap}`; do
	brctl delif vpnbr0 tap${i}
done
brctl delbr vpnbr0
sleep 1
ifconfig eth0 192.168.17.7 netmask 255.255.255.0 broadcast 192.168.17.255
*** stop-bridge ***

*** /etc/init.d/bridge ***
#! /bin/sh
#
# start/stop bridge

NAME=bridge
set -e

case "$1" in
  start)
	echo -n "Starting $NAME:"
	/etc/bridge/start-bridge
	echo "."
	;;
  stop)
	echo -n "Stopping $NAME "
	/etc/bridge/stop-bridge
	echo "."
	;;
  status)
	brctl show
	;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|status}" >&2
	exit 1
	;;
esac

exit 0
*** /etc/init.d/bridge ***

____________________________________________
Openvpn-users mailing list
Openvpn-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/openvpn-users