How can I create and use a Tap device

Julian Elischer julian at elischer.org
Thu Nov 18 18:49:44 GMT 2004



Robert Watson wrote:

>On Thu, 18 Nov 2004, Elton Machado wrote:
>
>  
>
>>I need a virtual ethernet device, can I use tap for that? 
>>
>>How can I create it? 
>>    
>>
>[...]
>
>A couple of performance caveats:
>
>- Every packet delivery requires going to user space, so possibly a
>  context switch and certainly a system call.
>- Every packet is copied to user space, and/or from user space, so you get
>  a lot of memory copying.
>

You can also use netgraph's eiface node.
thid delivers teh packet to a netgraph interface which can be then used 
for further processing in the kernel..
(e.g. a ksocket node to encapsulate it in UDP)..  No extra context 
switches..


>
>For prototyping or light-weight stuff, tap is a great tool, but to improve
>performance you want to run network code in the kernel, especially if
>there are other applications running (and/or processing packets), which
>will increase the number of context switches.  The cost as it stands isn't
>bad -- I regularly use tap-derived tunnel software for remote network
>access without a hitch.  There were recently some posts made with patches
>to optimize the allocation of kernel memory for packets sent using a tap
>device, which are in the mailing list archives (not sure if they were
>merged yet).
>
>Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
>robert at fledge.watson.org      Principal Research Scientist, McAfee Research
>
>
>_______________________________________________
>freebsd-net at freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-net
>To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
>  
>



More information about the freebsd-net mailing list