| 1 |
.\" Copyright, the authors of the Linux man-pages project |
| 2 |
.\" |
| 3 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 4 |
.\" |
| 5 |
.TH IP_TRANSPARENT 2const 2025-11-25 "Linux man-pages 6.18" |
| 6 |
.SH NAME |
| 7 |
IP_TRANSPARENT |
| 8 |
\- |
| 9 |
transparent proxying |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.BR "#include <netinet/in.h>" " /* Definition of " IP* " constants */" |
| 16 |
.B #include <sys/socket.h> |
| 17 |
.P |
| 18 |
.BI int\~setsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_TRANSPARENT, |
| 19 |
.BI " const\~int\~*" enable ,\~sizeof(int)); |
| 20 |
.fi |
| 21 |
.SH DESCRIPTION |
| 22 |
Setting this boolean option enables transparent proxying on this socket. |
| 23 |
.P |
| 24 |
This socket option allows |
| 25 |
the calling application to bind to a nonlocal IP address and operate |
| 26 |
both as a client and a server with the foreign address as the local endpoint. |
| 27 |
.P |
| 28 |
This requires that routing be set up in a way that |
| 29 |
packets going to the foreign address are routed through the TProxy box |
| 30 |
(i.e., the system hosting the application that employs the |
| 31 |
.B IP_TRANSPARENT |
| 32 |
socket option). |
| 33 |
.P |
| 34 |
Enabling this socket option requires superuser privileges |
| 35 |
(the |
| 36 |
.B CAP_NET_ADMIN |
| 37 |
or |
| 38 |
.B CAP_NET_RAW |
| 39 |
capability). |
| 40 |
.P |
| 41 |
TProxy redirection with the iptables TPROXY target also requires that |
| 42 |
this option be set on the redirected socket. |
| 43 |
.SH ERRORS |
| 44 |
See |
| 45 |
.BR IPPROTO_IP (2const). |
| 46 |
See |
| 47 |
.BR setsockopt (2). |
| 48 |
See |
| 49 |
.BR ip (7). |
| 50 |
.SH STANDARDS |
| 51 |
Linux. |
| 52 |
.SH HISTORY |
| 53 |
Linux 2.6.24. |
| 54 |
.\" commit f5715aea4564f233767ea1d944b2637a5fd7cd2e |
| 55 |
.\" This patch introduces the IP_TRANSPARENT socket option: enabling that |
| 56 |
.\" will make the IPv4 routing omit the non-local source address check on |
| 57 |
.\" output. Setting IP_TRANSPARENT requires NET_ADMIN capability. |
| 58 |
.\" http://lwn.net/Articles/252545/ |
| 59 |
.SH SEE ALSO |
| 60 |
.BR IPPROTO_IP (2const), |
| 61 |
.BR setsockopt (2), |
| 62 |
.BR ip (7) |