You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
5.2 KiB

  1. .ig
  2. . manual page for shadowsocks-libev
  3. .
  4. . Copyright (c) 2012-2015, by: Max Lv
  5. . All rights reserved.
  6. .
  7. . Permission is granted to copy, distribute and/or modify this document
  8. . under the terms of the GNU Free Documentation License, Version 1.1 or
  9. . any later version published by the Free Software Foundation;
  10. . with no Front-Cover Texts, no Back-Cover Texts, and with the following
  11. . Invariant Sections (and any sub-sections therein):
  12. . all .ig sections, including this one
  13. . STUPID TRICKS Sampler
  14. . AUTHOR
  15. .
  16. . A copy of the Free Documentation License is included in the section
  17. . entitled "GNU Free Documentation License".
  18. .
  19. ..
  20. \# - these two are for chuckles, makes great grammar
  21. .ds Lo \fBss-local\fR
  22. .ds Re \fBss-redir\fR
  23. .ds Se \fBss-server\fR
  24. .ds Tu \fBss-tunnel\fR
  25. .ds Ma \fBss-manager\fR
  26. .ds Me \fBShadowsocks-libev\fR
  27. .
  28. .TH "SS-REDIR" "1" "September 10, 2015" "SHADOWSOCKS-LIBEV"
  29. .SH NAME
  30. ss-redir \- shadowsocks client as transparent proxy, libev port
  31. .SH SYNOPSIS
  32. \*(Re
  33. [\fB\-AhuUv\fR]
  34. [\fB\-s\fR \fIserver_host\fR] [\fB\-p\fR \fIserver_port\fR] [\fB\-l\fR \fIlocal_port\fR]
  35. [\fB\-k\fR \fIpassword\fR] [\fB\-m\fR \fIencrypt_method\fR] [\fB\-f\fR \fIpid_file\fR]
  36. [\fB\-t\fR \fItimeout\fR] [\fB\-c\fR \fIconfig_file\fR] [\fB\-b\fR \fIlocal_address\fR]
  37. [\fB\-a\fR \fIuser_name\fR]
  38. .SH DESCRIPTION
  39. \*(Me is a lightweight and secure socks5 proxy. It is a port of the original
  40. shadowsocks created by clowwindy. \*(Me is written in pure C and takes advantage
  41. of \fBlibev\fP to achieve both high performance and low resource consumption.
  42. .PP
  43. \*(Me consists of five components. \*(Re(1) works as a transparent proxy on local
  44. machines to proxy TCP traffic and requires netfilter's NAT module. For more
  45. information, check out \fBshadowsocks-libev\fR(8) and the following \fBEXAMPLE\fR
  46. section.
  47. .SH OPTIONS
  48. .TP
  49. .B \-s \fIserver_host\fP
  50. Set the server's hostname or IP.
  51. .TP
  52. .B \-p \fIserver_port\fP
  53. Set the server's port number.
  54. .TP
  55. .B \-l \fIlocal_port\fP
  56. Set the local port number.
  57. .TP
  58. .B \-k \fIpassword\fP
  59. Set the password. The server and the client should use the same password.
  60. .TP
  61. .B \-m \fIencrypt_method\fP
  62. Set the cipher.
  63. Shadowsocks accepts 16 different ciphers: table, rc4, rc4-md5,
  64. aes-128-cfb, aes-192-cfb, aes-256-cfb, bf-cfb, camellia-128-cfb,
  65. camellia-192-cfb, camellia-256-cfb, cast5-cfb, des-cfb, idea-cfb, rc2-cfb,
  66. seed-cfb, salsa20 and chacha20. The default cipher is \fItable\fP.
  67. If built with PolarSSL or custom OpenSSL libraries, some of these ciphers may
  68. not work.
  69. .TP
  70. .B \-f \fIpid_file\fP
  71. Start shadowsocks as a daemon with specific pid file.
  72. .TP
  73. .B \-t \fItimeout\fP
  74. Set the socket timeout in seconds. The default value is 10.
  75. .TP
  76. .B \-c \fIconfig_file\fP
  77. Use a configuration file.
  78. .TP
  79. .B \-b \fIlocal_address\fP
  80. Specify local address to bind.
  81. .TP
  82. .B \-a \fIuser_name\fP
  83. Run as a specific user.
  84. .TP
  85. .B \-u
  86. Enable UDP relay.
  87. TPROXY is required in redir mode.
  88. .TP
  89. .B \-U
  90. Enable UDP relay and disable TCP relay.
  91. .TP
  92. .B \-A
  93. Enable onetime authentication.
  94. .TP
  95. .B \-v
  96. Enable verbose mode.
  97. .SH EXAMPLE
  98. \*(Re requires netfilter's NAT function. Here is an example:
  99. # Create new chain
  100. root@Wrt:~# iptables -t nat -N SHADOWSOCKS
  101. # Ignore your shadowsocks server's addresses
  102. # It's very IMPORTANT, just be careful.
  103. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 123.123.123.123 -j RETURN
  104. # Ignore LANs and any other addresses you'd like to bypass the proxy
  105. # See Wikipedia and RFC5735 for full list of reserved networks.
  106. # See ashi009/bestroutetb for a highly optimized CHN route list.
  107. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN
  108. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN
  109. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
  110. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN
  111. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN
  112. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN
  113. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN
  114. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN
  115. # Anything else should be redirected to shadowsocks's local port
  116. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 12345
  117. # Add any UDP rules
  118. root@Wrt:~# ip rule add fwmark 0x01/0x01 table 100
  119. root@Wrt:~# ip route add local 0.0.0.0/0 dev lo table 100
  120. root@Wrt:~# iptables -t mangle -A SHADOWSOCKS -p udp --dport 53 -j TPROXY --on-port 12345 --tproxy-mark 0x01/0x01
  121. # Apply the rules
  122. root@Wrt:~# iptables -t nat -A PREROUTING -p tcp -j SHADOWSOCKS
  123. root@Wrt:~# iptables -t mangle -A PREROUTING -j SHADOWSOCKS
  124. # Start the shadowsocks-redir
  125. root@Wrt:~# ss-redir -u -c /etc/config/shadowsocks.json -f /var/run/shadowsocks.pid
  126. .SH SEE ALSO
  127. .BR \*(Lo (1),
  128. .BR \*(Se (1),
  129. .BR \*(Tu (1),
  130. .BR \*(Ma (1),
  131. .BR shadowsocks-libev (8),
  132. .BR iptables (8),
  133. /etc/shadowsocks-libev/config.json
  134. .br
  135. .SH AUTHOR
  136. shadowsocks was created by clowwindy <clowwindy42@gmail.com> and
  137. shadowsocks-libev was maintained by Max Lv <max.c.lv@gmail.com> and Linus Yang
  138. <laokongzi@gmail.com>.
  139. .PP
  140. This manual page was written by Max Lv <max.c.lv@gmail.com>.
  141. .PP
  142. The manual pages were rearranged by hosiet <073plan@gmail.com>.