OCPROXY(1)
π OCPROXY(1) β the manual page, but make it bestie π
okay so real talk, this is the manual for ocproxy from the General Commands Manual, and it's genuinely one of those tools that just works once you get it. let's go β¨
πΈ NAME πΈ
ocproxy β a lwip based proxy for openconnect π¦
β¨ SYNOPSIS β¨
ocproxy [options]
that's it bestie, that's the whole vibe. no positional args, no drama π
π DESCRIPTION π
okay so this page is just gonna briefly walk you through the ocproxy command. lowkey short, highkey useful π«Ά
ocproxy is a program that gives you a SOCKS proxy and port-forwarding proxy when you use it together with openconnect(1). and here's the iconic part: when you're running ocproxy, OpenConnect only handles the network activity that you specifically ask it to proxy. so the VPN tunnel no longer "hijacks" all the network traffic on your host. no more main-character-syndrome VPN eating everything ππ
how does it pull this off?? by running a lwIP network stack in userland, so the OS kernel isn't directly handling the packets going to and from the VPN connection anymore. the kernel is like, not invited. periodt β
π BASIC USAGE π
ocproxy should be invoked directly from OpenConnect or another VPN program. a file descriptor number gets passed through the VPNFD environment variable, and that's how ocproxy knows how to send and receive VPN traffic. iykyk π«
like, for example:
openconnect --script-tun --script "ocproxy -D 11080
-L2222:unix-host:22" vpn.example.com
the options people actually use all the time are these ones π
-D,--dynfw [bind_address:]portβ starts up a SOCKS5 server on TCP port port so you can dynamically forward application-level traffic over the VPN proxy. it's meant to feel like the-Doption inssh(1). if you don't specify bind_address,ocproxybinds to the loopback interface by default β unless you used--allow-remote, in which case, plot twist π-L,--localfw port:host:hostportβ binds to local TCP port port and forwards incoming connections to host:hostport on the VPN. host can be a DNS name or a dotted-quad IP address, flexible queen πββοΈ. and if the VPN handed over a default DNS domain name, or you passed--domainon the command line, then unqualified hostnames are fair game too. this is meant to resemble the-Loption inssh(1).-g,--allow-remoteβ so by default, the local listening sockets opened by--dynfwand--localfware bound to the loopback interface only (127.0.0.1), which means they're only reachable from the local machine. if you specify--allow-remote, those sockets get bound toINADDR_ANY(0.0.0.0) instead, and other hosts can connect to them π. this is intended to resemble the-goption tossh(1).
ngl bestie, think before you flip this one on β it literally opens your proxy up to other machines π¨
-k,--keepalive intervalβ sends a TCP keepalive packet every interval seconds on each open connection, on the VPN side. this helps you dodge idle timeouts, both on the VPN gateway itself and on any stateful firewalls sitting in between the two ends. staying alive, literally β¨
π ADVANCED USAGE π
these ones are for when you're debugging ocproxy or trying to diagnose a problem. detective mode π
-v,--verboseβ turns on verbose debugging output. more words, more truth π£οΈ-T,--tcpdumpβ writes a log of all TCP or UDP packets traversing the VPN to/tmp/tcpdump. the format largely mirrors the output of thetcpdump(8)utility. cute little packet diary π
normally ocproxy grabs its IP configuration parameters through environment variables that OpenConnect provides. but these options below let you override the autodetected parameters, if you're feeling opinionated π
-I,--ip local_ipβ uses local_ip as the VPN side IP address. example:192.168.5.20. this is normally set through theINTERNAL_IP4_ADDRESSenvironment variable.-M,--mtu mtu_bytesβ uses mtu_bytes as the maximum transmit unit on the VPN interface; it generally depends on DTLS and UDP packet overhead. example:1300. this is normally set through theINTERNAL_IP4_MTUenvironment variable.-d,--dns dns_ipβ sends all VPN side DNS queries to server dns_ip. example:192.168.5.2. this is normally set through theINTERNAL_IP4_DNSenvironment variable.-o,--domain domainβ uses domain as the default DNS domain, for unqualified hostnames. this is normally set through theCISCO_DEF_DOMAINenvironment variable.
π¦ SEE ALSO π¦
and if you wanna go read the lwIP lore: http://savannah.nongnu.org/projects/lwip/ π
okay that's the whole page bestie!! this one's from the General Commands Manual, it's ocproxy(1), and it was dated November 20, 2012 β vintage, honestly, and still slaying πβ¨
π¦ where this page comes from
- debian bookworm: ocproxy 1.60-1+b2 Β· BSD-3-Clause
- debian trixie: ocproxy 1.60-1+b3 Β· BSD-3-Clause
- nixos 26.05: ocproxy 1.60
- nixpkgs unstable: ocproxy 1.60
- ubuntu jammy: ocproxy 1.60-1build2 Β· BSD-3-Clause
- ubuntu noble: ocproxy 1.60-1build6 Β· BSD-3-Clause
- ubuntu questing: ocproxy 1.60-1build6
- ubuntu resolute: ocproxy 1.60-1build7 Β· BSD-3-Clause
- ubuntu stonking: ocproxy 1.60-1.1 Β· BSD-3-Clause
- Copyright 2012 David Edmondson <dme@dme.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms