=head1 NAME vped.conf - vpe daemon configuration file =head1 SYNOPSIS udp-port = 407 mtu = 1492 ifname = vpn0 node = branch1 hostname = 1.2.3.4 node = branch2 hostname = www.example.net udp-port = 500 # this host uses a different udp-port node = branch3 connect = ondemand =head1 DESCRIPTION The vpe config file consists of a series of lines that contain C pairs. Empty lines are ignored. Comments start with a C<#> and extend to the end of the line. They can be used on their own lines, or after any directives. Spaces are allowed before or after the C<=> sign or after values, but not within the variable names or values themselves. The only exception to the above is the "on" directive that can prefix any C setting and will only "execute" it on the named node, or (if the nodename starts with "!") on all nodes except the named one. name = value on branch1 loglevel = noise on !branch2 connect = ondemand All settings are executed "in order", that is, later settings of the same variable overwrite earlier ones. =head1 ANATOMY OF A CONFIG FILE Usually, a config file starts with global settings (like the udp port to listen on), followed by node-specific sections that begin with a C line. Every node that is part of the network must have a section that starts with C. The number and order of the nodes is important and must be the same on all hosts. It is not uncommon for node sections to be completely empty - if the default values are right. Node-specific settings can be used at any time. If used before the first node section they will set the default values for all following nodes. =head1 CONFIG VARIABLES =head2 GLOBAL SETTINGS Global settings will affect the behaviour of the running vped daemon, that is, they are in some sense node-specific (config files can set different values on different nodes using C), but will affect the behaviour of the vped daemon and all connections it creates. =over 4 =item loglevel = noise|trace|debug|info|notice|warn|error|critical Set the logging level. Connection established messages are logged at level C, notable errors are logged with C. Default is C. =item node = nickname Not really a config setting but introduces a node section. The nickname is used to select the right configuration section and must be passed as an argument to the vped daemon. =item private-key = relative-path-to-key Sets the path (relative to the config directory) to the private key (default: C). This is a printf format string so every C<%> must be doubled. A single C<%s> is replaced by the hostname, so you could use paths like C to fetch the files at the location where C puts them. Since only the private key file of the current node is used and the private key file should be kept secret per-host to avoid spoofings, it is not recommended to use this feature. =item ifpersist = yes|true|on | no|false|off Should the tun/tap device be made persistent, that is, should the device stay up even when vped exits? Some versions of the tunnel device have problems sending packets when vped is restarted in persistent mode, so if the connections can be established but you cannot send packets from the local node, try to set this to C and do an ifconfig down on the device. =item ifname = devname Sets the tun interface name to the given name. The default is OS-specific and most probably something like C. =item rekey = seconds Sets the rekeying interval in seconds (default: C<3600>). Connections are reestablished every C seconds. =item keepalive = seconds Sets the keepalive probe interval in seconds (default: C<60>). After this many seconds of inactivity the daemon will start to send keepalive probe every 5 seconds until it receives a reply from the other end. If no reply is received within 30 seconds, the peer is considered unreachable and the connection is closed. =item mtu = bytes Sets the maximum MTU that should be used on outgoing packets (basically the MTU of the outgoing interface) The daemon will automatically calculate maximum overhead (e.g. udp header size, encryption blocksize...) and pass this information to the C script. Recommended values are 1500 (ethernet), 1492 (pppoe), 1472 (pptp). This value must be the minimum of the mtu values of all hosts. =item ip-proto = numerical-ip-protocol Sets the protocol number to be used for the rawip protocol. This is a global option because all hosts must use the same protocol, and since there are no port numbers, you cannot easily run more than one vped instance using the same protocol, nor can you share the protocol with other programs. The default is 47 (GRE), which has a good chance of tunneling through firewalls (but note that the rawip protocol is not GRE compatible). Other common choices are 50 (IPSEC, ESP), 51 (IPSEC, AH), 4 (IPIP tunnels) or 98 (ENCAP, rfc1241) =item if-up = relative-or-absolute-path Sets the path of a script that should be called immediately after the network interface is initialized (but not neccessarily up). The following environment variables are passed to it (the values are just examples): =over 4 =item CONFBASE=/etc/vpe The configuration base directory. =item IFNAME=vpn0 The interface to initialize. =item MTU=1436 The MTU to set the interface to. You can use lower values (if done consistently on all hosts), but this is usually ineffective. =item MAC=fe:fd:80:00:00:01 The MAC address to set the interface to. The script *must* set the interface MAC to this value. You will most likely use one of these: ip link set $IFNAME address $MAC mtu $MTU up # GNU/Linux ifconfig $IFNAME ether $MAC mtu $MTU up # FreeBSD =item IFTYPE=native =item IFSUBTYPE=linux # or freebsd, darwin etc.. The interface type (C or C) and the subtype (usually the os name in lowercase) that this vpe was configured for. Can be used to select the correct syntax to use for network-related commands. =item NODENAME=branch1 The nickname of the current node, as passed to the vped daemon. =item NODEID=1 The numerical node id of the current node. The first node mentioned in the config file gets ID 1, the second ID 2 and so on. =back Here is a simple if-up script: #!/bin/sh ip link set $IFNAME address $MAC mtu $MTU up [ $NODENAME = branch1 ] && ip addr add 10.0.0.1 dev $IFNAME [ $NODENAME = branch2 ] && ip addr add 10.1.0.1 dev $IFNAME ip route add 10.0.0.0/8 dev $IFNAME More complicated examples (using routing to reduce arp traffic) can be found in the etc/ subdirectory of the distribution. =item node-up = relative-or-absolute-path Sets a command (default: no script) that should be called whenever a connection is established (even on rekeying operations). In addition to the variables passed to C scripts, the following environment variables will be set: =over 4 =item DESTNODE=branch2 The name of the remote node. =item DESTID=2 The node id of the remote node. =item DESTIP=188.13.66.8 The numerical IP address of the remote host (vped accepts connections from everywhere, as long as the other host can authenticate itself). =item DESTPORT=407 # deprecated The UDP port used by the other side. =item STATE=UP Node-up scripts get called with STATE=UP, node-down scripts get called with STATE=DOWN. =back Here is a nontrivial example that uses nsupdate to update the name => ip mapping in some dns zone: #!/bin/sh { echo update delete $DESTNODE.lowttl.example.net. a echo update add $DESTNODE.lowttl.example.net. 1 in a $DESTIP echo } | nsupdate -d -k $CONFBASE:key.example.net. =item node-down = relative-or-absolute-path Same as C, but gets called whenever a connection is lost. =item http-proxy-host = hostname/ip The C family of options are only available if vpe was compiled with the C<--enable-http-proxy> option and enable tunneling of tcp connections through a http proxy server. C and C should specify the hostname and port number of the proxy server. See C if your proxy requires authentication. Please note that vpe will still try to resolve all hostnames in the configuration file, so if you are behind a proxy without access to a dns server better use numerical IP addresses. To make best use of this option disable all protocols except tcp in your config file and make sure your routers (or all other hosts) are listening on a port that the proxy allows (443, https, is a common choice). If you have a router, connecting to it will suffice. Otherwise tcp must be enabled on all hosts. Example: http-proxy-host = proxy.example.com http-proxy-port = 3128 # 8080 is another common choice http-proxy-auth = schmorp:grumbeere =item http-proxy-port = proxy-tcp-port The port where your proxy server listens. =item http-proxy-auth = login:password The optional login and password used to authenticate to the proxy server, seperated by a literal colon (C<:>). Only basic authentication is currently supported. =back =head2 NODE SPECIFIC SETTINGS The following settings are node-specific, that is, every node can have different settings, even within the same vped instance. Settings that are executed before the first node section set the defaults, settings that are executed within a node section only apply to the given node. =over 4 =item udp-port = port-number Sets the port number used by the UDP protocol (default: C<407>, not officially assigned by IANA!). =item tcp-port = port-number Similar to C (default: C<407>), but sets the TCP port number. =item enable-rawip = yes|true|on | no|false|off Enable the RAW IPv4 transport using the C protocol (default: C). This is the best choice, since the overhead per packet is only 38 bytes, as opposed to UDP's 58 (or TCP's 60+). =item enable-udp = yes|true|on | no|false|off Enable the UDPv4 transport using the C port (default: C). This is a good general choice since UDP tunnels well through many firewalls. =item enable-tcp = yes|true|on | no|false|off Enable the TCPv4 transport using the C port (default: C). Support for this horribly unsuitable protocol is only available when vpe was compiled using the C<--enable-tcp> option. Never use this transport unless you really must, it is horribly ineffiecent and resource-intensive compared to the other transports. =item router-priority = positive-number Sets the router priority of the given host (default: C<0>, disabled). If some host tries to connect to another host without a hostname, it asks the router host for it's IP address. The router host is the one with the highest priority that is currently reachable. Make sure all clients always connect to the router hosts, otherwise conencting to them is impossible. =item connect = ondemand|never|always|disabled Sets the connect mode (default: C). It can be C (always try to establish and keep a conenction to the given host), C (nevr initiate a connection to the given host, but accept connections), C (try to establish a connection on the first packet sent, and take it down after the keepalive interval) or C (node is bad, don't talk to it). =item inherit-tos = yes|true|on | no|false|off Wether to inherit the TOS settings of packets sent to the tunnel when sending packets to this node (default: C). If set to C then outgoing tunnel packets will have the same TOS setting as the packets sent to the tunnel device, which is usually what you want. =item compress = yes|true|on | no|false|off Wether to compress data packets sent to this host (default: C). Compression is really cheap even on slow computers and has no size overhead at all, so enabling this is a good idea. =back =head1 CONFIG DIRECTORY LAYOUT The default (or recommended) directory layout for the config directory is: =over 4 =item vped.conf The config file. =item if-up The if-up script =item node-up, node-down If used the node up or node-down scripts. =item hostkey The private key (taken from C) of the current host. =item pubkey/nodename The public keys of the other nodes, one file per node. =back =head1 SEE ALSO vpe(5), vped(8), vpectrl(8). =head1 AUTHOR Marc Lehmann