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.

122 lines
4.4 KiB

12 years ago
12 years ago
12 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
12 years ago
11 years ago
12 years ago
11 years ago
11 years ago
11 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
11 years ago
12 years ago
11 years ago
12 years ago
11 years ago
12 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
12 years ago
11 years ago
12 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. shadowsocks-libev
  2. =================
  3. Intro
  4. -----
  5. [Shadowsocks-libev](http://shadowsocks.org) is a lightweight secured scoks5
  6. proxy for embedded devices and low end boxes.
  7. It is a port of [shadowsocks](https://github.com/clowwindy/shadowsocks)
  8. created by [@clowwindy](https://github.com/clowwindy) maintained by
  9. [@madeye](https://github.com/madeye).
  10. Current version: 1.2 [![Build Status](https://travis-ci.org/madeye/shadowsocks-libev.png?branch=master)](https://travis-ci.org/madeye/shadowsocks-libev)
  11. Features
  12. --------
  13. Shadowsocks-libev is writen in pure C and only depends on
  14. [libev](http://software.schmorp.de/pkg/libev.html).
  15. When statically linked and packaged for OpenWRT, the total package size is 23KB.
  16. In normal usage, the memory consumption is about 600KB and the CPU utilization is
  17. no more than 5% on a low-end router (Buffalo WHR-G300N V2 with a 400MHz MIPS CPU,
  18. 32MB memory and 4MB flash).
  19. Installation
  20. ------------
  21. Build the binary like this:
  22. ```bash
  23. sudo apt-get install build-essential autoconf libtool
  24. ./configure && make
  25. sudo make install
  26. ```
  27. Usage
  28. -----
  29. ```
  30. usage:
  31. ss-local -s server_host -p server_port -l local_port -k password
  32. [-m encrypt_method] [-f pid_file] [-t timeout] [-c config_file]
  33. ss-redir -s server_host -p server_port -l local_port -k password
  34. [-m encrypt_method] [-f pid_file] [-t timeout] [-c config_file]
  35. ss-server -s server_host -p server_port -k password
  36. [-m encrypt_method] [-f pid_file] [-t timeout] [-c config_file]
  37. options:
  38. encrypt_method: table, rc4
  39. pid_file: valid path to the pid file
  40. timeout: socket timeout in senconds
  41. config_file: json format config file
  42. notes:
  43. ss-redir provides a transparent proxy function and only works on the
  44. Linux platform with iptables.
  45. ```
  46. ## Advanced usage
  47. The latest shadowsocks-libev has provided a transparent mode. You can configure your linux based box or router to proxy all tcp traffic transparently.
  48. # Create new chain
  49. root@Wrt:~# iptables -t nat -N SHADOWSOCKS
  50. # Ignore your shadowsocks server's addresses
  51. # It's very IMPORTANT, just be careful.
  52. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 123.123.123.123 -j RETURN
  53. # Ignore LANs and any other addresses you'd like to bypass the proxy
  54. # See Wikipedia and RFC5735 for full list of reserved networks.
  55. # See ashi009/bestroutetb for a highly optimized CHN route list.
  56. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN
  57. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN
  58. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
  59. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN
  60. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN
  61. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN
  62. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN
  63. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN
  64. # Anything else should be redirected to shadowsocks's local port
  65. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 12345
  66. # Apply the rules
  67. root@Wrt:~# iptables -t nat -A OUTPUT -p tcp -j SHADOWSOCKS
  68. # Start the shadowsocks-redir
  69. root@Wrt:~# ss-redir -c /etc/config/shadowsocks.json -f /var/run/shadowsocks.pid
  70. ## Security Tips
  71. Although shadowsocks-libev can handle thousands of concurrent connections nicely, we still recommend to
  72. set up your server's firewall rules to limit connections from each user.
  73. # Up to 32 connections are enough for normal usages
  74. iptables -A INPUT -p tcp --syn --dport ${SHADOWSOCKS_PORT} -m connlimit --connlimit-above 32 -j REJECT --reject-with tcp-reset
  75. ## License
  76. Copyright (C) 2013 Max Lv <max.c.lv@gmail.com>
  77. This program is free software: you can redistribute it and/or modify
  78. it under the terms of the GNU General Public License as published by
  79. the Free Software Foundation, either version 3 of the License, or
  80. (at your option) any later version.
  81. This program is distributed in the hope that it will be useful,
  82. but WITHOUT ANY WARRANTY; without even the implied warranty of
  83. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  84. GNU General Public License for more details.
  85. You should have received a copy of the GNU General Public License
  86. along with this program. If not, see <http://www.gnu.org/licenses/>.