Ich hab hier gerade ein kleines Problem mit OpenVPN. Ich möchte Folgends erreichen:
Mein File und Streamingserver, der im Heimnetz steht (und vieleicht bald noch Mail oder "Address" - Server, soll für mich und meine Kumples von extern erreichbar sein.
Ok dazu hab ich mir erst mal eine neue VM angelegt, und dort ein Debian als Gast instaliert. Open VPN eingespielt, und mich drangemacht dieses zu Konfigurieren. Da ich keinen Bock auf ewiges IP-Tabels anpassen habe, war der Weg klar. Ein tap Device soll es sein (Layer 2 VPN).
(VM deshalb, weil ich eh schon ein paar virtuelle Server hab )
Ok das war ganz schön hart einzurichten, Doch jetzt läuft es, noch nicht ganz;-)
Ich schaffe es nun eine Verbindung zum Openvpnserver herzustellen.
Hier mal ein paar Daten, Server Seitig:
Code: Alles auswählen
br0 Protokoll:Ethernet Hardware Adresse 00:0C:29:C9:7A:83
inet Adresse:192.168.2.3 Bcast:192.168.2.255 Maske:255.255.255.0
inet6 Adresse: fe80::20c:29ff:fec9:7a83/64 Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:15215 errors:0 dropped:0 overruns:0 frame:0
TX packets:2829 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:0
RX bytes:2117506 (2.0 MiB) TX bytes:234212 (228.7 KiB)
eth0 Protokoll:Ethernet Hardware Adresse 00:0C:29:C9:7A:83
inet6 Adresse: fe80::20c:29ff:fec9:7a83/64 Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:14920 errors:0 dropped:0 overruns:0 frame:0
TX packets:2780 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:1000
RX bytes:2304212 (2.1 MiB) TX bytes:220520 (215.3 KiB)
Interrupt:169 Basisadresse:0x1400
eth1 Protokoll:Ethernet Hardware Adresse 00:0C:29:C9:7A:8D
inet Adresse:192.168.3.4 Bcast:192.168.3.255 Maske:255.255.255.0
inet6 Adresse: fe80::20c:29ff:fec9:7a8d/64 Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:35002 errors:0 dropped:0 overruns:0 frame:0
TX packets:38807 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:1000
RX bytes:2851258 (2.7 MiB) TX bytes:5362474 (5.1 MiB)
Interrupt:177 Basisadresse:0x1480
lo Protokoll:Lokale Schleife
inet Adresse:127.0.0.1 Maske:255.0.0.0
inet6 Adresse: ::1/128 Gültigkeitsbereich:Maschine
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:35 errors:0 dropped:0 overruns:0 frame:0
TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:0
RX bytes:3920 (3.8 KiB) TX bytes:3920 (3.8 KiB)
tap0 Protokoll:Ethernet Hardware Adresse B2:62:AE:A5:66:42
inet6 Adresse: fe80::b062:aeff:fea5:6642/64 Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:296 errors:0 dropped:0 overruns:0 frame:0
TX packets:194 errors:0 dropped:19 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:100
RX bytes:27328 (26.6 KiB) TX bytes:27430 (26.7 KiB)
Die OpenVPN Verbindung wird über eth1 mit 192.168.3.4 abgewickelt.
Hier noch ein paar Logs:
Code: Alles auswählen
tobi@tobi-vpn:/var/log$ sudo cat openvpn-status.log
OpenVPN CLIENT LIST
Updated,Tue Oct 30 21:28:04 2007
Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since
tobi-laptop.tobifunk.imker25.dyndns.org,192.168.0.41:32779,26245,22991,Tue Oct 30 20:51:21 2007
ROUTING TABLE
Virtual Address,Common Name,Real Address,Last Ref
fe:e1:5d:59:7c:5a,tobi-laptop.tobifunk.imker25.dyndns.org,192.168.0.41:32779,Tue Oct 30 21:22:48 2007
GLOBAL STATS
Max bcast/mcast queue length,1
END
Code: Alles auswählen
tobi@tobi-vpn:/var/log$ ping 192.168.2.2
PING 192.168.2.2 (192.168.2.2) 56(84) bytes of data.
64 bytes from 192.168.2.2: icmp_seq=1 ttl=64 time=8.28 ms
64 bytes from 192.168.2.2: icmp_seq=2 ttl=64 time=0.580 ms
--- 192.168.2.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1003ms
rtt min/avg/max/mdev = 0.580/4.434/8.289/3.855 ms
tobi@tobi-vpn:/var/log$ ping 192.168.2.150
PING 192.168.2.150 (192.168.2.150) 56(84) bytes of data.
64 bytes from 192.168.2.150: icmp_seq=1 ttl=64 time=11.1 ms
64 bytes from 192.168.2.150: icmp_seq=2 ttl=64 time=1.44 ms
64 bytes from 192.168.2.150: icmp_seq=3 ttl=64 time=2.85 ms
--- 192.168.2.150 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 1.444/5.135/11.103/4.259 ms
Nun zur Client Seite:
Erst mal die Logs:
Code: Alles auswählen
Tue Oct 30 20:46:40 2007 us=572019 VERIFY OK: depth=0, /C=DE/ST=Bavaria/L=Nuernberg/O=BACKfrak/OU=VPN/CN=tobi-vpn.tobiopen.imker25.dyndns.org/emailAddress=tobi@backfrak.de
WRWRWRWRWRWRWWWWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRWRRRRWWWWRRRRWRWRTue Oct 30 20:46:40 2007 us=655113 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Tue Oct 30 20:46:40 2007 us=655137 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Tue Oct 30 20:46:40 2007 us=655219 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Tue Oct 30 20:46:40 2007 us=655235 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
WTue Oct 30 20:46:40 2007 us=655290 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA
Tue Oct 30 20:46:40 2007 us=655318 [tobi-vpn.tobiopen.imker25.dyndns.org] Peer Connection Initiated with 192.168.3.4:1194
Tue Oct 30 20:46:41 2007 us=764400 SENT CONTROL [tobi-vpn.tobiopen.imker25.dyndns.org]: 'PUSH_REQUEST' (status=1)
WRRWRTue Oct 30 20:46:41 2007 us=767232 PUSH: Received control message: 'PUSH_REPLY,route 192.168.2.0 255.255.255.0,route-gateway 192.168.2.3,ping 10,ping-restart 120,ifconfig 192.168.2.150 255.255.255.0'
Tue Oct 30 20:46:41 2007 us=767337 OPTIONS IMPORT: timers and/or timeouts modified
Tue Oct 30 20:46:41 2007 us=767357 OPTIONS IMPORT: --ifconfig/up options modified
Tue Oct 30 20:46:41 2007 us=767373 OPTIONS IMPORT: route options modified
Tue Oct 30 20:46:41 2007 us=767835 TUN/TAP device tap1 opened
Tue Oct 30 20:46:41 2007 us=767875 TUN/TAP TX queue length set to 100
Tue Oct 30 20:46:41 2007 us=767917 ifconfig tap1 192.168.2.150 netmask 255.255.255.0 mtu 1500 broadcast 192.168.2.255
Tue Oct 30 20:46:41 2007 us=776604 route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.2.3
Tue Oct 30 20:46:41 2007 us=781100 Initialization Sequence Completed
Code: Alles auswählen
eth0 Protokoll:Ethernet Hardware Adresse 00:17:42:13:30:68
inet Adresse:192.168.0.41 Bcast:192.168.0.255 Maske:255.255.255.0
inet6 Adresse: fe80::217:42ff:fe13:3068/64 Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1722 errors:0 dropped:0 overruns:0 frame:0
TX packets:1834 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:1000
RX bytes:650936 (635.6 KiB) TX bytes:193059 (188.5 KiB)
Interrupt:19
lo Protokoll:Lokale Schleife
inet Adresse:127.0.0.1 Maske:255.0.0.0
inet6 Adresse: ::1/128 Gültigkeitsbereich:Maschine
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:45 errors:0 dropped:0 overruns:0 frame:0
TX packets:45 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:0
RX bytes:4784 (4.6 KiB) TX bytes:4784 (4.6 KiB)
tap0 Protokoll:Ethernet Hardware Adresse FE:E1:5D:59:7C:5A
inet Adresse:192.168.2.150 Bcast:192.168.2.255 Maske:255.255.255.0
inet6 Adresse: fe80::fce1:5dff:fe59:7c5a/64 Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:100
RX bytes:1824 (1.7 KiB) TX bytes:468 (468.0 b)
Code: Alles auswählen
tobi@tobi-laptop:/etc/openvpn$ ping 192.168.2.3
PING 192.168.2.3 (192.168.2.3) 56(84) bytes of data.
64 bytes from 192.168.2.3: icmp_seq=1 ttl=64 time=6.62 ms
64 bytes from 192.168.2.3: icmp_seq=2 ttl=64 time=1.51 ms
64 bytes from 192.168.2.3: icmp_seq=3 ttl=64 time=2.00 ms
tobi@tobi-laptop:/etc/openvpn$ ping 192.168.2.2
PING 192.168.2.2 (192.168.2.2) 56(84) bytes of data.
--- 192.168.2.2 ping statistics ---
32 packets transmitted, 0 received, 100% packet loss, time 30998ms
Wo liegt hier mein Gedankenfehler, und was muss ich tun ausser das tap device des servers und die NIC die im internen Netz hängt zu bridgen? Hab ich da irgend eine Option vergessen die OpenVPN sagt, du must die Packete weitergeben?
Hier noch schnell die Server config:
Code: Alles auswählen
mode server
tls-server
proto udp
port 1194
dev tap0
mssfix
ca /etc/openvpn/certs/ca.crt
cert /etc/openvpn/certs/tobi-vpn.tobiopen.imker25.dyndns.org.crt
key /etc/openvpn/certs/tobi-vpn.tobiopen.imker25.dyndns.org.key
dh /etc/openvpn/certs/dh1024.pem
client-to-client
server-bridge 192.168.2.3 255.255.255.0 192.168.2.150 192.168.2.225
push "route 192.168.2.0 255.255.255.0"
# Tests the connection with a ping like paket. (wait=120sec)
keepalive 10 120
# ##############################################################
# Authenication
auth SHA1
# Our encryption algorithm
# cipher aes-256-ecb
# openvpn --show-ciphers for testing
#comp
comp-lzo
# ############################################################
# Sets new rights after the connection
user nobody
group nogroup
# We need this because of user nobody/group nobody.
persist-key
persist-tun
# Log Path (Wenns mal läuft rein!)
log /var/log/openvpn.log
status /var/log/openvpn-status.log
verb 5
Gruß
Tobi