До последнего времени у меня были настроены и прекрасно работали подключения ByFly как платное по тарифу "Плюс 2", так и гостевое. Оба pppoe-соединения подняты на роутере. Недавно узнал о сервисе FastBy.net, заинтересовался и решил подключиться.
Так как компьютеров несколько, openvpn буду "поднимать" на роутере.
Установка OpenVPN
Заходим по ssh на роутер:
[~]%ssh admin@192.168.1.1
Устанавливаем пакет openvpn:
[admin@wl500gP root]$ ipkg install openvpn
Файлы из директории /opt/etc/openvpn удаляем, особо мнительные, вроде меня, сохраняют на всякий случай.
mv /opt/etc/openvpn /opt/etc/openvpn.bak/
mkdir /opt/etc/openvpn
Скачиваем архив с индивидуальными настройками пользователя (напримере моего аккаунта) и распаковываем, мне удобнее это сделать на компьютере, хотя ничто не должно помешать выполнить дальнейшие действия прямо на роутере:
[~/Desktop]%ls -l lupoalberto.tgz
-rw-r--r-- 1 lupo users 7249 Сен 18 17:25 lupoalberto.tgz
[~/Desktop]%mkdir openvpn
[~/Desktop]%tar xzvpf lupoalberto.tgz -C openvpn
lupoalberto/
lupoalberto/dh2048.pem
lupoalberto/del_routes.bat
lupoalberto/lupoalberto.conf
lupoalberto/ca.crt
lupoalberto/lupoalberto.ovpn
lupoalberto/lupoalberto.crt
lupoalberto/add_routes.bat
lupoalberto/lupoalberto.key
[~/Desktop]%cd openvpn/lupoalberto
[~/Desktop/openvpn/lupoalberto]%
Приводим файлы add_routes.bat,del_routes.bat к Linux-нотации, для приятного взгляду линуксоида вида меняем права доступа и расширение:
sed -e '1d' -e 's/\%SystemRoot\%\\system32\\route\.exe/route/g' -e 's/p/net/g' -e 's/mask/netmask/g' add_routes.bat | awk '{print $1,$2,$3,$4,$5,$6,"gw",$7}' | sed -e '1i \#!/bin/sh' > add_routes.sh
sed -e '1d' -e 's/\%SystemRoot\%\\system32\\route\.exe delete/route del/g' -e 's/p/net/g' -e 's/mask/netmask/g' del_routes.bat | awk '{print $1,$2,$3,$4,$5,$6,"gw",$7}' | sed -e '1i \#!/bin/sh' > del_routes.sh
chmod 750 *.sh
rm -f *\.bat
В соответствии с традициями Linux (что делать, в принципе, не обязательно) изменяем в файле lupoalberto.conf строки, содержащие add_routes.bat и del_routes.bat на add_routes.sh и del_routes.sh, а также меняем имя группы, под которой будет запускаться openvpn с nogroup на nobody, так как на роутере этой группы нет :
mv lupoalberto.conf{,.bak}
sed -e 's/nogroup/nobody/' -e 's/bat/sh/g' lupoalberto.conf.bak > lupoalberto.conf
rm -f lupoalberto.conf.bak
Файл lupoalberto.ovpn удаляем, у нас Linux.
rm -f lupoalberto.ovpn
Копируем файлы на роутер:
scp * admin@192.168.1.1:/opt/etc/openvpn/
Для соответствия скриптам инициализации пакета openvpn, установленного на роутере, создаём символическую ссылку:
ssh admin@192.168.1.1 'cd /opt/etc/openvpn && ln -s lupoalberto.conf openvpn.conf'
Строку запуска openvpn приводим к виду:
/opt/sbin/openvpn --daemon --cd /opt/etc/openvpn --config openvpn.conf --log-append /opt/var/log/openvpn/openvpn.log
При анализе логов было замечена "ругань" команды route на несоответствие адреса сети сетевой маске. Пришлось в скриптах add_routes.sh и del_routes.sh закомментировать строки
#route add -net 188.128.84.0 netmask 255.255.248.0 gw 172.22.3.201и
#route del -net 188.128.84.0 netmask 255.255.248.0 gw 172.22.3.201соответственно.
Команда route показывает:
[admin@wl500gP root]$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
86.57.251.28 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
193.232.248.80 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
82.209.245.151 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
82.209.195.15 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
194.158.206.240 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
194.67.23.154 172.22.3.201 255.255.255.255 UGH 0 0 0 tun0
194.158.206.241 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
194.67.57.150 172.22.3.201 255.255.255.255 UGH 0 0 0 tun0
194.158.206.246 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
87.233.189.5 172.22.3.201 255.255.255.255 UGH 0 0 0 tun0
82.209.213.109 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
82.209.213.109 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
87.242.118.10 172.22.3.201 255.255.255.255 UGH 0 0 0 tun0
82.209.213.60 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
87.242.118.20 172.22.3.201 255.255.255.255 UGH 0 0 0 tun0
82.209.213.51 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
91.149.157.74 172.22.3.201 255.255.255.255 UGH 0 0 0 tun0
82.209.213.113 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
89.111.188.16 172.22.3.201 255.255.255.255 UGH 0 0 0 tun0
86.57.253.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
194.158.202.59 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
172.22.3.201 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
193.232.248.79 0.0.0.0 255.255.255.255 UH 0 0 0 ppp1
194.67.23.196 172.22.3.201 255.255.255.255 UGH 0 0 0 tun0
217.21.32.48 172.22.3.201 255.255.255.240 UG 0 0 0 tun0
86.57.151.0 0.0.0.0 255.255.255.224 U 0 0 0 ppp1
195.239.157.0 172.22.3.201 255.255.255.224 UG 0 0 0 tun0
91.149.189.128 0.0.0.0 255.255.255.192 U 0 0 0 ppp1
195.222.166.192 172.22.3.201 255.255.255.192 UG 0 0 0 tun0
81.177.30.0 172.22.3.201 255.255.255.128 UG 0 0 0 tun0
91.149.157.0 0.0.0.0 255.255.255.128 U 0 0 0 ppp1
91.149.157.128 172.22.3.201 255.255.255.128 UG 0 0 0 tun0
91.149.189.0 0.0.0.0 255.255.255.128 U 0 0 0 ppp1
93.125.8.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
217.69.130.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
91.149.155.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
194.186.55.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
93.125.56.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
91.149.187.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
217.21.33.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
194.186.160.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
195.222.187.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
217.21.48.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
91.149.174.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
217.21.54.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
79.98.54.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
87.252.247.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
79.98.53.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
91.149.172.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
212.119.208.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
87.252.228.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
81.176.235.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
217.21.52.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
213.184.232.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
87.252.245.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
81.177.142.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
91.198.174.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
87.252.250.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
81.177.143.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
213.184.230.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
93.125.51.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
217.21.57.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
81.177.140.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
81.177.156.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
91.149.176.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
194.158.194.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
87.252.232.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
87.252.248.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
193.232.92.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
81.177.141.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
194.158.195.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
213.184.244.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
93.125.53.0 0.0.0.0 255.255.255.0 U 0 0 0 ppp1
93.125.70.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
93.125.5.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
217.21.62.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
91.149.167.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
213.184.242.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
93.125.6.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
93.125.55.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
212.119.216.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
81.176.227.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
213.184.241.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
86.57.246.0 0.0.0.0 255.255.255.0 U 0 0 0 ppp1
195.239.7.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
217.21.44.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
91.149.132.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
91.149.165.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
87.252.237.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
86.57.247.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
87.252.253.0 172.22.3.201 255.255.255.0 UG 0 0 0 tun0
93.125.40.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
217.21.50.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
93.125.74.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
213.184.238.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
93.125.10.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
213.184.236.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
91.149.158.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
91.149.190.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
213.184.234.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
91.149.178.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
93.125.2.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
213.184.228.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
87.252.254.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
93.125.38.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
217.21.60.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
93.125.68.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
93.125.24.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
91.149.170.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
86.57.248.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
86.57.250.0 0.0.0.0 255.255.254.0 U 0 0 0 ppp1
87.252.230.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
93.125.48.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
87.252.234.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
213.184.246.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
91.149.128.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
217.21.46.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
87.252.238.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
86.57.244.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
194.226.124.0 172.22.3.201 255.255.254.0 UG 0 0 0 tun0
194.186.176.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
87.252.240.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
93.125.12.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
93.125.64.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
193.232.248.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
91.149.180.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
87.252.224.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
86.57.252.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
93.125.16.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
194.226.120.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
86.57.240.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
93.125.20.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
195.218.180.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
208.80.152.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
213.184.224.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
217.21.36.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
93.125.60.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
213.184.248.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
217.21.40.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
193.151.40.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
77.74.32.0 172.22.3.201 255.255.252.0 UG 0 0 0 tun0
93.84.120.0 172.22.3.201 255.255.248.0 UG 0 0 0 tun0
93.84.112.0 0.0.0.0 255.255.248.0 U 0 0 0 ppp1
79.170.104.0 172.22.3.201 255.255.248.0 UG 0 0 0 tun0
91.149.144.0 172.22.3.201 255.255.248.0 UG 0 0 0 tun0
91.149.136.0 172.22.3.201 255.255.248.0 UG 0 0 0 tun0
81.25.32.0 172.22.3.201 255.255.240.0 UG 0 0 0 tun0
80.249.80.0 172.22.3.201 255.255.240.0 UG 0 0 0 tun0
86.57.224.0 172.22.3.201 255.255.240.0 UG 0 0 0 tun0
93.84.96.0 172.22.3.201 255.255.240.0 UG 0 0 0 tun0
217.23.112.0 172.22.3.201 255.255.240.0 UG 0 0 0 tun0
84.201.224.0 172.22.3.201 255.255.240.0 UG 0 0 0 tun0
81.30.80.0 172.22.3.201 255.255.240.0 UG 0 0 0 tun0
80.94.224.0 172.22.3.201 255.255.240.0 UG 0 0 0 tun0
94.100.176.0 172.22.3.201 255.255.240.0 UG 0 0 0 tun0
172.22.0.0 172.22.3.201 255.255.240.0 UG 0 0 0 tun0
80.94.160.0 172.22.3.201 255.255.240.0 UG 0 0 0 tun0
93.186.224.0 172.22.3.201 255.255.240.0 UG 0 0 0 tun0
172.22.16.0 172.22.3.201 255.255.240.0 UG 0 0 0 tun0
91.187.0.0 172.22.3.201 255.255.224.0 UG 0 0 0 tun0
195.50.0.0 172.22.3.201 255.255.224.0 UG 0 0 0 tun0
93.84.64.0 172.22.3.201 255.255.224.0 UG 0 0 0 tun0
212.98.160.0 172.22.3.201 255.255.224.0 UG 0 0 0 tun0
194.158.192.0 172.22.3.201 255.255.224.0 UG 0 0 0 tun0
62.105.128.0 172.22.3.201 255.255.224.0 UG 0 0 0 tun0
86.57.192.0 172.22.3.201 255.255.224.0 UG 0 0 0 tun0
212.44.128.0 172.22.3.201 255.255.224.0 UG 0 0 0 tun0
195.222.64.0 172.22.3.201 255.255.224.0 UG 0 0 0 tun0
93.84.0.0 172.22.3.201 255.255.192.0 UG 0 0 0 tun0
86.57.128.0 172.22.3.201 255.255.192.0 UG 0 0 0 tun0
82.209.192.0 172.22.3.201 255.255.192.0 UG 0 0 0 tun0
93.84.128.0 172.22.3.201 255.255.128.0 UG 0 0 0 tun0
205.188.0.0 172.22.3.201 255.255.0.0 UG 0 0 0 tun0
93.85.0.0 172.22.3.201 255.255.0.0 UG 0 0 0 tun0
64.12.0.0 172.22.3.201 255.255.0.0 UG 0 0 0 tun0
1.0.0.0 172.22.3.201 255.0.0.0 UG 0 0 0 tun0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 82.209.213.109 0.0.0.0 UG 0 0 0 ppp0
Команда ifconfig
[admin@wl500gP root]$ ifconfig
br0 Link encap:Ethernet HWaddr 00:1B:FC:D4:67:D8
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::21b:fcff:fed4:67d8/10 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2375 errors:0 dropped:0 overruns:0 frame:0
TX packets:2178 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:183595 (179.2 KiB) TX bytes:579424 (565.8 KiB)
eth0 Link encap:Ethernet HWaddr 00:1B:FC:D4:67:D8
inet6 addr: fe80::21b:fcff:fed4:67d8/10 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2207 errors:0 dropped:0 overruns:0 frame:0
TX packets:2514 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:301261 (294.2 KiB) TX bytes:427719 (417.6 KiB)
Interrupt:4 Base address:0x1000
eth1 Link encap:Ethernet HWaddr 00:1B:FC:D4:67:D8
inet6 addr: fe80::21b:fcff:fed4:67d8/10 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2370 errors:0 dropped:0 overruns:0 frame:190
TX packets:2186 errors:4 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:216295 (211.2 KiB) TX bytes:598010 (583.9 KiB)
Interrupt:12 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MULTICAST MTU:16436 Metric:1
RX packets:3361 errors:0 dropped:0 overruns:0 frame:0
TX packets:3361 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:287215 (280.4 KiB) TX bytes:287215 (280.4 KiB)
ppp0 Link encap:Point-Point Protocol
inet addr:93.84.63.54 P-t-P:82.209.213.109 Mask:255.255.255.255
UP POINTOPOINT RUNNING MULTICAST MTU:1492 Metric:1
RX packets:266 errors:0 dropped:0 overruns:0 frame:0
TX packets:224 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:88847 (86.7 KiB) TX bytes:21532 (21.0 KiB)
ppp1 Link encap:Point-Point Protocol
inet addr:1.5.12.205 P-t-P:82.209.213.113 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:795 errors:0 dropped:0 overruns:0 frame:0
TX packets:690 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:102224 (99.8 KiB) TX bytes:61489 (60.0 KiB)
tun0 Link encap:Point-Point Protocol
inet addr:172.22.3.202 P-t-P:172.22.3.201 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:706 (706.0 B) TX bytes:1800 (1.7 KiB)
vlan0 Link encap:Ethernet HWaddr 00:1B:FC:D4:67:D8
inet6 addr: fe80::21b:fcff:fed4:67d8/10 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:1310 (1.2 KiB)
vlan1 Link encap:Ethernet HWaddr 00:1B:FC:D4:67:D8
inet6 addr: fe80::21b:fcff:fed4:67d8/10 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2207 errors:0 dropped:0 overruns:0 frame:0
TX packets:2499 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:261535 (255.4 KiB) TX bytes:426261 (416.2 KiB)
Команда netstat
[admin@wl500gP root]$ netstat -ln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:9100 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:53 0.0.0.0:* LISTEN
tcp 0 0 :::22 :::* LISTEN
udp 0 0 0.0.0.0:1024 0.0.0.0:*
udp 0 0 0.0.0.0:1029 0.0.0.0:*
udp 0 0 127.0.0.1:34954 0.0.0.0:*
udp 0 0 0.0.0.0:53 0.0.0.0:*
udp 0 0 0.0.0.0:67 0.0.0.0:*
raw 0 0 0.0.0.0:1 0.0.0.0:* 0
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 1079 /dev/log
Команда ping
Проверка доступности DNS-серверов
[admin@wl500gP root]$ cat /etc/resolv.conf
nameserver 82.209.213.60
nameserver 82.209.213.51
[admin@wl500gP root]$ ping -c 3 82.209.213.60
PING 82.209.213.60 (82.209.213.60): 56 data bytes
84 bytes from 82.209.213.60: icmp_seq=0 ttl=61 time=14.4 ms
84 bytes from 82.209.213.60: icmp_seq=1 ttl=61 time=17.5 ms
84 bytes from 82.209.213.60: icmp_seq=2 ttl=61 time=17.2 ms
--- 82.209.213.60 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 14.4/16.3/17.5 ms
[admin@wl500gP root]$ ping -c 3 82.209.213.51
PING 82.209.213.51 (82.209.213.51): 56 data bytes
84 bytes from 82.209.213.51: icmp_seq=0 ttl=62 time=17.7 ms
84 bytes from 82.209.213.51: icmp_seq=1 ttl=62 time=16.3 ms
84 bytes from 82.209.213.51: icmp_seq=2 ttl=62 time=16.4 ms
--- 82.209.213.51 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 16.3/16.8/17.7 ms
Пинг сервера VPN-сети
[admin@wl500gP tmp]$ ping -c 3 172.22.0.1
PING 172.22.0.1 (172.22.0.1): 56 data bytes
84 bytes from 172.22.0.1: icmp_seq=0 ttl=64 time=27.1 ms
84 bytes from 172.22.0.1: icmp_seq=1 ttl=64 time=29.9 ms
84 bytes from 172.22.0.1: icmp_seq=2 ttl=64 time=29.3 ms
--- 172.22.0.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 27.1/28.7/29.9 ms
[admin@wl500gP tmp]$ ping -c 3 91.149.157.74
PING 91.149.157.74 (91.149.157.74): 56 data bytes
84 bytes from 91.149.157.74: icmp_seq=0 ttl=62 time=29.1 ms
84 bytes from 91.149.157.74: icmp_seq=1 ttl=62 time=28.7 ms
84 bytes from 91.149.157.74: icmp_seq=2 ttl=62 time=28.2 ms
--- 91.149.157.74 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 28.2/28.6/29.1 ms
Проверка доступности различных сайтов, включённых в список доступных по VPN.
[admin@wl500gP tmp]$ ping -c 2 shara.by
PING shara.by (213.184.225.61): 56 data bytes
84 bytes from 213.184.225.61: icmp_seq=0 ttl=60 time=32.0 ms
84 bytes from 213.184.225.61: icmp_seq=1 ttl=60 time=31.8 ms
--- shara.by ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 31.8/31.9/32.0 ms
[admin@wl500gP tmp]$ ping -c 2 torrents.by
PING torrents.by (91.149.157.74): 56 data bytes
84 bytes from 91.149.157.74: icmp_seq=0 ttl=62 time=30.3 ms
84 bytes from 91.149.157.74: icmp_seq=1 ttl=62 time=28.1 ms
--- torrents.by ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 28.1/29.2/30.3 ms
[admin@wl500gP tmp]$ ping -c 2 one.by
PING one.by (86.57.250.69): 56 data bytes
84 bytes from 86.57.250.69: icmp_seq=0 ttl=57 time=29.5 ms
84 bytes from 86.57.250.69: icmp_seq=1 ttl=57 time=24.0 ms
--- one.by ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 24.0/26.7/29.5 ms
[admin@wl500gP tmp]$ ping -c 2 www.allhit.by
PING www.allhit.by (195.222.70.210): 56 data bytes
84 bytes from 195.222.70.210: icmp_seq=0 ttl=58 time=29.5 ms
84 bytes from 195.222.70.210: icmp_seq=1 ttl=58 time=30.9 ms
--- www.allhit.by ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 29.5/30.2/30.9 ms
А теперь о проблемах.
Конфигурация сетевых настроек ноутбука:
#route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 304 0 0 wlan0
127.0.0.0 127.0.0.1 255.0.0.0 UG 0 0 0 lo
0.0.0.0 192.168.1.1 0.0.0.0 UG 304 0 0 wlan0
#ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:d4:2c:f8:d7
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:10 Base address:0xe000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:16422 errors:0 dropped:0 overruns:0 frame:0
TX packets:16422 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6770074 (6.4 MiB) TX bytes:6770074 (6.4 MiB)
wlan0 Link encap:Ethernet HWaddr 00:18:de:78:63:7e
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25106 errors:0 dropped:0 overruns:0 frame:0
TX packets:26781 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15857363 (15.1 MiB) TX bytes:3253587 (3.1 MiB)
wmaster0 Link encap:UNSPEC HWaddr 00-18-DE-78-63-7E-00-00-00-00-00-00-00-00-00-00
UP RUNNING MTU:0 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
#iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
UPDATED
Забыл добавить правила iptables для поднятого tun0 интерфейса.
В конец файла add_routes.sh следует добавить
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
и в файл del_routes.sh
iptables -t nat -D POSTROUTING -o tun0 -j MASQUERADE
То есть теперь преобразование скриптов add_routes.bat и del_routes.bat выглядит так:
sed -e '1d' -e 's/\%SystemRoot\%\\system32\\route\.exe/route/g' -e 's/p/net/g' -e 's/mask/netmask/g' add_routes.bat | awk '{print $1,$2,$3,$4,$5,$6,"gw",$7}' | sed -e '1i \#!/bin/sh' -e '$a \iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE' > add_routes.shи
sed -e '1d' -e 's/\%SystemRoot\%\\system32\\route\.exe delete/route del/g' -e 's/p/net/g' -e 's/mask/netmask/g' del_routes.bat | awk '{print $1,$2,$3,$4,$5,$6,"gw",$7}' | sed -e '1i \#!/bin/sh' -e '$a \iptables -t nat -D POSTROUTING -o tun0 -j MASQUERADE' > del_routes.sh
Комментариев нет:
Отправить комментарий