Ru-Board.club
← Вернуться в раздел «UNIX»

» Проблема с OpenVPN.

Автор: 1990
Дата сообщения: 24.06.2008 16:04
Доброе время суток!

* Очень простой вопрос по настройке OpenVPN *
Следуя ману (на русском) уставноил OpenVPN (из портов, всё как положено), сгенерировал ключи, сделал конфиг и запустил. Не работает
В логе прочитал:

Код:
Tue Jun 24 16:31:48 2008 us=900853 TUN/TAP device /dev/tun0 opened
Tue Jun 24 16:31:48 2008 us=900972 /sbin/ifconfig tun0 10.20.30.1 10.20.30.2 mtu 1500 netmask 255.255.255.255 up
Tue Jun 24 16:31:48 2008 us=912682 /sbin/route add -net 10.20.30.0 10.20.30.2 255.255.255.0
add net 10.20.30.0: gateway 10.20.30.2
Tue Jun 24 16:31:48 2008 us=922990 /sbin/route add -net 10.20.30.0 10.20.30.2 255.255.255.0
route: writing to routing socket: File exists
add net 10.20.30.0: gateway 10.20.30.2: route already in table
Tue Jun 24 16:31:48 2008 us=933373 ERROR: FreeBSD route add command failed: shell command exited with error status: 1
Tue Jun 24 16:31:48 2008 us=933537 Data Channel MTU parms [ L:1544 D:1450 EF:44 EB:135 ET:0 EL:0 AF:3/1 ]
Tue Jun 24 16:31:48 2008 us=935934 GID set to nobody
Tue Jun 24 16:31:48 2008 us=936056 UID set to nobody
Tue Jun 24 16:31:48 2008 us=936100 Listening for incoming TCP connection on [undef]:1194
Tue Jun 24 16:31:48 2008 us=936221 Socket Buffers: R=[65536->65536] S=[32768->65536]
Tue Jun 24 16:31:48 2008 us=936286 TCPv4_SERVER link local (bound): [undef]:1194
Tue Jun 24 16:31:48 2008 us=936313 TCPv4_SERVER link remote: [undef]
Tue Jun 24 16:31:48 2008 us=936358 MULTI: multi_init called, r=256 v=256
Tue Jun 24 16:31:48 2008 us=936463 IFCONFIG POOL: base=10.20.30.4 size=62
Tue Jun 24 16:31:48 2008 us=936583 IFCONFIG POOL LIST
Tue Jun 24 16:31:48 2008 us=936620 MULTI: TCP INIT maxclients=10 maxevents=14
Tue Jun 24 16:31:48 2008 us=936670 Initialization Sequence Completed
Tue Jun 24 16:32:27 2008 us=279875 TCP/UDP: Closing socket
Tue Jun 24 16:32:27 2008 us=280074 /sbin/route delete -net 10.20.30.0 10.20.30.2 255.255.255.0
route: must be root to alter routing table
Tue Jun 24 16:32:27 2008 us=290555 ERROR: FreeBSD route delete command failed: shell command exited with error status: 77
Автор: tankistua
Дата сообщения: 25.06.2008 01:42
ты с сетями напутал

cat /usr/local/etc/openvpn/openvpn.conf
[more]# Which local IP address should OpenVPN
# listen on? (optional)
;local a.b.c.d

# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one. You will need to
# open up this port on your firewall.
port 1194

# TCP or UDP server?
proto tcp

# "dev tun" will create a routed IP tunnel,
# "dev tap" will create an ethernet tunnel.
# Use "dev tap0" if you are ethernet bridging
# and have precreated a tap0 virtual interface
# and bridged it with your ethernet interface.
# If you want to control access policies
# over the VPN, you must create firewall
# rules for the the TUN/TAP interface.
# On non-Windows systems, you can give
# an explicit unit number, such as tun0.
# On Windows, use "dev-node" for this.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
dev tun

# SSL/TLS root certificate (ca), certificate
# (cert), and private key (key). Each client
# and the server must have their own cert and
# key file. The server and all clients will
# use the same ca file.
#
# See the "easy-rsa" directory for a series
# of scripts for generating RSA certificates
# and private keys. Remember to use
# a unique Common Name for the server
# and each of the client certificates.
#
# Any X509 key management system can be used.
# OpenVPN can also use a PKCS #12 formatted key file
# (see "pkcs12" directive in man page).
ca keys/ca.crt
cert keys/server.crt
key keys/server.key # This file should be kept secret

# Diffie hellman parameters.
# Generate your own with:
# openssl dhparam -out dh1024.pem 1024
# Substitute 2048 for 1024 if you are using
# 2048 bit keys.
dh keys/dh1024.pem

# Configure server mode and supply a VPN subnet
# for OpenVPN to draw client addresses from.
# The server will take 10.8.0.1 for itself,
# the rest will be made available to clients.
# Each client will be able to reach the server
# on 10.8.0.1. Comment this line out if you are
# ethernet bridging. See the man page for more info.
server 192.168.168.0 255.255.255.240

# Maintain a record of client <-> virtual IP address
# associations in this file. If OpenVPN goes down or
# is restarted, reconnecting clients can be assigned
# the same virtual IP address from the pool that was
# previously assigned.
ifconfig-pool-persist ipp.txt

# Push routes to the client to allow it
# to reach other private subnets behind
# the server. Remember that these
# private subnets will also need
# to know to route the OpenVPN client
# address pool (10.8.0.0/255.255.255.0)
# back to the OpenVPN server.
push "route 192.168.0.0 255.255.255.0"

# EXAMPLE: Suppose the client
# having the certificate common name "Thelonious"
# also has a small subnet behind his connecting
# machine, such as 192.168.40.128/255.255.255.248.
# First, uncomment out these lines:
client-config-dir ccd
route 192.168.2.0 255.255.255.0
route 192.168.3.0 255.255.255.0
route 192.168.4.0 255.255.255.0
route 192.168.5.0 255.255.255.0
route 192.168.6.0 255.255.255.0
route 192.168.7.0 255.255.255.0
route 192.168.8.0 255.255.255.0
route 192.168.9.0 255.255.255.0

# If enabled, this directive will configure
# all clients to redirect their default
# network gateway through the VPN, causing
# all IP traffic such as web browsing and
# and DNS lookups to go through the VPN
# (The OpenVPN server machine may need to NAT
# the TUN/TAP interface to the internet in
# order for this to work properly).
# CAVEAT: May break client's network config if
# client's local DHCP server packets get routed
# through the tunnel. Solution: make sure
# client's local DHCP server is reachable via
# a more specific route than the default route
# of 0.0.0.0/0.0.0.0.
;push "redirect-gateway"

# Certain Windows-specific network settings
# can be pushed to clients, such as DNS
# or WINS server addresses. CAVEAT:
# http://openvpn.net/faq.html#dhcpcaveats
;push "dhcp-option DNS 10.8.0.1"
;push "dhcp-option WINS 10.8.0.1"

# Uncomment this directive to allow different
# clients to be able to "see" each other.
# By default, clients will only see the server.
# To force clients to only see the server, you
# will also need to appropriately firewall the
# server's TUN/TAP interface.
client-to-client

# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names. This is recommended
# only for testing purposes. For production use,
# each client should have its own certificate/key
# pair.
#
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",
# UNCOMMENT THIS LINE OUT.
;duplicate-cn

# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120

# Enable compression on the VPN link.
# If you enable it here, you must also
# enable it in the client config file.
comp-lzo

# The maximum number of concurrently connected
# clients we want to allow.
;max-clients 100

# It's a good idea to reduce the OpenVPN
# daemon's privileges after initialization.
#
# You can uncomment this out on
# non-Windows systems.
user nobody
group nobody

# The persist options will try to avoid
# accessing certain resources on restart
# that may no longer be accessible because
# of the privilege downgrade.
persist-key
persist-tun

# Output a short status file showing
# current connections, truncated
# and rewritten every minute.
status /var/log/openvpn-status.log

# By default, log messages will go to the syslog (or
# on Windows, if running as a service, they will go to
# the "\Program Files\OpenVPN\log" directory).
# Use log or log-append to override this default.
# "log" will truncate the log file on OpenVPN startup,
# while "log-append" will append to it. Use one
# or the other (but not both).
log /var/log/openvpn.log

# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 3

# Silence repeating messages. At most 20
# sequential messages of the same message
# category will be output to the log.
;mute 20[/more]

cat /usr/local/etc/openvpn/ccd/192-168-2-0
[more]iroute 192.168.2.0 255.255.255.0
ifconfig-push 192.168.168.2 192.168.168.1[/more]








Автор: 1990
Дата сообщения: 25.06.2008 23:07
2 tankistua
Большое спасибо за помощь!
Всё настроил, всё работает.

Проблема была в настройках сетей / route.

Автор: SjTar
Дата сообщения: 02.07.2010 11:10
Прошу помощи в решении подобной проблемы:
И так:
Есть сеть предприятия 192.168.0.0/24. Эта сеть находится за шлюзом, организованном на базе FreeBSD. На шлюзе стоит две карточки одна смотрит в сеть другая в интернет. Задача: организовать доступ к внутренней сети предприятия из вне.
На данный момент на сервере поднят OpenVPN 2.0.9. Клиент подключается посредством OpenVPN 2.1.1
На сервере установлена FreeBSD 7.1-RELEASE
На клиенте Windows 7.
Теперь конфиги:
На сервере:
server.conf

Код: local 1.1.1.1 #внешний IP шлюза
port 1194
proto udp
dev tun0
ca /usr/local/openvpn/keys/ca.crt
cert /usr/local/openvpn/keys/servgate.crt
key /usr/local/openvpn/keys/servgate.key
dh /usr/local/openvpn/keys/dh1024.pem
server 192.168.2.0 255.255.255.0
client-config-dir ccd
push "route 192.168.0.0 255.255.255.0"
push "route 192.168.2.0 255.255.255.252"
#ifconfig-pool-persist ipp.txt
tls-server
tls-auth /usr/local/openvpn/keys/ta.key 0
tls-timeout 120
auth MD5
cipher BF-CBC
keepalive 10 120
comp-lzo
max-clients 255
user nobody
group nobody
persist-key
persist-tun
status /var/log/openvpn/openvpn-status.log
log /var/log/openvpn/openvpn.log
verb 3
Автор: Raz0rnsk
Дата сообщения: 21.07.2010 13:51
скажите как правильно настровить esx/server для работы openvpn?
скачал виртуальный образ(он на основе убунту х32), конвертнул в vsphere, запустил, сконфигил.

по адресу x.x.x.x:5480 открывается управление, логинится все ок.
а вот в админку зайти не могу. По адресу x.x.x.x:943/admin, пишет ошибка соединения.
пробовал из CLI esxcfg-firewall 943 порт открыть, не помогло.

пробовал прописать в iptables
iptables -A INPUT -i inet_iface -d xxx.xxx.xxx.xxx -p TCP --dport 943 -j ACCEPT
это на вход
xxx.xxx... - это твой ип на внешнем интерфейсе
и на выход.
iptables -A OUTPUT -o inet_iface -s xxx.xxx.xxx.xxx -p TCP --sport 943 -j ACCEPT

все равно не пашет.
Автор: Alukardd
Дата сообщения: 21.07.2010 23:32
Raz0rnsk
а telnet на этот порт идёт??? <=> что даёт нам команда netstat -na|grep 943 на сервере???
Автор: Raz0rnsk
Дата сообщения: 22.07.2010 05:13
Alukardd
не идет, пишет connection refusion

Добавлено:
а щас вообще ничего не выдает, пусто,...

Добавлено:
спасибо за помощь, проблема решена с openvpn
проблема была в настройке сервера.

Страницы: 1

Предыдущая тема: Dovecot не отдает почту из внешней сетки!


Форум Ru-Board.club — поднят 15-09-2016 числа. Цель - сохранить наследие старого Ru-Board, истории становления российского интернета. Сделано для людей.