Ссылки на страницы:

Developed by DEDSEC GROUP

Shadowsocks для Asuswrt-Merlin New Gen

Инструкция по созданию Shadowsocks подключения на маршрутизаторах ASUS работающих на прошивке от господина Merlin.

Все настройки проводились на маршрутизаторе Asus GT-AX11000 и успешно завелись. Для того чтобы использовать данный пакет, установите Entware. Инструкция по установке ЗДЕСЬ. Вам так же понадобится флешка для роутера заранее отформатированная в EXT4 файловую систему.

Далее весь текст будет скопирован с оригинала на GitHub.
Ссылка на GitHub прилагается: Acris/shadowsocks-asuswrt-merlin: Shadowsock for Asuswrt-Merlin New Gen (github.com)

В конце статьи есть ПРИМЕЧАНИЕ, в нём описывается как убрать лишнее из пакета и пропускать трафик только по собственному белому списку.

shadowsocks-asuswrt-merlin will install shadowsocks-libev and v2ray-plugin on your Asuswrt-Merlin New Gen(version 382.xx and higher) based router, tested on NETGEAR R7000 and ASUS RT-AC86U.

For server side set up, you can easily install shadowsocks server and v2ray-plugin with docker by https://github.com/Acris/docker-shadowsocks-libev.

Getting Started

Prerequisites

  • Asuswrt-Merlin New Gen(version 382.xx and higher) based router
  • Entware must be installed, you can find installation documents on https://github.com/RMerl/asuswrt-merlin/wiki/Entware
  • JFFS partition should be enabled
  • ca-certificates should be installed for HTTPS support
  • git and git-http should be installed
  • wget-ssl should be installed

Make sure you have installed all prerequisites software and utils, you can install it by:

opkg update
opkg upgrade
opkg install ca-certificates git-http wget-ssl

Installation

shadowsocks-asuswrt-merlin is installed by running the following commands in your terminal:

sh -c "$(wget https://cdn.jsdelivr.net/gh/Acris/shadowsocks-asuswrt-merlin@master/tools/install.sh -O -)"

Configuration

Configure shadowsocks
The sample shadowsocks configuration file location is: /opt/share/ss-merlin/etc/shadowsocks/config.sample.json, ensure local_address is set to 0.0.0.0.

We highly recommend to enable v2ray-plugin on your server side. You can set up your server in several command with: https://github.com/Acris/docker-shadowsocks-libev.

If you want to enable UDP support, you should set mode from tcp_only to tcp_and_udp.

For configuration file documents, you can go to: https://github.com/shadowsocks/shadowsocks-libev/blob/master/doc/shadowsocks-libev.asciidoc#config-file

# Copy and edit the shadowsocks configuration file
cd /opt/share/ss-merlin/etc/shadowsocks
cp config.sample.json config.json
vi config.json

Configure shadowsocks-asuswrt-merlin

The sample shadowsocks-asuswrt-merlin configuration file location is: /opt/share/ss-merlin/etc/ss-merlin.sample.conf. Currently, shadowsocks-asuswrt-merlin support three mode:

  • 0: GFW list.
  • 1: Bypass mainland China.
  • 2: Global mode.

You can also enable or disable UDP support to change udp=0 or udp=1, ensure your server side support UDP and set «mode»: «tcp_and_udp» in shadowsocks configuration file.

# Copy and edit the shadowsocks-asuswrt-merlin configuration file
cd /opt/share/ss-merlin/etc
cp ss-merlin.sample.conf ss-merlin.conf
vi ss-merlin.conf

Configure which LAN IP will pass transparent proxy by edit lan_ips, you can assign a LAN IP like 192.169.1.125 means only this device can pass transparent proxy.

And you can change the default DNS server for Chinese IPs by modifying china_dns_ip.

Then, start the service:

# Start the service
ss-merlin start

Usage

admin@R7000:/tmp/home/root# ss-merlin 
Usage: ss-merlin start|stop|restart|status|upgrade|uninstall

Custom user rules

# Block domain

## Add domain to this file if you want to block it.
vi /opt/share/ss-merlin/rules/user_domain_name_blocklist.txt# Force pass proxy

## You can add domain to this file if you want to force the domain pass proxy.
vi /opt/share/ss-merlin/rules/user_domain_name_gfwlist.txt# Domain whitelist

## You can add domain to this file if you need the domain bypass proxy.
vi /opt/share/ss-merlin/rules/user_domain_name_whitelist.txt# IP whitelist

## You can add IP address to this file if you need the IP bypass proxy.
vi /opt/share/ss-merlin/rules/user_ip_whitelist.txt# IP gfwlist

## You can add IP address to this file if you want to force the IP pass proxy.
vi /opt/share/ss-merlin/rules/user_ip_gfwlist.txt# Then, restart the service
ss-merlin restart

ПРИМЕЧАНИЕ

В стандартной конфигурации будут загружены дополнительные списки для обхода. Следовательно все сайты и IP адреса указанные в этих списках будут так же открываться через Shadowsocks.

Для того чтобы этого избежать и работать исключительно по своему белому списку, нужно сделать следующее.

 

1. Открыть файл конфигурации ss-merlin.conf

cd /opt/share/ss-merlin/etc
vi ss-merlin.conf

Удалить строки где начинается #China DNS IP

 

2. Отключить V2Ray плагин, если его нет на вашем сервере

cd /opt/share/ss-merlin/etc/shadowsocks
vi config.json

Удалить строки

«plugin»: «v2ray-plugin»,

«plugin_opts»: «tls;host=cloudfront.net;path=/v2ray»

 

3. Удалить лишние адреса из Unbound

cd /opt/share/ss-merlin/etc/unbound
vi unbound.conf

Удалить

forward-addr: 118.89.110.78@853

forward-addr: 47.96.179.163@853

 

4. Запрещаем подключение заранее готовых списков и их обновление по CRON

Открываем скрипт инициализации и запуска ss-merlin

cd /opt/share/ss-merlin/bin
vi ss-merlin

Комментируем строки символом «#»

#!bin/ash
.   .   .
#sed -i "/server=\/${i}\/.*/d" ${ACCELERATED_CONFIG} - Строка 102
#sed -i "/server=\/${i}\/.*/d" ${GOOGLE_CONFIG} - Строка 103
#sed -i "/server=\/${i}\/.*/d" ${APPLE_CONFIG} - Строка 104 . . . #cru a update-ip-whitelist "15 2 * * *" "$SS_MERLIN_HOME/scripts/update_ip_whitelist.sh" - Строка 135 #cru a update-dns-whitelist "15 3 * * *" "$SS_MERLIN_HOME/scripts/update_dns_whitelist.sh" - Строка 136 #cru a update-gfwlist "15 4 * * *" "$SS_MERLIN_HOME/scripts/update_gfwlist.sh" - Строка 137 #cru a update-ss-merlin "20 6 * * *" "$SS_MERLIN_HOME/tools/upgrade.sh - Строка 138

Выставляем права на файл 0555

chmod 0555 /opt/share/ss-merlin/bin/ss-merlin

 

5. Отозвать все права у следующих файлов

chmod 0000 /opt/share/ss-merlin/tools/upgrade.sh
chmod 0000 /opt/share/ss-merlin/tools/do_upgrade.sh
Add Comment
Этот сайт защищен reCaptcha и применяются Политика конфиденциальности и Условия обслуживания Google.

The reCAPTCHA verification period has expired. Please reload the page.