Entware на Atheros чипе для роутера

Post new topic   Reply to topic    DD-WRT Forum Index -> Использование и установка DD-WRT
Author Message
vasek00
DD-WRT Guru


Joined: 06 Nov 2010
Posts: 3312

PostPosted: Fri Jan 11, 2019 13:34    Post subject: Entware на Atheros чипе для роутера Reply with quote
1. Ссылки
https://wiki.dd-wrt.com/wiki/index.php/Installing_Entware
https://github.com/Entware/Entware/wiki/Alternative-install-vs-standard

bin.entware.net/mipssf-k3.4/installer/generic.sh

2. Пример для роутера на базе Atheros c установленной flash в Ext4.
2.1 Настройки для подключения данной flash стандартны описывать не буду
- в разделе Mount this Partition to /opt нужно прописать UUID от данной flash
- запуск основного скрипта можно не писать, потому что пока не работает, выход в starup скрипт

Code:

sleep 10;
/opt/etc/init.d/rc.unslung start;


2.2 Любым доступным способом включить сервис для того чтоб можно было записать файл инсталляции на роутер в данном случае это "generic.sh" в каталог /opt.
- с помощью FTP/Samba/SSHd и установить права на запуск (опять же любым доступным способом, например ввести команду "chmod 755 /opt/generic.sh"

3. Запустить файл "/opt/generic.sh"
И так что получаем
Code:

root@My:/opt# df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                   30592     30592         0 100% /
/dev/root                30592     30592         0 100% /
/dev/sda1               939223     20040    864758   2% /opt
/dev/sda1               939223     20040    864758   2% /tmp/mnt/sda1
root@My:/opt# mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
ramfs on /tmp type ramfs (rw,relatime)
none on /dev type tmpfs (rw,relatime,size=512K)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
devpts on /proc/bus/usb type usbfs (rw,relatime)
/dev/sda1 on /opt type ext4 (rw,relatime,data=ordered)
/dev/sda1 on /tmp/mnt/sda1 type ext4 (rw,relatime,data=ordered)
root@My:/opt# uname -a
Linux My 3.10.108-d7 #70139 Thu Dec 20 01:08:51 CET 2018 mips DD-WRT
root@My:/opt# ls -l
-rwxr-xr-x    1 root     root          2198 Jan 11 13:42 generic.sh
drwx------    2 root     root          1024 Jan 11  2019 lost+found
root@My:/opt# ./generic.sh
Info: Checking for prerequisites and creating folders...
Warning: Folder /opt exists!
Info: Opkg package manager deployment...
Connecting to bin.entware.net (81.4.123.217:80)
opkg                 100% |*************************************************************************************************************|  143k  0:00:00 ETA
Connecting to bin.entware.net (81.4.123.217:80)
opkg.conf            100% |*************************************************************************************************************|   144  0:00:00 ETA
Connecting to bin.entware.net (81.4.123.217:80)
ld-2.27.so           100% |*************************************************************************************************************|  155k  0:00:00 ETA
Connecting to bin.entware.net (81.4.123.217:80)
libc-2.27.so         100% |*************************************************************************************************************| 1613k  0:00:00 ETA
Connecting to bin.entware.net (81.4.123.217:80)
libgcc_s.so.1        100% |*************************************************************************************************************| 95448  0:00:00 ETA
Connecting to bin.entware.net (81.4.123.217:80)
libpthread-2.27.so   100% |*************************************************************************************************************|  116k  0:00:00 ETA
Info: Basic packages installation...
Downloading http://bin.entware.net/mipssf-k3.4/Packages.gz
Updated list of available packages in /opt/var/opkg-lists/entware
Installing entware-opt (227000-3) to root...
Downloading http://bin.entware.net/mipssf-k3.4/entware-opt_227000-3_all.ipk
Installing libc (2.27-8) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libc_2.27-8_mips-3.4.ipk
Installing libgcc (7.3.0-8) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libgcc_7.3.0-8_mips-3.4.ipk
Installing libssp (7.3.0-8) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libssp_7.3.0-8_mips-3.4.ipk
Installing librt (2.27-8) to root...
Downloading http://bin.entware.net/mipssf-k3.4/librt_2.27-8_mips-3.4.ipk
Installing libpthread (2.27-8) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libpthread_2.27-8_mips-3.4.ipk
Installing libstdcpp (7.3.0-8) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libstdcpp_7.3.0-8_mips-3.4.ipk
Installing entware-release (1.0-2) to root...
Downloading http://bin.entware.net/mipssf-k3.4/entware-release_1.0-2_all.ipk
Installing zoneinfo-asia (2018g-1) to root...
Downloading http://bin.entware.net/mipssf-k3.4/zoneinfo-asia_2018g-1_mips-3.4.ipk
Installing zoneinfo-europe (2018g-1) to root...
Downloading http://bin.entware.net/mipssf-k3.4/zoneinfo-europe_2018g-1_mips-3.4.ipk
Installing findutils (4.6.0-1) to root...
Downloading http://bin.entware.net/mipssf-k3.4/findutils_4.6.0-1_mips-3.4.ipk
Installing terminfo (6.1-1) to root...
Downloading http://bin.entware.net/mipssf-k3.4/terminfo_6.1-1_mips-3.4.ipk
Installing locales (2.27-8) to root...
Downloading http://bin.entware.net/mipssf-k3.4/locales_2.27-8_mips-3.4.ipk
Installing grep (3.1-1) to root...
Downloading http://bin.entware.net/mipssf-k3.4/grep_3.1-1_mips-3.4.ipk
Installing libpcre (8.42-1) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libpcre_8.42-1_mips-3.4.ipk
Installing opkg (2011-04-08-9c97d5ec-17c) to root...
Downloading http://bin.entware.net/mipssf-k3.4/opkg_2011-04-08-9c97d5ec-17c_mips-3.4.ipk
Installing entware-upgrade (1.0-1) to root...
Downloading http://bin.entware.net/mipssf-k3.4/entware-upgrade_1.0-1_all.ipk
Configuring libgcc.
Configuring libc.
Configuring libssp.
Configuring libpthread.
Configuring librt.
Configuring terminfo.
Configuring libpcre.
Configuring grep.
Configuring locales.
Entware uses separate locale-archive file independent from main system
Creating locale archive - /opt/usr/lib/locale/locale-archive
Adding en_EN.UTF-8
Killed
Adding ru_RU.UTF-8
Killed
locale-archive file was not created, not enough memory? Downloading...
checking endianess....
Byte Order: big endian.
BE detected
Connecting to pkg.entware.net (81.4.123.217:80)
locale-archive       100% |*************************************************************************************************************| 2863k  0:00:00 ETA
You can download locale sources from http://pkg.entware.net/sources/i18n_glib227.tar.gz
You can add new locales to Entware using /opt/bin/localedef.new
Configuring entware-upgrade.
Upgrade operations are not required
Configuring opkg.
Configuring zoneinfo-europe.
Configuring zoneinfo-asia.
Configuring libstdcpp.
Configuring entware-release.
Configuring findutils.
Configuring entware-opt.
Info: Congratulations!
Info: If there are no errors above then Entware was successfully initialized.
Info: Add /opt/bin & /opt/sbin to your PATH variable
Info: Add '/opt/etc/init.d/rc.unslung start' to startup script for Entware services to start
Info: Found a Bug? Please report at https://github.com/Entware/Entware/issues
root@My:/opt#


Примечание
- пути PATH в порядке
- "/opt/etc/init.d/rc.unslung start" как писал выше будем запускать по старинке

4.
Code:

opkg update
opkg upgrade
Sponsor
vasek00
DD-WRT Guru


Joined: 06 Nov 2010
Posts: 3312

PostPosted: Sat Jan 12, 2019 10:34    Post subject: Re: Entware на Atheros чипе для роутера Reply with quote
Так как не во всех роутерах имеется возможность использовать dnscrypt-proxy то теперь используя Entware можно поставить данный сервис.

1. Необходимо установить
Code:
opkg install dnscrypt-proxy
opkg install net-tools-netstat


Примечание при установки спросит указать сервер из списка например
Code:
1) adguard-dns-family-ns1 ("Adguard DNS Family Protection 1")
2) adguard-dns-family-ns2 ("Adguard DNS Family Protection 2")
3) adguard-dns-ns1 ("Adguard DNS 1")
4) adguard-dns-ns2 ("Adguard DNS 2")

поставив цифру 1.

Для удобства работы установленную утилиту "netstat" из Entware переименуем в "netstat_o" так как в прошивке уже есть, но она урезанная по функционалу, а нам нужно по более
Code:

cd /opt/bin
mv netstat netstat_o


2. Настроим связку текущего DnsMasq (который отвечает за работу DNS и DHCP сервера) + dnscrypt-proxy
Скрины DnsMasq ниже.

- Что нужно добавить в секцию "Additional DNSMasq Options"
Code:
no-resolv
bind-interfaces
server=127.0.0.1#65030
addn-hosts=/opt/tmp/StevenBlack
addn-hosts=/opt/tmp/anti_webm.hosts
#log-queries
#log-facility=/opt/var/log/dnsmasq.log
#log-async=25

На время отладки убрать значек "#" в начале строк, а потом когда все будет работать его вернуть.

- Настроим dnscrypt-proxy, его запускающий файл находиться в /opt/etc/init.d с именем "S09dnscrypt-proxy" подправим его любыми подручными средствами
Code:

#!/bin/sh

ENABLED=yes
PROCS=dnscrypt-proxy
ARGS="--local-address=127.0.0.1:65030 --daemonize -R adguard-dns-family-ns1 -l /opt/var/log/dnscrypt-proxy.65030.log –edns-payload-size=1252"
PREARGS=""
DESC=
PATH=/opt/sbin:/opt/bin:/opt/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

. /opt/etc/init.d/rc.func


127.0.0.1:65030 = работать на данном порту
-l /opt/var/log/dnscrypt-proxy.65030.log = вести лог, после отладки можно убрать, а чтоб не забыть как это делается если нужно будет вернуться то
Code:

#!/bin/sh

ENABLED=yes
PROCS=dnscrypt-proxy
ARGS="--local-address=127.0.0.1:65030 --daemonize -R adguard-dns-family-ns1 –edns-payload-size=1252"
PREARGS=""
DESC=
PATH=/opt/sbin:/opt/bin:/opt/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

. /opt/etc/init.d/rc.func

#ARGS="--local-address=127.0.0.1:65030 --daemonize -R adguard-dns-family-ns1 -l /opt/var/log/dnscrypt-proxy.65030.log –edns-payload-size=1252"


–edns-payload-size=1252 описывать не буду, можно найти в интернете

3. подправим файл hosts который в прошивке а точнее его размещение для сервисов Entware, подправив наш startup файл который был ранее

Code:

sleep 10;
mv /tmp/hosts /opt/etc/hosts;
ln -s /opt/etc/hosts /tmp/hosts;
./opt/etc/init.d/rc.unslung start;


4. Перезагрузим роутер и проверим запуск наших сервисов

5. выполним
Code:

root@My:/opt/etc/init.d# ps | grep dns
 1178 root      7888 S    dnsmasq -u root -g root --conf-file=/tmp/dnsmasq.conf --cache-size=1500 --dhcp-option=252," "
 1472 root      4092 S    dnscrypt-proxy --local-address=127.0.0.1:65030 --daemonize -R adguard-dns-family-ns1 -l /opt/var/log/dnscrypt-proxy.65030.log –
root@My:/opt/etc/init.d#

root@My:/opt/etc/init.d# netstat_o -ntulp | grep dns
tcp        0      0 127.0.0.1:65030         0.0.0.0:*               LISTEN      1472/dnscrypt-proxy
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      1178/dnsmasq       
tcp        0      0 192.168.130.99:53       0.0.0.0:*               LISTEN      1178/dnsmasq       
udp        0      0 127.0.0.1:65030         0.0.0.0:*                           1472/dnscrypt-proxy
udp        0      0 127.0.0.1:53            0.0.0.0:*                           1178/dnsmasq       
udp        0      0 192.168.130.99:53       0.0.0.0:*                           1178/dnsmasq       
udp        0      0 0.0.0.0:67              0.0.0.0:*                           1178/dnsmasq       
udp        0      0 0.0.0.0:36982           0.0.0.0:*                           1472/dnscrypt-proxy
root@My:/opt/etc/init.d#

и так видим что нам нужно
Code:
tcp/127.0.0.1:65030 - dnscrypt-proxy
tcp/127.0.0.1:53 - dnsmasq       
tcp/192.168.130.99:53 - dnsmasq       
udp/127.0.0.1:65030 - dnscrypt-proxy
udp/127.0.0.1:53 - dnsmasq       
udp/192.168.130.99:53 - dnsmasq       

сервис dnsmasq на нужных портах 53 и IP, серевис dnscryp-proxy так же на выбранном нами порту и IP
Так же можно посмотреть на log (которые у нас были включены в конфигах, для отладки)
Code:
cd /opt/var/log
cat dnscrypt-proxy.65030.log
Sat Jan 12 12:54:54 2019 [NOTICE] Starting dnscrypt-proxy 1.9.5
Sat Jan 12 12:54:54 2019 [INFO] Generating a new session key pair
Sat Jan 12 12:54:54 2019 [INFO] Done
Sat Jan 12 12:54:54 2019 [INFO] Server certificate with serial #1542717057 received
Sat Jan 12 12:54:54 2019 [INFO] This certificate is valid
Sat Jan 12 12:54:54 2019 [INFO] Chosen certificate #1542717057 is valid from [2018-11-20] to [2019-11-20]
Sat Jan 12 12:54:54 2019 [INFO] The key rotation period for this server may exceed the recommended value. This is bad for forward secrecy.
Sat Jan 12 12:54:54 2019 [INFO] Server key fingerprint is 3215:..............:B406
Sat Jan 12 12:54:54 2019 [NOTICE] Proxying from 127.0.0.1:65030 to 176.103.130.132:5443

где 176.103.130.132:5443 адрес и порт выбранного нами сервера

cat dnsmasq.log
...
Jan 12 12:18:30 dnsmasq[1538]: using nameserver 127.0.0.1#65030
...
Jan 12 12:18:30 dnsmasq[1538]: read /opt/tmp/anti_webm.hosts - 366 addresses
Jan 12 12:18:34 dnsmasq[1538]: read /opt/tmp/StevenBlack - 76647 addresses
Jan 12 12:19:03 dnsmasq[1538]: query[A] suggest.yandex.ru from 192.168.130.100
Jan 12 12:19:03 dnsmasq[1538]: forwarded suggest.yandex.ru to 127.0.0.1
Jan 12 12:19:03 dnsmasq[1538]: reply suggest.yandex.ru is <CNAME>
...

опять же видим использование "using nameserver 127.0.0.1#65030" в запрос нашего dnscryp-proxy


Более продвинутый dnscrypt-proxy2 (релиз 2) запускался но отказывался работать на настроенном порту, т.е. его там просто не было.
vasek00
DD-WRT Guru


Joined: 06 Nov 2010
Posts: 3312

PostPosted: Sat Jan 12, 2019 10:37    Post subject: Re: Entware на Atheros чипе для роутера Reply with quote
Два файла для блокировки
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Использование и установка DD-WRT All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum