devil77c
Goto Top

OpenVPN mit fester IPv4-Adresse

Hallo, ich habe einen Server mit sechs zusatzlichen IPv4-Adressen.

Openvpn habe ich bereits erfolgreich installiert und es verbindet auch.

Wie kann ich jetzt meine adressen an meine Clienten durchreichen?
Sollte doch mittels der Config von openvpn laufen. Natürlich in beide Richtungen.

Eine kleine Beispielconfiguration wäre echt toll.

Der Server läuft auf Basis von Debian 7

Grüsse und Danke

Content-ID: 267791

Url: https://administrator.de/forum/openvpn-mit-fester-ipv4-adresse-267791.html

Ausgedruckt am: 23.12.2024 um 19:12 Uhr

michi1983
michi1983 29.03.2015 um 14:09:59 Uhr
Goto Top
Hallo,

warum postest du nicht deine config, dann kann dir hier zielgerichteter geholfen werden.
Aber hier wirst du auch fündig.

Gruß
Michi
aqui
aqui 29.03.2015 um 14:58:34 Uhr
Goto Top
Wie kann ich jetzt meine adressen an meine Clienten durchreichen?
Das alles erklärt dir das hiesige OpenVPN Tutorial:
OpenVPN Server installieren auf pfSense Firewall, Mikrotik. DD-WRT oder GL.inet Router
devil77c
devil77c 30.03.2015 aktualisiert um 09:20:07 Uhr
Goto Top
Zitat von @michi1983:

Hallo,

warum postest du nicht deine config, dann kann dir hier zielgerichteter geholfen werden.
Aber hier wirst du auch fündig.

Gruß
Michi


Hier meine Configs:

  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 MyTap

  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 /etc/openvpn/easy-rsa2/keys/ca.crt
cert /etc/openvpn/easy-rsa2/keys/host100.xxxx.de.crt
key /etc/openvpn/easy-rsa2/keys/host100.xxxx.de.key

  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 /etc/openvpn/easy-rsa2/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 193.24.209.238 255.255.255.0 10.8.0.6

  1. Configure server mode for ethernet bridging
  2. using a DHCP-proxy, where clients talk
  3. to the OpenVPN server-side DHCP server
  4. to receive their IP address allocation
  5. and DNS server addresses. You must first use
  6. your OS's bridging capability to bridge the TAP
  7. interface with the ethernet NIC interface.
  8. Note: this mode only works on clients (such as
  9. Windows), where the client-side TAP adapter is
  10. bound to a DHCP client.
;server-bridge

  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.10.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. or bridge the TUN/TAP interface to the internet
  8. in order for this to work properly).
push "redirect-gateway def1 bypass-dhcp"

  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
  5. The addresses below r.efer to the public
  6. DNS servers provided. by opendns.com.
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"

  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
_____________________________________

wenn ich ifconfig eingebe kommt das:

eth0 Link encap:Ethernet HWaddr xx.xx:3c:38:b9:7a
inet addr:xxx.xxx.209.237 Bcast:xxx.xxx.209.255 Mask:255.255.255.0
inet6 addr: xxxx:xxxx:xxxx:fe38:b97a/64 Scope:Link
inet6 addr: xxxx:xxxx:xxxx:8965/128 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:65611147 errors:0 dropped:5265 overruns:0 frame:0
TX packets:420662 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15369827556 (14.3 GiB) TX bytes:58445923 (55.7 MiB)

eth0:0 Link encap:Ethernet HWaddr xx.xx:3c:38:b9:7a
inet addr:xxx.xxx.209.238 Bcast:xxx.xxx.209.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:1 Link encap:Ethernet HWaddr xx.xx:3c:38:b9:7a
inet addr:xxx.xxx.209.239 Bcast:xxx.xxx.209.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:2 Link encap:Ethernet HWaddr xx.xx:3c:38:b9:7a
inet addr:xxx.xxx.209.240 Bcast:xxx.xxx.209.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:3 Link encap:Ethernet HWaddr xx.xx:3c:38:b9:7a
inet addr:xxx.xxx.209.241 Bcast:xxx.xxx.209.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:4 Link encap:Ethernet HWaddr xx.xx:3c:38:b9:7a
inet addr:xxx.xxx.209.242 Bcast:xxx.xxx.209.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:5 Link encap:Ethernet HWaddr xx.xx:3c:38:b9:7a
inet addr:xxx.xxx.209.243 Bcast:xxx.xxx.209.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

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 MTU:16436 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:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.8.0.1 P-t-P:10.8.0.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:99 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:5162 (5.0 KiB) TX bytes:0 (0.0 B)

____________________________________________________-

und die IP´s der virtuellen schnittstellen möchte ich direckt in einen tunnel schicken, jede in einen anderen tunnel natürlich.

ich komme da nicht weiter.

danke