This is automatically generated documentation. Edit after the "COMMENTS" heading; changes to the main body will be lost.

FromHost.u Element Documentation


FromHost.u -- Click element; interface to /dev/net/tun or ethertap (user-level)


FromHost(DEVNAME [, DST] [, keywords GATEWAY, HEADROOM, ...])

Ports: no inputs, 1 output
Processing: push
Drivers: userlevel
Package: userlevel (core)


Note: The KernelTun and KernelTap elements are preferable for most purposes. Reads packets from and writes packets through the universal TUN/TAP module in Linux (the /dev/net/tun device). This allows a user-level Click to hand packets to the virtual ethernet device. FromHost will also transfer packets from the virtual ethernet device. To use this element your kernel config must support CONFIG_TUN and CONFIG_ETHERTAP. Either modules (tun.o) or compiled in should work. FromHost allocates a /dev/net/tun device (this might fail) and runs ifconfig to set the interface's local (i.e., kernel) address and netmask to DST, which must be an IP prefix such as If DST is not specified, then FromHost assumes the tunnel has already been configured to the correct address. If a nonzero GATEWAY IP address (which must be on the same network as the tun) is specified, then FromHost tries to set up a default route through that host. HEADROOM is the number of bytes left empty before the packet data (to leave room for additional encapsulation headers). Default HEADROOM is roughly 28. Keyword arguments are:

Ethernet address. Specifies the fake device's Ethernet address. Default is not specified, in which case the fake device's address is whatever the kernel chooses.
IPv6 prefix. If specified, FromHost runs ifconfig to set the interface's local (i.e., kernel) IPv6 address and netmask. Both DST and DST6 may be specified.


Linux will send ARP queries to the fake device. You must respond to these queries in order to receive any IP packets, but you can obviously respond with any Ethernet address you'd like. Here is one common idiom:

 -> fromhost_cl :: Classifier(12/0806, 12/0800);
 fromhost_cl[0] -> ARPResponder( 1:1:1:1:1:1) -> ToHost(fake);
 fromhost_cl[1] -> ... // IP packets


 FromHost(fake, -> ...;

An error like "open /dev/net/tun: No such file or directory" usually means that you have not enabled tunnel support in your kernel.


dev_name (read-only)
Returns the name of the device that this element is using.


ToHost.u, ifconfig

Generated by 'click-elem2man' from '../elements/userlevel/fromhost.hh:14' on 12/Jul/2011.


elements/fromhost.u.txt · Last modified: 2011/07/12 11:29 (external edit)
Recent changes RSS feed Driven by DokuWiki