bonovox007
Goto Top

Openvpn Umzug auf neuen Server?

Reicht ein einfaches kopieren?

Hallo,
ich habe auf einen neuen Server Openvpn installiert und dann die Config-Dateien vom alten Server auf den neuen kopiert. Es kommt aber leider keine Verbindung zustande.
Kann man so einfach die Dateien kopieren oder müssen die Server-Zertifikate neu erstellt werden?
Selbst wenn ich den Ordner 1 zu 1 kopiere nachdem ich Openvpn neu installiert habe geht es nicht.

Gruß

Content-Key: 171595

Url: https://administrator.de/contentid/171595

Ausgedruckt am: 28.03.2024 um 13:03 Uhr

Mitglied: Ghostraider
Ghostraider 16.08.2011 um 23:01:57 Uhr
Goto Top
Hi,

kannst du mal das LogFile vom Server posten?
Was meinst du mit es kommt keine Verbindung zustande? Kann sich der Client nicht verbinden oder startet der Dienst erst garnicht?

Was hast du für einen Server? Windows / Linux ?
Mitglied: Bonovox007
Bonovox007 17.08.2011 um 16:29:08 Uhr
Goto Top
Also alles startet anscheinend super....aber:
im dns server wird nicht der 10.0.8.1 eingetragen, was er aber am alten server anstandslos macht.ich denke mal das die anfragen irgendwie ins nirvana dann laufen?
es kommt dadurch keine verbindung vom clienten zusatnde.
der openvpn läuft alt auf einem server 2003 und neu auf server 2008 r2.

gruß
Mitglied: Ghostraider
Ghostraider 17.08.2011 um 23:49:08 Uhr
Goto Top
Hi,

ich hatte am Anfang auf meinem 2008 R2 ein ähnliches Problem.
Die Clients konnten sich verbinden, aber es kam kein Ping an. Das Problem lag daran das auf dem 2008er das IPForwarding deaktiviert war.

Du kannst mal nachschauen ob das bei dir auch so ist.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Set the following registry value:
Value Name: IPEnableRouter
Value type: REG_DWORD
Value Data: 1
NOTE: A value of 1 enables TCP/IP forwarding for all network connections installed and used by this computer.

Der Key IPEnableRoute muss auf 1 stehen, danach ging bei mir der VPN ohne Probleme.
Mitglied: Bonovox007
Bonovox007 19.08.2011 um 19:05:25 Uhr
Goto Top
hi,
hab den wert auf "1" geändert.Geht aber leider immer noch nicht.
Der Client sagt im log:
Fri Aug 19 18:58:19 2011 TCP: connect to xx.xx.xxx.xx:1194 failed, will try again in 5 seconds: Connection refused (WSAECONNREFUSED)

und der server:
Fri Aug 19 18:57:09 2011 OpenVPN 2.2.1 Win32-MSVC++ [SSL] [LZO2] built on Jul 1 2011
Fri Aug 19 18:57:09 2011 NOTE: your local LAN uses the extremely common subnet address 192.168.0.x or 192.168.1.x. Be aware that this might create routing conflicts if you connect to the VPN server from public locations such as internet cafes that use the same subnet.
Fri Aug 19 18:57:09 2011 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Fri Aug 19 18:57:09 2011 Diffie-Hellman initialized with 1024 bit key
Fri Aug 19 18:57:10 2011 TLS-Auth MTU parms [ L:1576 D:140 EF:40 EB:0 ET:0 EL:0 ]
Fri Aug 19 18:57:10 2011 Socket Buffers: R=[8192->8192] S=[8192->8192]
Fri Aug 19 18:57:10 2011 TAP-WIN32 device [LAN-Verbindung 4] opened: \\.\Global\{86380D1E-C21E-44C2-A246-51D723FD8A7B}.tap
Fri Aug 19 18:57:10 2011 TAP-Win32 Driver Version 9.8
Fri Aug 19 18:57:10 2011 TAP-Win32 MTU=1500
Fri Aug 19 18:57:10 2011 Notified TAP-Win32 driver to set a DHCP IP/netmask of 10.8.0.1/255.255.255.0 on interface {86380D1E-C21E-44C2-A246-51D723FD8A7B} [DHCP-serv: 10.8.0.0, lease-time: 31536000]
Fri Aug 19 18:57:10 2011 Sleeping for 10 seconds...
Fri Aug 19 18:57:20 2011 Successful ARP Flush on interface [18] {86380D1E-C21E-44C2-A246-51D723FD8A7B}
Fri Aug 19 18:57:20 2011 Data Channel MTU parms [ L:1576 D:1450 EF:44 EB:135 ET:32 EL:0 AF:3/1 ]
Fri Aug 19 18:57:20 2011 Listening for incoming TCP connection on [undef]:1194
Fri Aug 19 18:57:20 2011 TCPv4_SERVER link local (bound): [undef]:1194
Fri Aug 19 18:57:20 2011 TCPv4_SERVER link remote: [undef]
Fri Aug 19 18:57:20 2011 MULTI: multi_init called, r=256 v=256
Fri Aug 19 18:57:20 2011 IFCONFIG POOL: base=10.8.0.2 size=253
Fri Aug 19 18:57:20 2011 IFCONFIG POOL LIST
Fri Aug 19 18:57:20 2011 xxxxx,10.8.0.2
Fri Aug 19 18:57:20 2011 MULTI: TCP INIT maxclients=60 maxevents=64
Fri Aug 19 18:57:20 2011 Initialization Sequence Completed

das ist soweit der gleiche log wie beim alten server.
es kommt aber leider keine verbindung zustande. und wie gesagt:
warum wird beim alten openvpn-server ein eintrag im dns vorgenommen und beim neuen server nicht? ich glaube das da eher der fehler ist?
Mitglied: Ghostraider
Ghostraider 20.08.2011 um 23:55:30 Uhr
Goto Top
Hi,

Kannst du mal die Log Files von Server und Client Posten?
Mitglied: Beebob007
Beebob007 21.08.2011 um 09:29:15 Uhr
Goto Top
Hab ich das nicht in meinem Post? Was für ein Log meinst Du sonst?
Mitglied: Ghostraider
Ghostraider 22.08.2011 um 07:59:59 Uhr
Goto Top
Sorry ich meine natürlich die Config nicht das Log.
Mitglied: Bonovox007
Bonovox007 01.09.2011 um 11:54:35 Uhr
Goto Top
Sorry, daß ich mich jetzt erst melde...bin nicht eher dazu gekommen-
Die Server-Config:
  1. Sample OpenVPN 2.0 config file for #
  2. multi-client server. #
  3. #
  4. This file is for the server side #
  5. of a many-clients <-> one-server #
  6. OpenVPN configuration. #
  7. #
  8. OpenVPN also supports #
  9. single-machine <-> single-machine #
  10. configurations (See the Examples page #
  11. on the web site for more info). #
  12. #
  13. This config should work on Windows #
  14. or Linux/BSD systems. Remember on #
  15. Windows to quote pathnames and use #
  16. double backslashes, e.g.: #
  17. "C:\\Program Files\\OpenVPN\\config\\foo.key" #
  18. #
  19. Comments are preceded with '#' or ';' #
#################################################

  1. Which local IP address should OpenVPN
  2. listen on? (optional)
;local a.b.c.d

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

  1. TCP or UDP server?
proto tcp
;proto udp

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

  1. Windows needs the TAP-Win32 adapter name
  2. from the Network Connections panel if you
  3. have more than one. On XP SP2 or higher,
  4. you may need to selectively disable the
  5. Windows firewall for the TAP adapter.
  6. Non-Windows systems usually don't need this.
#dev-node LAN-Verbindung 2

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

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

  1. Configure server mode and supply a VPN subnet
  2. for OpenVPN to draw client addresses from.
  3. The server will take 10.8.0.1 for itself,
  4. the rest will be made available to clients.
  5. Each client will be able to reach the server
  6. on 10.8.0.1. Comment this line out if you are
  7. ethernet bridging. See the man page for more info.
server 10.8.0.0 255.255.255.0

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

  1. Configure server mode for ethernet bridging.
  2. You must first use your OS's bridging capability
  3. to bridge the TAP interface with the ethernet
  4. NIC interface. Then you must manually set the
  5. IP/netmask on the bridge interface, here we
  6. assume 10.8.0.4/255.255.255.0. Finally we
  7. must set aside an IP range in this subnet
  8. (start=10.8.0.50 end=10.8.0.100) to allocate
  9. to connecting clients. Leave this line commented
  10. out unless you are ethernet bridging.
#Server-bridge 10.8.0.1 255.255.255.0 10.8.0.2 10.8.0.100

  1. Push routes to the client to allow it
  2. to reach other private subnets behind
  3. the server. Remember that these
  4. private subnets will also need
  5. to know to route the OpenVPN client
  6. address pool (10.8.0.0/255.255.255.0)
  7. back to the OpenVPN server.
push "route 192.168.1.0 255.255.255.0"
;push "route 192.168.20.0 255.255.255.0"

  1. To assign specific IP addresses to specific
  2. clients or if a connecting client has a private
  3. subnet behind it that should also have VPN access,
  4. use the subdirectory "ccd" for client-specific
  5. configuration files (see man page for more info).

  1. EXAMPLE: Suppose the client
  2. having the certificate common name "Thelonious"
  3. also has a small subnet behind his connecting
  4. machine, such as 192.168.40.128/255.255.255.248.
  5. First, uncomment out these lines:
;client-config-dir ccd
;route 192.168.40.128 255.255.255.248
  1. Then create a file ccd/Thelonious with this line:
  2. iroute 192.168.40.128 255.255.255.248
  3. This will allow Thelonious' private subnet to
  4. access the VPN. This example will only work
  5. if you are routing, not bridging, i.e. you are
  6. using "dev tun" and "server" directives.

  1. EXAMPLE: Suppose you want to give
  2. Thelonious a fixed VPN IP address of 10.9.0.1.
  3. First uncomment out these lines:
;client-config-dir ccd
;route 10.9.0.0 255.255.255.252
  1. Then add this line to ccd/Thelonious:
  2. ifconfig-push 10.9.0.1 10.9.0.2

  1. Suppose that you want to enable different
  2. firewall access policies for different groups
  3. of clients. There are two methods:
  4. (1) Run multiple OpenVPN daemons, one for each
  5. group, and firewall the TUN/TAP interface
  6. for each group/daemon appropriately.
  7. (2) (Advanced) Create a script to dynamically
  8. modify the firewall in response to access
  9. from different clients. See man
  10. page for more info on learn-address script.
;learn-address ./script

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

  1. Certain Windows-specific network settings
  2. can be pushed to clients, such as DNS
  3. or WINS server addresses. CAVEAT:
  4. http://openvpn.net/faq.html#dhcpcaveats
push "dhcp-option DNS 192.168.1.23"
push "dhcp-option WINS 192.168.1.23"
push "dhcp-option DOMAIN XXX.local"

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

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

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

  1. For extra security beyond that provided
  2. by SSL/TLS, create an "HMAC firewall"
  3. to help block DoS attacks and UDP port flooding.
#
  1. Generate with:
  2. openvpn --genkey --secret ta.key
#
  1. The server and each client must have
  2. a copy of this key.
  3. The second parameter should be '0'
  4. on the server and '1' on the clients.
;tls-auth ta.key 0 # This file is secret

  1. Select a cryptographic cipher.
  2. This config item must be copied to
  3. the client config file as well.
;cipher BF-CBC # Blowfish (default)
;cipher AES-128-CBC # AES
;cipher DES-EDE3-CBC # Triple-DES

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

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

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

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

  1. Output a short status file showing
  2. current connections, truncated
  3. and rewritten every minute.
status openvpn-status.log

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

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

  1. Silence repeating messages. At most 20
  2. sequential messages of the same message
  3. category will be output to the log.
;mute 20

#plugin /usr/lib/openvpn/openvpn-auth-pam.so login

mssfix


und beim Clienten:
  1. Sample client-side OpenVPN 2.0 config file #
  2. for connecting to multi-client server. #
  3. #
  4. This configuration can be used by multiple #
  5. clients, however each client should have #
  6. its own cert and key files. #
  7. #
  8. On Windows, you might want to rename this #
  9. file so it has a .ovpn extension #
##############################################

  1. Specify that we are a client and that we
  2. will be pulling certain config file directives
  3. from the server.
client

  1. Use the same setting as you are using on
  2. the server.
  3. On most systems, the VPN will not function
  4. unless you partially or fully disable
  5. the firewall for the TUN/TAP interface.
dev tap
;dev tun

  1. Windows needs the TAP-Win32 adapter name
  2. from the Network Connections panel
  3. if you have more than one. On XP SP2,
  4. you may need to disable the firewall
  5. for the TAP adapter.
;dev-node MyTap

  1. Are we connecting to a TCP or
  2. UDP server? Use the same setting as
  3. on the server.
proto tcp
;proto udp

  1. The hostname/IP and port of the server.
  2. You can have multiple remote entries
  3. to load balance between the servers.
remote XX.XXX.XXX.XXX 1194
;remote my-server-2 1194

  1. Choose a random host from the remote
  2. list for load-balancing. Otherwise
  3. try hosts in the order specified.
;remote-random

  1. Keep trying indefinitely to resolve the
  2. host name of the OpenVPN server. Very useful
  3. on machines which are not permanently connected
  4. to the internet such as laptops.
resolv-retry infinite

  1. Most clients don't need to bind to
  2. a specific local port number.
nobind

  1. Downgrade privileges after initialization (non-Windows only)
;user nobody
;group nogroup

  1. Try to preserve some state across restarts.
persist-key
persist-tun

  1. If you are connecting through an
  2. HTTP proxy to reach the actual OpenVPN
  3. server, put the proxy server/IP and
  4. port number here. See the man page
  5. if your proxy server requires
  6. authentication.
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #]

  1. Wireless networks often produce a lot
  2. of duplicate packets. Set this flag
  3. to silence duplicate packet warnings.
;mute-replay-warnings

  1. SSL/TLS parms.
  2. See the server config file for more
  3. description. It's best to use
  4. a separate .crt/.key file pair
  5. for each client. A single ca
  6. file can be used for all clients.
ca ca.crt
cert xxx.crt
key xxx.key

  1. Verify server certificate by checking
  2. that the certicate has the nsCertType
  3. field set to "server". This is an
  4. important precaution to protect against
  5. a potential attack discussed here:
  6. http://openvpn.net/howto.html#mitm
#
  1. To use this feature, you will need to generate
  2. your server certificates with the nsCertType
  3. field set to "server". The build-key-server
  4. script in the easy-rsa folder will do this.
;ns-cert-type server

  1. If a tls-auth key is used on the server
  2. then every client must also have the key.
;tls-auth ta.key 1

  1. Select a cryptographic cipher.
  2. If the cipher option is used on the server
  3. then you must also specify it here.
;cipher x

  1. Enable compression on the VPN link.
  2. Don't enable this unless it is also
  3. enabled in the server config file.
comp-lzo

  1. Set log file verbosity.
verb 3

  1. Silence repeating messages
;mute 20


Reicht das so?
Mitglied: Bonovox007
Bonovox007 09.09.2011 um 08:05:46 Uhr
Goto Top
Keiner eine Idee?
Ich komme echt nicht weiter.
Mitglied: Bonovox007
Bonovox007 13.09.2011 um 07:40:42 Uhr
Goto Top
Bin ein wenig weiter.hab mal nen portscanner laufen lassen auf dem neuen server.der port 1194 wird nciht geöffnet.da scheint der fehler zu sein