Настройка OpenVPN для OpenWrt v=19.07.4 через console
Настройка OpenVPN для OpenWrt через console производилась на OpenWrt 19.07.4
Подключаемся по ssh
Под Linux используем консольную команду ssh root@192.168.1.1
Под Windows качаем Putty
и подключаемся по адресу 192.168.1.1
root@OpenWrt:~# cat /etc/banner
----------------------------------------------------- OpenWrt 19.07.4 -----------------------------------------------------
проверяем интернетwget -qO- http://openwrt.su/ip
Установка необходимых пакетов
Далее на пунке nano 1vpns.ovpn нужно скопировать и вставить впн конфигурацию для Windows взятую с ЛК 1vpns.com
(CTRL+V в Putty не работает, для того чтобы вставить текст нужно использовать комбинацию клавишь SHIFT+INSERT и чтобы сохранить нужно нажать CTRL+X, нажать Y и нажать ENTER)
Поехали!
opkg update
opkg install openvpn-openssl luci-app-openvpn nano
cd /etc/openvpnnano 1vpns.ovpn
uci set openvpn.1vpns=openvpnuci set openvpn.1vpns.enabled='1'uci set openvpn.1vpns.config='/etc/openvpn/1vpns.ovpn'uci commit openvpn
uci set network.1vpnstun=interfaceuci set network.1vpnstun.proto='none'uci set network.1vpnstun.ifname='tun0'uci commit network
uci -q delete firewall.vpnuci set firewall.vpn="zone"uci set firewall.vpn.name="vpn"uci set firewall.vpn.input="REJECT"uci set firewall.vpn.output="ACCEPT"uci set firewall.vpn.forward="REJECT"uci set firewall.vpn.masq="1"uci set firewall.vpn.mtu_fix="1"uci -q delete firewall.lan_vpnuci set firewall.lan_vpn="forwarding"uci set firewall.lan_vpn.src="lan"uci set firewall.lan_vpn.dest="vpn"uci del_list firewall.wan.device="tun0"uci add_list firewall.vpn.device="tun0"uci set firewall.lan_wan.enabled="0"uci commit firewall/etc/init.d/firewall restart
cat << "EOF" > /etc/openvpn/dnsviavpn.sh#!/bin/shenv | sed -n -e "/^foreign_option_.*=dhcp-option.*DNS/s//nameserver/p/^foreign_option_.*=dhcp-option.*DOMAIN/s//search/p" | sort -u > /tmp/resolv.conf.vpncase ${script_type} in(up) uci set dhcp.@dnsmasq[0].resolvfile="/tmp/resolv.conf.vpn" ;;(down) uci revert dhcp ;;esac/etc/init.d/dnsmasq restart &EOFchmod +x /etc/openvpn/dnsviavpn.sh sed -i -e "/^script-security/s/^/#/\$a script-security 2/^up/s/^/#/\$a up /etc/openvpn/dnsviavpn.sh/^down/s/^/#/\$a down /etc/openvpn/dnsviavpn.sh" /etc/openvpn/1vpns.ovpn/etc/init.d/openvpn restart
Настройка завершена, можно подключаться и все клиенты будут ходить через 1vpns.com сервис
Если необходимо включить switch kill то можно выполнить следующие команды:
#switch kill enable
uci set firewall.@zone[1].masq=0 uci commit firewall /etc/init.d/firewall restart /etc/init.d/openvpn restart reboot
Чтобы отключить switch kill нужно выполнить следующие команды:
#switch kill disable
uci -q delete firewall.vpnuci set firewall.vpn="zone"uci set firewall.vpn.name="vpn"uci set firewall.vpn.input="REJECT"uci set firewall.vpn.output="ACCEPT"uci set firewall.vpn.forward="REJECT"uci set firewall.vpn.masq="1"uci set firewall.vpn.mtu_fix="1"uci -q delete firewall.lan_vpnuci set firewall.lan_vpn="forwarding"uci set firewall.lan_vpn.src="lan"uci set firewall.lan_vpn.dest="vpn"uci del_list firewall.wan.device="tun0"uci add_list firewall.vpn.device="tun0"uci set firewall.lan_wan.enabled="0"uci commit firewall/etc/init.d/firewall restart
uci set firewall.@zone[1].masq=1 uci commit firewall /etc/init.d/firewall restart /etc/init.d/openvpn restart
На данном этапе настройка завершена!
Приятного пользования.

Tor v3
@FVPNS
support@1vpns.com
support@1vpns.com
82822222
EN
RU





