GVPE.CONF(5)
π GVPE.CONF(5) π β the config file for the GNU VPE daemon
okay bestie, gather round π«Ά this is gvpe.conf, section 5 of the manual, the config file for GNU Virtual Private Ethernet. it's giving "long but worth it", so let's go.
πΈ NAME πΈ
gvpe.conf β configuration file for the GNU VPE daemon β¨
π SYNOPSIS π
# global options for all nodes
udp-port = 407
mtu = 1492
ifname = vpn0
# first node is named branch1 and is at 1.2.3.4
node = branch1
hostname = 1.2.3.4
# second node uses dns to resolve the address
node = branch2
hostname = www.example.net
udp-port = 500 # this host uses a different udp-port
# third node has no fixed ip address
node = branch3
connect = ondemand
π¦ DESCRIPTION π¦
okay so the gvpe config file is literally just a bunch of lines with variable = value pairs. that's it. that's the whole vibe π
Empty lines? ignored, they're not the main character. Comments start with a # and run all the way to the end of the line β you can put them on their own line, or tack them onto the end of any directive. Whitespace is allowed around the = sign, and after values, but not inside the variable names or the values themselves. periodt.
All settings get applied "in order", which means later settings of the same variable overwrite the earlier ones. last one wins, no cap.
The only exceptions to all of that are these special directives π
π node nodename
Introduces a node section. The nodename is what selects the right config section, and it's the exact same string that gets passed as an argument to the gvpe daemon.
Multiple node statements with the same node name are supported, and they'll be merged together. so you can split a node's config up if that's your thing π«Ά
π global
This statement switches back to the global section, which is mainly useful if you want to include a second config file, e..g for local customisations. To do that, simply include this at the very end of your config file:
global
include local.conf
π on nodename ... / on !nodename ...
You can prefix any configuration directive with on and a nodename. GVPE will only "execute" it on the named node, or β if the nodename starts with ! β on all nodes except the named one. iconic honestly.
Example: set the MTU to 1450 everywhere, loglevel to noise on branch1, and connect to ondemand everywhere but on branch2.
mtu = 1450
on branch1 loglevel = noise
on !branch2 connect = ondemand
π include relative-or-absolute-path
Reads the specified file β and the path must not contain whitespace or = characters, ok β and evaluates all config directives in it as if they were spelled out in place of the include directive. like copy-paste but fancy.
The path is a printf format string, which means you must escape any % by doubling it, and you can have a single %s inside, which will be replaced by the current nodename. so cute.
Relative paths are interpreted relative to the GVPE config directory.
Example: include the file local.conf in the config directory on every node.
include local.conf
Example: include a file conf/nodename.conf
include conf/%s.conf
π§ ANATOMY OF A CONFIG FILE π§
Usually, a config file starts with a few global settings (like the UDP port to listen on), and then comes the node-specific sections that begin with a node = nickname line.
Every node that is part of the network must have a section that starts with node = nickname. The number and order of the nodes is important and must be the same on all nodes. no pressure but also maximum pressure π
It is not uncommon for node sections to be completely empty β if the default values are right. slay.
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. foreshadowing β¨
π CONFIG VARIABLES π
π GLOBAL SETTINGS
Global settings affect the behaviour of the running gvpe daemon β that is, they're in some sense node-specific (config files can set different values on different nodes using on), but they affect the behaviour of the gvpe daemon and all connections it creates.
chroot = path or /β Tells GVPE tochroot(2)to the specified path after reading all necessary files, binding to sockets and running the if-up script, but before running node-up or any other scripts.
The special path / instructs GVPE to create (and remove) an empty temporary directory to use as the new root. This is the most secure option, but it makes it impossible to use any scripts other than the if-up one. π security vs convenience, the eternal battle.
chuid = numerical-uidchgid = numerical-gidβ These two options tell GVPE to change to the given user and/or group id after reading all necessary files, binding to sockets and running the if-up script.
Other scripts, such as node-up, are run with the new user id or group id.
chuser = usernameβ Alternative tochuidandchgid: sets bothchuidandchgidto the user and (primary) group ids of the specified user (for example,nobody). two-for-one deal πdns-forw-host = hostname/ipβ The DNS server to forward DNS requests to for the DNS tunnel protocol (default:127.0.0.1, changing it is highly recommended). like, highly. bestie please change it πdns-forw-port = port-numberβ The port where thedns-forw-hostis to be contacted (default:53, which is fine in most cases).dns-case-preserving = yes|true|on | no|false|offβ Sets whether the DNS transport forwarding server preserves case (DNS servers have to, but some access systems are even more broken than others) (default:true).
Normally, when the forwarding server changes the case of domain names, then GVPE will automatically set this to false. the code is doing detective work for you, love that.
dns-max-outstanding = integer-number-of-requestsβ The maximum number of outstanding DNS transport requests (default:100). GVPE will never issue more requests than the given limit without receiving replies. In heavily overloaded situations it might help to set this to a low number (e.g.3or even1) to limit the number of parallel requests.
The default should be working OK for most links.
dns-overlap-factor = floatβ The DNS transport uses the minimum request latency (min_latency) seen during a connection as its timing base. This factor (default:0.5, must be> 0) is multiplied bymin_latencyto get the maximum sending rate (= minimum send interval), i.e. a factor of1means that a new request might be generated everymin_latencyseconds, which means on average there should only ever be one outstanding request. A factor of0.5means that GVPE will send requests twice as often as the minimum latency measured.
For congested or picky DNS forwarders you could use a value nearer to or exceeding 1.
The default should be working OK for most links.
dns-send-interval = send-interval-in-secondsβ The minimum send interval (= maximum rate) that the DNS transport will use to send new DNS requests. GVPE will not exceed this rate even when the latency is very low. The default is0.01, which means GVPE will not send more than 100 DNS requests per connection per second. For high-bandwidth links you could go lower, e.g. to0.001or so. For congested or rate-limited links, you might want to go higher, say0.1,0.2or even higher.
The default should be working OK for most links.
dns-timeout-factor = floatβ Factor to multiply themin_latency(seedns-overlap-factor) by to get request timeouts. The default of8means that the DNS transport will resend the request when no reply has been received for longer than eight times the minimum (= expected) latency, assuming the request or reply has been lost.
For congested links a higher value might be necessary (e.g. 30). If the link is very stable, lower values (e.g. 2) might work nicely. Values near or below 1 make no sense whatsoever. fr fr, don't.
The default should be working OK for most links but will result in low throughput if packet loss is high.
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 necessarily up). The following environment variables are passed to it (the values are just examples).
Variables that have the same value on all nodes:
CONFBASE=/etc/gvpeβ The configuration base directory.IFNAME=vpn0β The network interface to initialize.IFTYPE=native # or tincdIFSUBTYPE=linux # or freebsd, darwin etc..β The interface type (nativeortincd) and the subtype (usually the OS name in lowercase) that this GVPE was configured for. Can be used to select the correct syntax to use for network-related commands.MTU=1436β The MTU to set the interface to. You can use lower values (if done consistently on all nodes), but this is usually either inefficient or simply ineffective. π¬NODES=5β The number of nodes in this GVPE network.
Variables that are node-specific and with values pertaining to the node running this GVPE:
IFUPDATA=stringβ The value of the configuration directiveif-up-data.MAC=fe:fd:80:00:00:01β The MAC address the network interface has to use.
Might be used to initialize interfaces on platforms where GVPE does not do this automatically. Please see the gvpe.osdep(5) man page for platform-specific information.
NODENAME=branch1β The nickname of the node.NODEID=1β The numerical node ID of the node running this instance of GVPE. The first node mentioned in the config file gets ID1, the second ID2and so on.
In addition, all node-specific variables (except NODEID) will be available with a postfix of _nodeid, which contains the value for that node, e.g. the MAC_1 variable contains the MAC address of node #1, while the NODENAME_22 variable contains the name of node #22. okay that's actually so clever π
Here is a simple if-up script:
#!/bin/sh
ip link set $IFNAME 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.
ifname = devnameβ Sets the tun interface name to the given name. The default is OS-specific and most probably something liketun0.ifpersist = yes|true|on | no|false|offβ Should the tun/tap device be made persistent, that is, should the device stay up even when gvpe exits? Some versions of the tunnel device have problems sending packets when gvpe 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 tooffand do anifconfig downon the device.
ip-proto = numerical-ip-protocolβ sets the protocol number used for the rawip protocol. It's global because every node has to agree on the same protocol, and since rawip has no port numbers, you can't easily run more than one gvpe instance on the same protocol β and you can't share it with other programs either. π
Default is 47 (GRE), which has a pretty good chance of tunneling through firewalls (but heads up: gvpe's rawip protocol is not GRE compatible). Other popular picks are 50 (IPSEC, ESP), 51 (IPSEC, AH), 4 (IPIP tunnels) or 98 (ENCAP, rfc1241).
Many versions of Linux seem to have a bug that makes them reorder packets for some ip protocols (GRE, ESP) but not others (AH), so choose wisely β that is, use 51, AH. π
http-proxy-host = hostname/ipβ the wholehttp-proxy-*family only exists if gvpe was compiled with the--enable-http-proxyoption, and it enables tunneling tcp connections through a http proxy server. π
http-proxy-host and http-proxy-port should specify the hostname and port number of the proxy server. Peep http-proxy-loginpw if your proxy needs authentication.
Please note that gvpe 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 nodes) 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 nodes.
Example:
http-proxy-host = proxy.example.com
http-proxy-port = 3128 # 8080 is another common choice
http-proxy-auth = schmorp:grumbeere
http-proxy-port = proxy-tcp-portβ the port where your proxy server listens. πhttp-proxy-auth = login:passwordβ the optional login and password used to authenticate to the proxy server, separated by a literal colon (:). Only basic authentication is currently supported.keepalive = secondsβ sets the keepalive probe interval in seconds (default:60). After this many seconds of inactivity, the daemon will start to send a keepalive probe every 3 seconds until it receives a reply from the other end. If no reply is received within 15 seconds, the peer is considered unreachable and the connection is closed. πloglevel = noise|trace|debug|info|notice|warn|error|criticalβ sets the logging level. Connection established messages are logged at levelinfo, notable errors are logged witherror. Default isinfo. β¨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 theif-upscript.
Recommended values are 1500 (ethernet), 1492 (pppoe), 1472 (pptp).
This value must be the minimum of the MTU values of all nodes. no cap. π€
nfmark = integerβ this advanced option, when set to a nonzero value (default:0), tries to set the netfilter mark (or fwmark) value on all sockets gvpe uses to send packets.
This can be used to make gvpe use a different set of routing rules. For example, on GNU/Linux, the if-up could set nfmark to 1000 and then put all routing rules into table 99 and then use an ip rule to make gvpe traffic avoid that routing table β in effect routing normal traffic via gvpe and gvpe traffic via the normal system routing tables:
ip rule add not fwmark 1000 lookup 99
node-up = relative-or-absolute-pathβ sets a command (default: none) that should be called whenever a connection is established (even on rekeying operations). Note thatnode-up/downscripts will be run asynchronously, but execution is serialised, so there will only ever be one such script running. π§
In addition to all the variables passed to if-up scripts, the following environment variables will be set (values are just examples):
DESTNODE=branch2β the name of the remote node.DESTID=2β the node id of the remote node.DESTSI=rawip/88.99.77.55:0β the "socket info" of the target node, protocol dependent but usually in the formatprotocol/ip:port.DESTIP=188.13.66.8β the numerical IP address of the remote node (gvpe accepts connections from everywhere, as long as the other node can authenticate itself).DESTPORT=655 # deprecatedβ the protocol port used by the other side, if applicable.STATE=upβ node-up scripts get called withSTATE=up, node-change scripts get called withSTATE=changeand node-down scripts get called withSTATE=down.
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.
node-change = relative-or-absolute-pathβ same asnode-change, but gets called whenever something about a connection changes (such as the source IP address). π¦node-down = relative-or-absolute-pathβ same asnode-up, but gets called whenever a connection is lost. πpid-file = pathβ the path to the pid file to check and create (default:LOCALSTATEDIR/run/gvpe.pid). The first%sis replaced by the nodename β any other use of%must be written as%%.private-key = relative-path-to-keyβ sets the path (relative to the config directory) to the private key (default:hostkey). This is a printf format string so every%must be doubled. A single%sis replaced by the hostname, so you could use paths likehostkeys/%sto be able to share the same config directory between nodes.
Since only the private key file of the current node is used and the private key file should be kept secret per-node to avoid spoofing, it is not recommended to use this feature this way though. π
rekey = secondsβ sets the rekeying interval in seconds (default:3607). Connections are reestablished everyrekeyseconds, making them use a new encryption key. π₯seed-device = pathβ the random device used to initially and regularly seed the random number generator (default:/dev/urandom). Randomness is of paramount importance to the security of the algorithms used in gvpe. π
On program start and every seed-interval, gvpe will read 64 octets.
Setting this path to the empty string will disable this functionality completely (the underlying crypto library will likely look for entropy sources on it's own though, so not all is lost).
seed-interval = secondsβ the number of seconds between reseeds of the random number generator (default:3613). A value of0disables this regular reseeding.serial = stringβ the configuration serial number. This can be any string up to 16 bytes length. Only when the serial matches on both sides of a connection will the connection succeed. This is not a security mechanism and eay to spoof β this mechanism exists to alert users that their config is outdated. β
It's recommended to specify this is a date string such as 2013-05-05 or 20121205084417.
The exact algorithm is as this: if a connection request is received form a node with an identical serial, then it succeeds normally.
If the remote serial is lower than the local serial, it is ignored.
If the remote serial is higher than the local serial, a warning message is logged.
πΈ NODE SPECIFIC SETTINGS πΈ
The following settings are node-specific, that is, every node can have different settings, even within the same gvpe instance. Settings that are set before the first node section set the defaults, settings that are set within a node section only apply to the given node. π
allow-direct = nodenameβ allow direct connections to this node. Seedeny-directfor more info.compress = yes|true|on | no|false|offβ for the current node, this specified whether it will accept compressed packets, and for all other nodes, this specifies whether to try to compress data packets sent to this node (default:yes). Compression is really cheap even on slow computers, has no size overhead at all and will only be used when the other side supports compression, so enabling this is often a good idea. β¨connect = ondemand | never | always | disabledβ sets the connect mode (default:always). It can be:alwaysβ always try to establish and keep a connection to the given nodeneverβ never initiate a connection to the given host, but accept connectionsondemandβ try to establish a connection when there are outstanding packets in the queue and take it down after the keepalive intervaldisabledβ node is bad, don't talk to it
Routers will automatically be forced to always unless they are disabled, to ensure all nodes can talk to each other.
deny-direct = nodename | *β deny direct connections to the specified node (or all nodes when*is given). Only one node can be specified, but you can use multipleallow-directanddeny-directstatements. This only makes sense in networks with routers, as routers are required for indirect connections.
Sometimes, a node cannot reach some other nodes for reasons of network connectivity. For example, a node behind a firewall that only allows connections to/from a single other node in the network. In this case one should specify deny-direct = * and allow-direct = othernodename (the other node must be a router for this to work).
The algorithm to check whether a connection may be direct is as follows:
- Other node mentioned in an
allow-direct? If yes, allow the connection. - Other node mentioned in a
deny-direct? If yes, deny direct connections. - Allow the connection.
That is, allow-direct takes precedence over deny-direct. π
The check is done in both directions, i.e. both nodes must allow a direct connection before one is attempted, so you only need to specify connect limitations on one node.
dns-domain = domain-suffixβ the DNS domain suffix that points to the DNS tunnel server for this node. π
The domain has to point to a NS record that points to the dns-hostname, like so:
dns-domainname = tunnel.example.net
dns-hostname = tunnel-server.example.net
Which is literally just these DNS entries living in the example.net domain:
tunnel.example.net. NS tunnel-server.example.net.
tunnel-server.example.net. A 13.13.13.13
dns-hostname = hostname/ipβ the address you bind the DNS tunnel socket to. Basically the same energy ashostname, except it's only for the DNS tunnel protocol. Default:0.0.0.0, but bestie, that might change. πdns-port = port-numberβ the port the DNS tunnel socket binds to. On DNS tunnel servers this must be53, no negotiating. β¨enable-dns = yes|true|on | no|false|offβ go readgvpe.protocol(7)if you want the full lore on the DNS transport protocol. Honestly? Avoid this protocol if you can. π It switches the DNS tunneling protocol on for this node, whether that node is being a server or a client. Also important: this transport is only even available if gvpe got compiled with the--enable-dnsoption.enable-icmp = yes|true|on | no|false|offβgvpe.protocol(7)has the ICMP transport protocol breakdown. This one enables the ICMP transport using ICMP packets of typeicmp-typeon this node. πΈenable-rawip = yes|true|on | no|false|offβgvpe.protocol(7)explains the RAW IP transport protocol. This enables the RAW IPv4 transport using theip-protoprotocol (default:no).enable-tcp = yes|true|on | no|false|offβgvpe.protocol(7)covers the TCP transport protocol. This enables the TCPv4 transport using thetcp-portport (default:no). Heads up: support for this transport is only there if gvpe was compiled with the--enable-tcpoption. πenable-udp = yes|true|on | no|false|offβgvpe.protocol(7)has the UDP transport protocol scoop. This enables the UDPv4 transport using theudp-portport (default:no).hostname = hostname | ip [can not be defaulted]β forces this node's address to be set to whatever DNS hostname or IP you hand it. It gets resolved before each connect request, so dyndns behaves just fine. π¦ If you don't set this and a router is available, then the router gets queried for this node's address. If neither of those works out? The connection attempt just fails. π Also, real talk: DNS resolving happens synchronously, which means it pauses the daemon. If that's a problem for you, you need to specify IP addresses.icmp-type = integerβ sets the type value used for outgoing (and incoming, yes, both) packets sent over the ICMP transport. Default is0, which is echo-reply, aka "ping-reply". Other genuinely useful values include8(echo-request, a.k.a. "ping") and11(time-exceeded), but literally any 8-bit value can be used. πif-up-data = valueβ whatever value you put here gets passed to theif-upscript inside the environment variableIFUPDATA.inherit-tos = yes|true|on | no|false|offβ whether to inherit the TOS settings of packets sent to the tunnel when sending packets to this node (default:yes). If it'syes, then outgoing tunnel packets carry the same TOS setting as the packets sent to the tunnel device β which is usually exactly what you want. πlow-power = yes|true|on | no|false|offβ if true, this designates a node as a low-power node. Low-power nodes use larger timeouts and try to cut down on cpu time. Other nodes talking to a low-power node will also use larger timeouts and go less aggressive with optimisations, all in the hope of reducing load. Security is not compromised, bestie. The classic low-power node is a mobile phone, where wakeups and encryption can seriously crank up the power drain. πmax-retry = positive-numberβ the maximum interval in seconds (default:3600, aka one hour) between retries to establish a connection to this node. When a connection can't be established, gvpe does exponential back-off, capped at this value. Sometimes it's useful to set this way lower (e.g.120) on connections to routers that are usually stable but sometimes down, so you get quick reconnections even after longer downtimes. βmax-ttl = secondsβ expire packets that couldn't be sent after this many seconds (default:60). Normally gvpe queues packets for a node with no active connection, hoping a connection happens soon. This value is the maximum lifetime a packet will sit in that queue β once a packet gets older, it gets thrown away. ποΈmax-queue = positive-number>=1β the maximum number of packets that will be queued for this node (default:512). If more packets get sent than that, then the earlier packets will be expired. Seemax-ttl, above. βοΈrouter-priority = 0 | 1 | positive-number>=2β sets the router priority of the given node (default:0, disabled). If some node tries to connect to another node but it doesn't have ahostname, it asks a router node for its IP address. The router node chosen is the one with the highest priority larger than1that's currently reachable. This is called a mediated connection β the connection itself is still direct, it just uses another node to mediate between the two nodes. π
The value 0 disables routing: meaning if the node receives a packet that isn't for itself, it won't forward it, it just drops it. π
The special value 1 allows other hosts to route through the router host, but they'll never route through it by default (i.e. the config file of another node needs to specify a router priority higher than one to pick such a node for routing).
The whole idea is that some hosts can, if required, bump the router-priority setting above 1 in their local config to route through specific hosts. If router-priority is 0, then routing is refused β so 1 basically serves as an "enable, but do not use by default" switch. π₯
Nodes with router-priority set to 2 or higher will always be forced to connect = always (unless they're disabled).
tcp-port = port-numberβ same idea asudp-port(default:655), except it sets the TCP port number.udp-port = port-numberβ sets the port number used by the UDP protocol (default:655, and no, it is not officially assigned by IANA!). π
π CONFIG DIRECTORY LAYOUT π
The default (or recommended, if we're being fancy) directory layout for the config directory is:
gvpe.confβ the config file.if-upβ the if-up script.node-up,node-downβ the node up or node-down scripts, if used.hostkeyβ the (default path of the) private key of the current host. πpubkey/nodenameβ the public keys of the other nodes, one file per node. π«Ά
π SEE ALSO π
gvpe(5), gvpe(8), gvpectrl(8).
π AUTHOR π
Marc Lehmann <gvpe@schmorp.de>
And that's the whole page, bestie, we ate fr fr π
β¨ This was GVPE.CONF(5), version 3.0, dated 2016-11-12 β go forth and tunnel responsibly, ily ππ¦π
π¦ where this page comes from
- alpine 3.22: gvpe-doc 3.1-r6 Β· GPL-2.0-or-later
- alpine 3.23: gvpe-doc 3.1-r6 Β· GPL-2.0-or-later
- alpine 3.24: gvpe-doc 3.1-r6 Β· GPL-2.0-or-later
- debian bookworm: gvpe 3.1-2+b2 Β· GPL-3.0-or-later WITH OpenSSL exception
- debian trixie: gvpe 3.1-2+b3 Β· GPL-3.0-or-later WITH OpenSSL exception
- nixos 26.05: gvpe 3.1
- nixpkgs unstable: gvpe 3.1
- ubuntu jammy: gvpe 3.1-2build3 Β· GPL-3.0-or-later WITH OpenSSL exception
- ubuntu noble: gvpe 3.1-2build5 Β· GPL-3.0-or-later WITH OpenSSL exception
- ubuntu questing: gvpe 3.1-2build5
- ubuntu resolute: gvpe 3.1-2build6 Β· GPL-3.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms