IP_TRANSPARENT(2const)
π IP_TRANSPARENT β bestie's guide to transparent proxying
okay so real talk, this is IP_TRANSPARENT(2const), a lil page from section 2const of the Linux manual, and it's literally about transparent proxying. yes that's the whole vibe. sit down, grab a π, let's go.
β¨ NAME β¨
IP_TRANSPARENT β transparent proxying. that's it, that's the name, iconic.
π LIBRARY π
Standard C library (libc, -lc). the classics, no cap.
π SYNOPSIS π
#include <netinet/in.h> /* Definition of IP* constants */
#include <sys/socket.h>
int setsockopt(int sockfd, IPPROTO_IP, IP_TRANSPARENT,
const int *enable, sizeof(int));
look at her. so clean. so structured. π«Ά
πΈ DESCRIPTION πΈ
okay so setting this boolean option is what turns on transparent proxying for this socket. like, that's the whole moment.
the way that this socket option works is: it lets the calling application bind to a nonlocal IP address and then operate as both a client and a server, with that foreign address as the local endpoint. yes bestie, both roles, at the same time, main character energy only. π
but!!! π this requires that routing be set up in a way that packets going to the foreign address are routed through the TProxy box β and the TProxy box is, quote unquote, the system hosting the application that employs the IP_TRANSPARENT socket option. so like, the routing has to actually be done, this isn't a vibes-based thing.
enabling this socket option requires superuser privileges β specifically the CAP_NET_ADMIN or CAP_NET_RAW capability. no privilege, no transparency, sorry queen. π
also if you're doing TProxy redirection with the iptables TPROXY target, that also requires that this option be set on the redirected socket. two things, both necessary, periodt.
π¦ ERRORS π¦
- see
IPPROTO_IP(2const). - see
setsockopt(2). - see
ip(7).
that's the list. go read those if something's acting up. β¨
β STANDARDS β
Linux. just Linux. that's the standard. π±
π HISTORY π
Linux 2.6.24. she's been around since forever and she's still serving. π
π SEE ALSO π
and that's the whole page bestie, no notes. π this was Linux man-pages 6.20, dated 2025-11-25, and I am obsessed. mwah. πβ¨
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms