[OpenVPN home] [Date Prev] [Date Index] [Date Next]
[OpenVPN mailing lists] [Thread Prev] [Thread Index] [Thread Next]
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 ***
modprobe tun
modprobe bridge
for i in `seq 0 ${maxtap}`; do
	openvpn --mktun --dev tap${i}
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}
for i in `seq 0 ${maxtap}`; do
	ifconfig tap${i} promisc up
sleep 1
ifconfig eth0 promisc up
sleep 1
ifconfig vpnbr0 netmask broadcast
# route add default gw
*** start-bridge ***

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

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

set -e

case "$1" in
	echo -n "Starting $NAME:"
	echo "."
	echo -n "Stopping $NAME "
	echo "."
	brctl show
	echo "Usage: $N {start|stop|status}" >&2
	exit 1

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

Openvpn-users mailing list