why tun/tap but instead ordinary ethernet device (eg. fxp)

From: Bsderss (snort_sam_at_yahoo.com)
Date: 07/30/05

  • Next message: Greg Rivers: "Panic with recent 6.0-BETA1"
    Date: Fri, 29 Jul 2005 20:20:19 -0700 (PDT)
    To: Maksim Yevmenkin <maksim.yevmenkin@savvis.net>
    
    

    --- Maksim Yevmenkin <maksim.yevmenkin@savvis.net>
    wrote:

    > Hello,
    >
    > >>>As I want to learn how to use /dev/tap in
    > freebsd,
    > >>
    > >>I m
    > >>
    > >>>looking for a simple application that written for
    > >>>/dev/tap. OpenVPN is a bit too complicated for a
    > >>>newbie to get start. Can anyone tell me a link or
    > >>>reference for some of these examples?
    > >>
    > >>There are examples that come with the distribution
    > >>itself:
    > >>
    > >>http://vtun.sourceforge.net/tun/tun-1.1.tar.gz
    > >>
    > >
    > > Is this only for tun device?
    > > How much difference between tun and tap in terms
    > of
    > > programming when using the device?
    > >
    > >
    > >>(and this question would be better suited for
    > >>freebsd-questions,
    > >>if for any FreBSD=specific list at all)
    > >>
    > >
    > > Sorry, I currently don't have access to the
    > > frebsd.misc newsgroup, so I need to post the
    > question
    > > here.
    >
    > this type of question comes up quite often. its
    > really simple: a single
    > read(2) call on /dev/tapX will return entire
    > ethernet frame (if any)
    > received by tap interface (minus ethernet crc). a
    > single write(2) call
    > on /dev/tapX will put entire ethernet frame (w/out
    > ethernet crc) onto
    > tap interface outgoing queue.
    >
    > so, the "buf" parameter to the write(2) call on
    > /dev/tapX device should
    > point to a buffer with *complete* ethernet frame,
    > including ethernet
    > header and payload. payload could be IP packet, but
    > it does not have to
    > be. any protocol that uses ethernet as transport can
    > be tunneled with
    > tap(4) (i.e. ipx).
    >
    > the above is true for tun(4) with exception that
    > tun(4) operates on IP
    > packets. so you have to write/read complete IP
    > packets to/from /dev/tun.
    >
    Thanks for the detail explaination. As "man tap"
    pointed out, one can use tap drive as if using a pty
    device. I m not aware the obvious advantage of using
    tap over ordinarlly ethernet device for tunnelling
    programming (another example is ipsec). It may be
    because programming on tun/tap is alot of efficient
    and simpler. Can anyone pleaese explain?

    With vtun or openvpn, why they don't just simply use
    ordinary ethernet device driver but prefer tun or tap
    for tunneling or bridging network remote connection?
    Is it because applicaiton use tap or tun can send
    interrupt (with ioctl) to the remote client more
    efficiently? if so, can anyone please tell me what
    kind of efficiency does tun/tap over an ordianry
    ethernet device in terms of network programming?

    Thanks
    Sam

    > thanks,
    > max
    >

                    
    ____________________________________________________
    Start your day with Yahoo! - make it your home page
    http://www.yahoo.com/r/hs
     
    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


  • Next message: Greg Rivers: "Panic with recent 6.0-BETA1"

    Relevant Pages

    • why tun/tap but instead ordinary ethernet device (eg. fxp)
      ... >> How much difference between tun and tap in terms ... > received by tap interface (minus ethernet crc). ... programming. ...
      (freebsd-stable)
    • RE: Ethernet tap vs. spanned port
      ... be replicated to the destination SPAN port. ... Ethernet tap vs. spanned port ... attacks with snort but not with etrust it could be that snort does not ...
      (Focus-IDS)
    • Re: Ethernet TAPs
      ... > Any recommendations on specific Ethernet TAP's for sniffing switches? ... TAP: is there a fail-safe mechanism (if the TAP loses power will it ... In the case that a full duplex output is presented ...
      (Pen-Test)
    • Running into an mbuf leak with bridging and tap
      ... I'm running an ethernet over TCP bridge using a combination of the native ... The bridge support is loaded as a kld, as is the tap support, ...
      (freebsd-net)
    • Re: simh with logical networking
      ... >> On close inspection of the simh ethernet readme it does mention this ... >> TAP connection method. ... TAP is a virtual ethernet device. ...
      (comp.os.vms)