ANYTUN(8)
๐ anytun(8) โ the manual page, but make it cute ๐
okay bestie, sit down, hydrate, because we're about to get into anytun(8) and it's honestly kind of a big deal. no cap.
โจ NAME โจ
anytun โ the anycast tunneling daemon ๐ฆ
like, it's a daemon. it tunnels. it does it via anycast. that's the whole vibe. periodt.
๐ธ SYNOPSIS ๐ธ
anytun
[ -h|--help ]
[ -D|--nodaemonize ]
[ -u|--username <username> ]
[ -g|--groupname <groupname> ]
[ -C|--chroot <path> ]
[ -P|--write-pid <filename> ]
[ -L|--log <target>:<level>[,<param1>[,<param2>[..]]] ]
[ -U|--debug ]
[ -i|--interface <ip-address> ]
[ -p|--port <port> ]
[ -r|--remote-host <hostname|ip> ]
[ -o|--remote-port <port> ]
[ -4|--ipv4-only ]
[ -6|--ipv6-only ]
[ -I|--sync-interface <ip-address> ]
[ -S|--sync-port port> ]
[ -M|--sync-hosts <hostname|ip>[:<port>][,<hostname|ip>[:<port>][...]] ]
[ -X|--control-host <hostname|ip>[:<port>]
[ -d|--dev <name> ]
[ -t|--type <tun|tap> ]
[ -n|--ifconfig <local>/<prefix> ]
[ -x|--post-up-script <script> ]
[ -R|--route <net>/<prefix length> ]
[ -m|--mux <mux-id> ]
[ -s|--sender-id <sender id> ]
[ -w|--window-size <window size> ]
[ -k|--kd-prf <kd-prf type> ]
[ -e|--role <role> ]
[ -E|--passphrase <pass phrase> ]
[ -K|--key <master key> ]
[ -A|--salt <master salt> ]
[ -c|--cipher <cipher type> ]
[ -a|--auth-algo <algo type> ]
[ -b|--auth-tag-length <length> ]
like, that's a lot of brackets, and yes, every single one of them matters. don't skip any. ๐
๐ DESCRIPTION ๐
okay so, Anytun is an implementation of the Secure Anycast Tunneling Protocol (SATP). it's giving "I built a whole VPN" energy.
it provides a complete VPN solution similar to OpenVPN or IPsec in tunnel mode. same league, different flavor. ๐ง
but here's the thing that makes it iconic โ the main difference is that anycast allows a setup of tunnels between an arbitrary combination of anycast, unicast and multicast hosts. like. any mix. any combo. that's the whole point. that's the main character energy right there. ๐
okay bestie, that's part 1 down. there's more coming, don't go anywhere ๐
โจ OPTIONS โจ
okay so bestie, here's the tea: Anytun was built as a peer to peer application, so there's literally no difference between client and server. it's giving egalitarian. ๐ The following options can be passed to the daemon:
-D,--nodaemonizeโ this one tells Anytun to run in the foreground instead of becoming a daemon (which is, btw, the default). great for when you wanna actually see what's happening. ๐-u,--username<username> โ run as this user. if you don't also give a group with-g, the default group of that user gets used. the default is to not drop privileges at all.-g,--groupname<groupname> โ run as this group. heads up: if you don't pass a username with-utoo, this one just gets ignored. ๐ญ the default is, again, to not drop privileges.-C,--chroot<path> โ tell Anytun to run inside a chroot jail. default: no chroot, we're free-range. ๐-P,--write-pid<filename> โ makes Anytun write its pid into this file. default: no pid file gets created.-L,--log<target>:<level>[,<param1>[,<param2>[..]]]โ adds a log target to the logging system. you can hit this one multiple times to log to different targets at the same time, iconic behavior. every target has its own log level, a number between0and5, where0means logging is disabled and5means debug messages are enabled.
the file target can be used more than once with different levels. if you don't provide a target on the command line, a single target with the config syslog:3,anytun,daemon gets added. โจ
these are the supported targets:
syslogโ log to the syslog daemon, parameters are<level>[,<logname>[,<facility>]]fileโ log to a file, parameters are<level>[,<path>]stdoutโ log to standard output, parameters are<level>stderrโ log to standard error, parameters are<level>
-U,--debugโ runs Anytun in debug mode. it implies-D(aka don't daemonize, bestie) and adds a log target configured asstdout:5(logging at maximum level, we love to see it). in future releases there might be additional output when you pass this option. ๐ฎ-i,--interface<ip address> โ this IP address is used as the sender address for outgoing packets. for anycast tunnel endpoints you have to use the anycast IP. for unicast endpoints the address is usually derived correctly from the routing table anyway. default is to not use a special interface and just bind on all interfaces. ๐ซถ-p,--port<port> โ the local UDP port used to send and receive the payload data. the two tunnel endpoints can totally use different ports. BUT โ if a tunnel endpoint is made of multiple anycast hosts, all hosts have to use the same port. default:4444-r,--remote-host<hostname|ip> โ specify the remote tunnel endpoint. for anycast tunnel endpoints you have to use the anycast IP address. if you don't specify an address, it gets automatically determined after receiving the first data packet. magic, honestly. โจ-o,--remote-port<port> โ the UDP port used for payload data by the remote host (aka the one you set with-pon the remote host). if you don't specify it, it's automatically determined after receiving the first data packet. same vibe as above. ๐ซ-4,--ipv4-onlyโ resolve to IPv4 addresses only. default is to resolve both IPv4 and IPv6.-6,--ipv6-onlyโ resolve to IPv6 addresses only. default is to resolve both IPv4 and IPv6.-I,--sync-interface<ip-address> โ local unicast(sync) ip address to bind to.
this option is only needed for tunnel endpoints made of multiple anycast hosts. you can put the unicast IP address of the anycast host here. it's needed for communication with the other anycast hosts. default is to not use a special interface and just bind on all interfaces โ but note that's only the case if synchronisation is active, see --sync-port.
-S,--sync-port<port> โ local unicast(sync) port to bind to.
again, only needed for tunnel endpoints consisting of multiple anycast hosts. this port is how anycast hosts synchronize information about tunnel endpoints. no payload data travels through this port. by default synchronisation is disabled, so the port stays empty.
bestie listen up ๐ you can get a list of active connections by telnetting into this port. this port is read-only and unprotected by default. it is advised to protect it using firewall rules and, eventually, IPsec. do not leave this hanging out in the open, i am begging.
-M,--sync-hosts<hostname|ip>[:<port>],[<hostname|ip>[:<port>][...]]โ remote hosts to sync with.
only needed for tunnel endpoints consisting of multiple anycast hosts. here you have to list all the unicast IP addresses of all the other anycast hosts that make up the anycast tunnel endpoint. by default synchronisation is disabled, so this is empty. mind that the port can be omitted, in which case port 2323 is used. if you want to specify an ipv6 address and a port you have to use [ and ] to separate the address from the port, e.g.: [::1]:1234. if you want to use the default port, [ and ] can be omitted.
-X,--control-host<hostname|ip>[:<port>]โ fetch the config from this host. default is not to use a control host, so this is empty. mind that the port can be omitted, in which case port2323is used. if you want to specify an ipv6 address and a port you have to use[and]to separate the address from the port, e.g.:[::1]:1234. if you want to use the default port,[and]can be omitted. ๐-d,--dev<name> โ device name.
by default, tapN is used for Ethernet tunnel interfaces and tunN for IP tunnels. this option lets you manually override those defaults.
-t,--type<tun|tap> โ device type.
the type of tunnels to create. use tap for Ethernet tunnels, tun for IP tunnels. ๐ฆ
-n,--ifconfig<local>/<prefix>โ the local IP address and prefix length. the remote tunnel endpoint has to use a different IP address in the same subnet.<local>โ the local IP address for the tun/tap device<prefix>โ the prefix length of the network
-x,--post-up-script<script> โ tells Anytun to run this script after the interface is created. by default no script is executed.-R,--route<net>/<prefix length>โ add a route to the connection. this can be invoked several times. slay.-m,--mux<mux-id> โ the multiplex id to use. default:0-s,--sender-id<sender id> โ each anycast tunnel endpoint needs a unique sender id (1,2,3, ...). it's needed to distinguish the senders in case of replay attacks. this option can be ignored on unicast endpoints. default:0-w,--window-size<window size> โ sequence window size.
sometimes packets arrive out of order on the receiver side, it happens. this option defines the size of a list of received packets' sequence numbers. if, according to this list, a received packet has previously been received or was transmitted in the past and is therefore not in the list anymore, that's interpreted as a replay attack and the packet is dropped. a value of 0 deactivates this list and, as a consequence, the replay protection that comes from filtering packets by their sequence number. by default the sequence window is disabled, so a window size of 0 is used.
-k,--kdโprf<kd-prf type> โ key derivation pseudo random function.
the pseudo random function used for calculating the session keys and session salt.
possible values:
nullโ no random function, keys and salt are set to0..00aes-ctrโ AES in counter mode with 128 Bits, default valueaes-ctr-128โ AES in counter mode with 128 Bitsaes-ctr-192โ AES in counter mode with 192 Bitsaes-ctr-256โ AES in counter mode with 256 Bits
-e,--role<role> โ SATP uses different session keys for inbound and outbound traffic. the role parameter decides which keys get used for outbound or inbound packets. on both sides of a vpn connection you have to use different roles. possible values areleftandright. you may also usealiceorserveras a replacement forleft, andboborclientas a replacement forright. by defaultleftis used. ๐ซ-E,--passphrase<passphrase> โ this passphrase is used to generate the master key and master salt. for the master key, the last n bits of the SHA256 digest of the passphrase are used (where n is the length of the master key in bits). the master salt gets generated with the SHA1 digest. you may force a specific key and or salt by using--keyand--salt. ๐-K,--key<master key> โ master key to use for key derivation.
master key in hexadecimal notation, e.g. 01a2b3c4d5e6f708a9b0cadbecfd0fa1, with a mandatory length of 32, 48 or 64 characters (128, 192 or 256 bits).
-A,--salt<master salt> โ master salt to use for key derivation.
master salt in hexadecimal notation, e.g. 01a2b3c4d5e6f708a9b0cadbecfd, with a mandatory length of 28 characters (14 bytes).
-c,--cipher<cipher type> โ payload encryption algorithm.
the encryption algorithm used for encrypting the payload.
possible values:
nullโ no encryptionaes-ctrโ AES in counter mode with 128 Bits, default valueaes-ctr-128โ AES in counter mode with 128 Bitsaes-ctr-192โ AES in counter mode with 192 Bitsaes-ctr-256โ AES in counter mode with 256 Bits
-a,--auth-algo<algo type> โ message authentication algorithm.
this option sets the message authentication algorithm.
if HMAC-SHA1 is used, the packet length is increased. the additional bytes contain the authentication data. see --auth-tag-length for more info.
possible values:
nullโ no message authenticationsha1โ HMAC-SHA1, default value
-b,--auth-tag-length<length> โ the number of bytes to use for the auth tag. this value defaults to10bytes, unless thenullauth algo is used, in which case it defaults to0. ๐ธ
๐ธ EXAMPLES ๐ธ
okay bestie this is the part where it all comes together, the vibe check of "does this actually work" ๐
โจ P2P Setup between two unicast enpoints โจ
(two hosts, one tunnel, mutual obsession ๐ซถ)
Host A:
anytun -r hostb.example.com -t tun -n 192.168.123.1/30 -c
aes-ctr-256 -k aes-ctr-256 \ -E have_a_very_safe_and_productive_day
-e left
Host B:
anytun -r hosta.example.com -t tun -n 192.168.123.2/30 -c
aes-ctr-256 -k aes-ctr-256 \ -E have_a_very_safe_and_productive_day
-e right
see how they're mirror images of each other? ๐ฆ that's the whole point, they point at each other and they match. iconic.
๐ One unicast and one anycast tunnel endpoint ๐
Unicast tunnel endpoint:
anytun -r anycast.anytun.org -d anytun0 -t tun -n 192.0.2.2/30 -a
null -c null -w 0 -e client
Anycast tunnel endpoints:
On the host with unicast hostname unicast1.anycast.anytun.org and anycast hostname anycast.anytun.org:
# anytun -i anycast.anytun.org -d anytun0 -t tun -n 192.0.2.1/30 -a null -c null -w 0 -e server \
-S 2342 -M unicast2.anycast.anytun.org:2342,unicast3.anycast.anytun.org:2342
On the host with unicast hostname unicast2.anycast.anytun.org and anycast hostname anycast.anytun.org:
# anytun -i anycast.anytun.org -d anytun0 -t tun -n 192.0.2.1/30 -a null -c null -w 0 -e server \
-S 2342 -M unicast1.anycast.anytun.org:2342,unicast3.anycast.anytun.org:2342
On the host with unicast hostname unicast3.anycast.anytun.org and anycast hostname anycast.anytun.org:
# anytun -i anycast.anytun.org -d anytun0 -t tun -n 192.0.2.1/30 -a null -c null -w 0 -e server \
-S 2342 -M unicast1.anycast.anytun.org:2342,unicast2.anycast.anytun.org:2342
not me noticing that each anycast host lists the other two unicast peers in -M and never itself ๐ that's not a coincidence bestie, that's the whole design. the way that three hosts are out here being each other's main characters โจ
For more sophisticated examples (like multiple unicast endpoints to one anycast tunnel endpoint) please consult the man page of anytun-config(8).
๐ BUGS ๐
ngl, most likely there are some bugs in Anytun. that's just how software is, it's giving "we tried our best" ๐ญ If you find a bug, please let the developers know at satp@anytun.org. Of course, patches are preferred. (yes queen, sending a fix > sending a complaint, we love a contributor ๐ซถ)
๐ SEE ALSO ๐
go read those too, they're the rest of the friend group ๐
๐ AUTHORS ๐
- Othmar Gsenger
<otti@anytun.org> - Erwin Nindl
<nine@anytun.org> - Christian Pointner
<equinox@anytun.org>
the founding mothers... okay founding devs, but honestly they ate ๐ฅ
โญ RESOURCES โญ
Main web site: http://www.anytun.org/
๐ COPYING ๐
Copyright (C) 2007-2014 Markus Grรผneis, Othmar Gsenger, Erwin Nindl and Christian Pointner. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
and that's a wrap bestie, the whole ANYTUN(8) page, version stamped 01/06/2020, source being the Anytun project itself ๐ธ now go tunnel something responsibly, drink water, and remember: no cap, you understood all of that ๐๐
โจ
๐ฆ where this page comes from
- alpine 3.24: anytun-doc 0.3.8-r12 ยท GPL-3.0-or-later
- debian bookworm: anytun 0.3.8-1+b1 ยท GPL-3.0-or-later WITH OpenSSL exception
- debian trixie: anytun 0.3.8-1.1 ยท GPL-3.0-or-later WITH OpenSSL exception
- ubuntu jammy: anytun 0.3.8-1fakesync1 ยท GPL-3.0-or-later WITH OpenSSL exception
- ubuntu noble: anytun 0.3.8-1fakesync1build1 ยท GPL-3.0-or-later WITH OpenSSL exception
- ubuntu resolute: anytun 0.3.8-1.1fakesync1build1 ยท 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