Компьютерный форум OSzone.net  

Компьютерный форум OSzone.net (http://forum.oszone.net/index.php)
-   Сетевые технологии (http://forum.oszone.net/forumdisplay.php?f=31)
-   -   OpenVPN - как в OVPN файле принудительно проставлять метрику маршрута? (http://forum.oszone.net/showthread.php?t=338389)

senglory 23-12-2018 23:27 2847898

OpenVPN - как в OVPN файле принудительно проставлять метрику маршрута?
 
OpenVPN client 2.3 Хочу чтобы установление соединения приводило к переназначению всего траффика на свежесозданный маршрут. Вникать в то, какой IP мне назначит сервер - не хочу, надо будет только метрику выставить, как я понимаю. Добавли в OVPN файл такую строку:
Цитата:

push "redirect-gateway def1"
Но все равно после установления соединения я в ФФ вижу свой до-ВПНовский адрес. Вот результирующая таблица маршрутизации:

Цитата:

===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.231.2 192.168.231.128 10
10.211.1.20 255.255.255.252 10.211.1.21 10.211.1.21 30
10.211.1.21 255.255.255.255 127.0.0.1 127.0.0.1 30
10.255.255.255 255.255.255.255 10.211.1.21 10.211.1.21 30
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
192.168.231.0 255.255.255.0 192.168.231.128 192.168.231.128 10
192.168.231.128 255.255.255.255 127.0.0.1 127.0.0.1 10
192.168.231.255 255.255.255.255 192.168.231.128 192.168.231.128 10
224.0.0.0 240.0.0.0 10.211.1.21 10.211.1.21 30
224.0.0.0 240.0.0.0 192.168.231.128 192.168.231.128 10
255.255.255.255 255.255.255.255 10.211.1.21 4 1
255.255.255.255 255.255.255.255 10.211.1.21 2 1
255.255.255.255 255.255.255.255 10.211.1.21 10007 1
255.255.255.255 255.255.255.255 10.211.1.21 10.211.1.21 1
255.255.255.255 255.255.255.255 192.168.231.128 192.168.231.128 1
Default Gateway: 192.168.231.2
===========================================================================

Сеть 10.XXX - это от ВПН. Как мне прямо в OVPN файле задать метрику?

Busla 24-12-2018 10:54 2847925

Цитата:

Цитата senglory
Вникать в то, какой IP мне назначит сервер - не хочу, надо будет только метрику выставить, как я понимаю. »

не понимаете

senglory, лучше выложите полные конфиги сервера и клиента

glestwid 24-12-2018 23:34 2848066

Вот мой OVPN файл

Цитата:

###############################################################################
# OpenVPN 2.0 Sample Configuration File
# for PacketiX VPN / SoftEther VPN Server
#
# !!! AUTO-GENERATED BY SOFTETHER VPN SERVER MANAGEMENT TOOL !!!
#
# !!! YOU HAVE TO REVIEW IT BEFORE USE AND MODIFY IT AS NECESSARY !!!
#
# This configuration file is auto-generated. You might use this config file
# in order to connect to the PacketiX VPN / SoftEther VPN Server.
# However, before you try it, you should review the descriptions of the file
# to determine the necessity to modify to suitable for your real environment.
# If necessary, you have to modify a little adequately on the file.
# For example, the IP address or the hostname as a destination VPN Server
# should be confirmed.
#
# Note that to use OpenVPN 2.0, you have to put the certification file of
# the destination VPN Server on the OpenVPN Client computer when you use this
# config file. Please refer the below descriptions carefully.


###############################################################################
# Specify the type of the layer of the VPN connection.
#
# To connect to the VPN Server as a "Remote-Access VPN Client PC",
# specify 'dev tun'. (Layer-3 IP Routing Mode)
#
# To connect to the VPN Server as a bridging equipment of "Site-to-Site VPN",
# specify 'dev tap'. (Layer-2 Ethernet Bridgine Mode)

dev tun


###############################################################################
# Specify the underlying protocol beyond the Internet.
# Note that this setting must be correspond with the listening setting on
# the VPN Server.
#
# Specify either 'proto tcp' or 'proto udp'.

proto tcp


###############################################################################
# The destination hostname / IP address, and port number of
# the target VPN Server.
#
# You have to specify as 'remote <HOSTNAME> <PORT>'. You can also
# specify the IP address instead of the hostname.
#
# Note that the auto-generated below hostname are a "auto-detected
# IP address" of the VPN Server. You have to confirm the correctness
# beforehand.
#
# When you want to connect to the VPN Server by using TCP protocol,
# the port number of the destination TCP port should be same as one of
# the available TCP listeners on the VPN Server.
#
# When you use UDP protocol, the port number must same as the configuration
# setting of "OpenVPN Server Compatible Function" on the VPN Server.

remote vpn566803988.opengw.net 1720

#push "route 192.168.0.0 255.255.254.0 vpn_gateway 100"
#route-metric 100
push "redirect-gateway route metric 3"

###############################################################################
# The HTTP/HTTPS proxy setting.
#
# Only if you have to use the Internet via a proxy, uncomment the below
# two lines and specify the proxy address and the port number.
# In the case of using proxy-authentication, refer the OpenVPN manual.

;http-proxy-retry
;http-proxy [proxy server] [proxy port]


###############################################################################
# The encryption and authentication algorithm.
#
# Default setting is good. Modify it as you prefer.
# When you specify an unsupported algorithm, the error will occur.
#
# The supported algorithms are as follows:
# cipher: [NULL-CIPHER] NULL AES-128-CBC AES-192-CBC AES-256-CBC BF-CBC
# CAST-CBC CAST5-CBC DES-CBC DES-EDE-CBC DES-EDE3-CBC DESX-CBC
# RC2-40-CBC RC2-64-CBC RC2-CBC
# auth: SHA SHA1 MD5 MD4 RMD160

cipher AES-128-CBC
auth SHA1


###############################################################################
# Other parameters necessary to connect to the VPN Server.
#
# It is not recommended to modify it unless you have a particular need.

resolv-retry infinite
nobind
persist-key
persist-tun
client
verb 3
#auth-user-pass


###############################################################################
# The certificate file of the destination VPN Server.
#
# The CA certificate file is embedded in the inline format.
# You can replace this CA contents if necessary.
# Please note that if the server certificate is not a self-signed, you have to
# specify the signer's root certificate (CA) here.

<ca>
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----

</ca>


###############################################################################
# The client certificate file (dummy).
#
# In some implementations of OpenVPN Client software
# (for example: OpenVPN Client for iOS),
# a pair of client certificate and private key must be included on the
# configuration file due to the limitation of the client.
# So this sample configuration file has a dummy pair of client certificate
# and private key as follows.


Серверу я не хозяин, так что не в курсе что и как там

Busla 25-12-2018 11:08 2848135

Цитата:

Цитата glestwid
Серверу я не хозяин, так что не в курсе что и как там »

ну так
Код:

push "redirect-gateway def1"
на серверной стороне указывается

уберите последний фрагмент из вашего поста, который в тэгах key (хотя можно убрать и всё начиная с <ca>) и сообщите хозяину сервера, что спалили свой приватный ключ, чтобы он его отозвал и выдал новый сертификат

glestwid 25-12-2018 20:54 2848244

Так что, никакими действиями на своей стороне в OVPN файле я не могу сделать маршрут свежеустановленного соединения как самый приоритетный?

mwz 25-12-2018 22:05 2848264

Цитата:

Цитата glestwid
никакими действиями на своей стороне в OVPN файле я не могу сделать моршрут свежеустановленного соединения как самый приоритетный? »

Приоритет канала выбирается не в ovpn-файле, а в сетевых настройках своего компьютера:
Центр управления сетями и общим доступом — Изменение параметров адаптера — Дополнительно — Дополнительные параметры... — закладка "Адаптеры и привязки". Порядок меняется стрелками справа от окна "Подключения".

А вы ещё не затребовали отзыв вашего приватного ключа, того
Цитата:

Цитата Busla
что спалили»

и до сих пор не удосужились убрать из своего сообщения (даже не поместив свой OVPN-файл под спойлер, чем позволили читать его даже роботам, которые могут откладывать информацию в базы — а не только двуногим хакерам)?

glestwid 25-12-2018 23:07 2848277

Подключение взято с https://www.vpnbook.com/freevpn, так что его параметры знает последняя собака:) А по поводу приоритета что, в OVPN файле его ника не задать? И нельзя никакую команду вызвать по факту установления нового соединения?

Busla 25-12-2018 23:17 2848279

Цитата:

Цитата glestwid
никакими действиями на своей стороне в OVPN файле я не могу сделать маршрут свежеустановленного соединения как самый приоритетный »

действиями в ovpn-файле - нет

в принципе, можно навесить скрипты на событие соединения, но там много во что вникать придётся

а вы уверены, что дело только в маршруте с вашей стороны - ведь хозяин сервера должен был и у себя настроить маршрутизацию из vpn в интернет


Время: 21:18.

Время: 21:18.
© OSzone.net 2001-