Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Mar 2007 09:24:38 -0700
From:      George Hartzell <hartzell@alerce.com>
To:        Willy@Offermans.Rompen.nl
Cc:        Vince <jhary@unsane.co.uk>, freebsd-stable@FreeBSD.ORG, openvpn-users@lists.sourceforge.net
Subject:   Re: tap device at boot time
Message-ID:  <17913.29510.964120.616304@satchel.alerce.com>
In-Reply-To: <20070315133346.GA5645@wiz>
References:  <20070314104732.GA5794@wiz> <45F7D727.2080301@unsane.co.uk> <20070315133346.GA5645@wiz>

next in thread | previous in thread | raw e-mail | index | archive | help
Willy Offermans writes:
 > On Wed, Mar 14, 2007 at 11:06:15AM +0000, Vince wrote:
 > > Willy Offermans wrote:
 > > > Dear FreeBSD friends,
 > > > 
 > > > Is it possible to add and configure a tap device at boot time of
 > > > FreeBSD? I mean the same as a normal NIC. In my rc.conf:
 > > > 
 > > > <snip>
 > > > ...
 > > > ifconfig_xl0="inet 192.168.0.2 promisc netmask 255.255.255.0"
 > > > ifconfig_rl0="inet 192.168.4.2 netmask 255.255.255.0"
 > > > ifconfig_tap0="inet 10.8.0.1 netmask 255.255.255.0"
 > > > ...
 > > > </snip>
 > > > 
 > > try adding
 > > cloned_interfaces="tap0"
 > > 
 > > to your rc.conf
 > > 
 > > Vince
 > > > and in my /boot/loader.conf:
 > > > <snip>
 > > > ...
 > > > if_tap_load="YES"
 > > > ...
 > > > </snip>
 > > > 
 > > > if_xl0 and if_rl0 are compiled into the kernel.
 > > > 
 > > > Maybe it is even possible to set the MAC address of the tap device!?
 > > > 
 > > > The tap device should be available before named and dhcpd have been
 > > > started. In that way I can provide IP addresses over the tap device 
 > > > and add appropriate DNS entries.
 > > > 
 > > > I like to run openvpn with tap devices and want to use the dhcpd server
 > > > to provide IP addresses and update the named. This works quite well.
 > > > However after reboot I always have to restart named and dhcpd again
 > > > since the tap device becomes available after these services have started
 > > > during boot. I guess this problem will be solved if the tap device is
 > > > already available and configured before named and dhcpd have started.
 > > > 
 > > 
 > 
 > Hello Vince,
 > 
 > Thank you for your response, but unfortunately adding
 > cloned_interfaces="tap0" to my rc.conf did not solve the issue. The
 > tap0 device only appeared after I started the openvpn daemon. Is there
 > a way to determine the order to start the daemons. Maybe I can solve
 > the problem in that way.
 > 
 > I wonder why it is so hard to accomplish this. FreeBSD is usually very
 > intuitive in initialising device support. Naively I would think: load
 > the kernel_module and run ifconfig and you are there. For xl0 and rl0
 > it will work like this, I guess, but for tap0 certainly not. What kind
 > of a kick does this tap device need? Is it that special? Openvpn needs
 > to know which tap to use, but that is it, I guess. The rest is up to
 > the kernel to do the trick, isn't it? Maybe I have to dig in the source
 > code of openvpn to find out how to initialise the tap device.
 > [...]

Are you sure that you need to initialize the tap0 device like this?

I use tun's instead of tap's, but in my openvpn server config I have a
line that says

  dev tun

and a bit further down I have a line that says

  server 10.8.0.0 255.255.255.0

and openvpn takes care of setting up the device itself.  Everything
I've read suggests that it should work the same way for a tap device.

g.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?17913.29510.964120.616304>