Portál AbcLinuxu, 27. května 2025 19:23
client
dev tun
proto udp
remote *ServerIP* 1194
float
comp-lzo adaptive
keepalive 15 60
auth-user-pass
ns-cert-type server
< ca>
-----BEGIN CERTIFICATE-----
Log na straně serveru:
Aug 1 02:00:33 openvpn[685]: OpenVPN 2.3.2 mips-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [eurephia] [MH] [IPv6] built on Dec 1 2016
Aug 1 02:00:33 openvpn[685]: PLUGIN_INIT: POST /usr/lib/openvpn-plugin-auth-pam.so '[/usr/lib/openvpn-plugin-auth-pam.so] [openvpn]' intercepted=PLUGIN_AUTH_USER_PASS_VERIFY
Aug 1 02:00:33 openvpn[685]: Diffie-Hellman initialized with 2048 bit key
Aug 1 02:00:33 openvpn[685]: Socket Buffers: R=[163840->131072] S=[163840->131072]
Aug 1 02:00:33 openvpn[685]: TUN/TAP device tun21 opened
Aug 1 02:00:33 openvpn[685]: TUN/TAP TX queue length set to 100
Aug 1 02:00:33 openvpn[685]: do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Aug 1 02:00:33 openvpn[685]: /sbin/ifconfig tun21 192.168.200.1 pointopoint 192.168.200.2 mtu 1500
Aug 1 02:00:33 openvpn[685]: /sbin/route add -net 192.168.200.0 netmask 255.255.255.0 gw 192.168.200.2
Aug 1 02:00:33 openvpn[694]: UDPv4 link local (bound): [undef]
Aug 1 02:00:33 openvpn[694]: UDPv4 link remote: [undef]
Aug 1 02:00:33 openvpn[694]: MULTI: multi_init called, r=256 v=256
Aug 1 02:00:33 openvpn[694]: IFCONFIG POOL: base=***Client_IP*** size=62, ipv6=0
Aug 1 02:00:33 openvpn[694]: Initialization Sequence Completed
Aug 1 02:00:33 ntp: start NTP update
Mar 3 20:47:07 dhcp client: bound ***Server_IP*** via ***Client_IP_GW*** during 1800 seconds.
Mar 3 20:58:38 openvpn[694]: ***Client_IP***:44598 TLS: Initial packet from [AF_INET]***Client_IP***:44598, sid=2081504e 3938add9
Mar 3 20:58:46 openvpn[694]: ***Client_IP***:44598 VERIFY OK: depth=1, C=TW, ST=TW, L=Taipei, O=ASUS, CN=RT-AC55U, emailAddress=me@myhost.mydomain
Mar 3 20:58:46 openvpn[694]: ***Client_IP***:44598 VERIFY OK: depth=0, C=TW, ST=TW, L=Taipei, O=ASUS, CN=client, emailAddress=me@myhost.mydomain
Mar 3 20:58:47 openvpn[694]: ***Client_IP***:44598 PLUGIN_CALL: POST /usr/lib/openvpn-plugin-auth-pam.so/PLUGIN_AUTH_USER_PASS_VERIFY status=0
Mar 3 20:58:47 openvpn[694]: ***Client_IP***:44598 TLS: Username/Password authentication succeeded for username 'CityTowerFD'
Mar 3 20:58:47 openvpn[694]: ***Client_IP***:44598 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Mar 3 20:58:47 openvpn[694]: ***Client_IP***:44598 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Mar 3 20:58:47 openvpn[694]: ***Client_IP***:44598 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Mar 3 20:58:47 openvpn[694]: ***Client_IP***:44598 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Mar 3 20:58:48 openvpn[694]: ***Client_IP***:44598 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA
Mar 3 20:58:48 openvpn[694]: ***Client_IP***:44598 [client] Peer Connection Initiated with [AF_INET]***Client_IP***:44598
Mar 3 20:58:48 openvpn[694]: client/***Client_IP***:44598 MULTI_sva: pool returned IPv4=192.168.200.10, IPv6=(Not enabled)
Mar 3 20:58:48 openvpn[694]: client/***Client_IP***:44598 MULTI: Learn: 192.168.200.10 -> client/***Client_IP***:44598
Mar 3 20:58:48 openvpn[694]: client/***Client_IP***:44598 MULTI: primary virtual IP for client/***Client_IP***:44598: 192.168.200.10
Mar 3 20:58:50 openvpn[694]: client/***Client_IP***:44598 PUSH: Received control message: 'PUSH_REQUEST'
Mar 3 20:58:50 openvpn[694]: client/***Client_IP***:44598 send_push_reply(): safe_cap=940
Mar 3 20:58:50 openvpn[694]: client/***Client_IP***:44598 SENT CONTROL [client]: 'PUSH_REPLY,route 192.168.1.0 255.255.255.0 vpn_gateway 500,route 192.168.200.1,topology net30,ping 15,ping-restart 60,ifconfig 192.168.200.10 192.168.200.9' (status=1)
Mar 3 20:59:53 openvpn[694]: client/***Client_IP***:41865 [client] Inactivity timeout (--ping-restart), restarting
Mar 3 20:59:53 openvpn[694]: client/***Client_IP***:41865 SIGUSR1[soft,ping-restart] received, client-instance restarting
Log na straně klienta:
Mar 3 20:58:38 openvpn[291]: OpenVPN 2.3.2 mipsel-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [eurephia] [MH] [IPv6] built on Aug 16 2016
Mar 3 20:58:38 openvpn[291]: Socket Buffers: R=[116736->131072] S=[116736->131072]
Mar 3 20:58:38 openvpn[304]: UDPv4 link local: [undef]
Mar 3 20:58:38 openvpn[304]: UDPv4 link remote: [AF_INET]***Server_IP***:1194
Mar 3 20:58:38 openvpn[304]: TLS: Initial packet from [AF_INET]***Server_IP***:1194, sid=58ff269a d018885b
Mar 3 20:58:38 openvpn[304]: WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Mar 3 20:58:39 openvpn[304]: VERIFY OK: depth=1, C=TW, ST=TW, L=Taipei, O=ASUS, CN=RT-AC55U, emailAddress=me@myhost.mydomain
Mar 3 20:58:39 openvpn[304]: VERIFY OK: nsCertType=SERVER
Mar 3 20:58:39 openvpn[304]: VERIFY OK: depth=0, C=TW, ST=TW, L=Taipei, O=ASUS, CN=RT-AC55U, emailAddress=me@myhost.mydomain
Mar 3 20:58:48 openvpn[304]: Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Mar 3 20:58:48 openvpn[304]: Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Mar 3 20:58:48 openvpn[304]: Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Mar 3 20:58:48 openvpn[304]: Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Mar 3 20:58:48 openvpn[304]: Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA
Mar 3 20:58:48 openvpn[304]: [RT-AC55U] Peer Connection Initiated with [AF_INET]***Server_IP***:1194
Mar 3 20:58:50 openvpn[304]: SENT CONTROL [RT-AC55U]: 'PUSH_REQUEST' (status=1)
Mar 3 20:58:50 openvpn[304]: PUSH: Received control message: 'PUSH_REPLY,route 192.168.1.0 255.255.255.0 vpn_gateway 500,route 192.168.200.1,topology net30,ping 15,ping-restart 60,ifconfig 192.168.200.10 192.168.200.9'
Mar 3 20:58:50 openvpn[304]: OPTIONS IMPORT: timers and/or timeouts modified
Mar 3 20:58:50 openvpn[304]: OPTIONS IMPORT: --ifconfig/up options modified
Mar 3 20:58:50 openvpn[304]: OPTIONS IMPORT: route options modified
Mar 3 20:58:50 openvpn[304]: TUN/TAP device tun15 opened
Mar 3 20:58:50 openvpn[304]: TUN/TAP TX queue length set to 100
Mar 3 20:58:50 openvpn[304]: do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Mar 3 20:58:50 openvpn[304]: /sbin/ifconfig tun15 192.168.200.10 pointopoint 192.168.200.9 mtu 1500
Mar 3 20:58:50 openvpn[304]: /sbin/route add -net 192.168.1.0 netmask 255.255.255.0 metric 500 gw 192.168.200.9
Mar 3 20:58:50 openvpn[304]: /sbin/route add -net 192.168.200.1 netmask 255.255.255.255 gw 192.168.200.9
Mar 3 20:58:50 openvpn[304]: Initialization Sequence Completed
Mar 3 20:59:07 crond[186]: time disparity of 836398 minutes detected
Routovací tabulka serveru:
Destination Gateway Genmask Flags Metric Ref Use Type Iface
default *PublicIPgw*.1 0.0.0.0 UG 0 0 0 WAN0 eth0
*PublicIP*.0 * 255.255.252.0 U 0 0 0 WAN0 eth0
*PublicIPgw*.1 * 255.255.255.255 UH 0 0 0 WAN0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 LAN br0
192.168.200.0 192.168.200.2 255.255.255.0 UG 0 0 0 tun21
192.168.200.2 * 255.255.255.255 UH 0 0 0 tun21
Routovací tabulka clienta:
Destination Gateway Genmask Flags Metric Ref Use Type Iface
192.168.200.9 * 255.255.255.255 UH 0 0 0 tun15
*PublicIPgw*.1 * 255.255.255.255 UH 0 0 0 WAN0 vlan2
192.168.200.1 192.168.200.9 255.255.255.255 UGH 0 0 0 tun15
*PublicIP*.0 * 255.255.255.248 U 0 0 0 WAN0 vlan2
192.168.100.0 * 255.255.255.0 U 0 0 0 LAN br0
192.168.1.0 192.168.200.9 255.255.255.0 UG 500 0 0 tun15
default *PublicIPgw*.1 0.0.0.0 UG 0 0 0 WAN0 vlan2
Myslím, že v routovací tabulce serveru bych měl mít route na subnet 192.168.100.0 ne?
Jak mám docílit spojení?
Spojení Client-server funguje, ale spojení server-client už ne.
Díky moc za pomoc.
Martin
#Automatically generated configuration daemon server 192.168.200.0 255.255.255.0 proto udp port 1194 dev tun21 comp-lzo adaptive keepalive 15 60 verb 3 push "route 192.168.1.0 255.255.255.0 vpn_gateway 500" duplicate-cn plugin /usr/lib/openvpn-plugin-auth-pam.so openvpn ca ca.crt dh dh.pem cert server.crt key server.key status-version 2 status status 10 # Custom Configuration ~ ~ ~Konfigurace klienta
client dev tun proto udp remote *ServerIP* 1194 float comp-lzo adaptive keepalive 15 60 auth-user-pass ns-cert-type server < ca> -----BEGIN CERTIFICATE-----Log na straně serveru:
Aug 1 02:00:33 openvpn[685]: OpenVPN 2.3.2 mips-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [eurephia] [MH] [IPv6] built on Dec 1 2016 Aug 1 02:00:33 openvpn[685]: PLUGIN_INIT: POST /usr/lib/openvpn-plugin-auth-pam.so '[/usr/lib/openvpn-plugin-auth-pam.so] [openvpn]' intercepted=PLUGIN_AUTH_USER_PASS_VERIFY Aug 1 02:00:33 openvpn[685]: Diffie-Hellman initialized with 2048 bit key Aug 1 02:00:33 openvpn[685]: Socket Buffers: R=[163840->131072] S=[163840->131072] Aug 1 02:00:33 openvpn[685]: TUN/TAP device tun21 opened Aug 1 02:00:33 openvpn[685]: TUN/TAP TX queue length set to 100 Aug 1 02:00:33 openvpn[685]: do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0 Aug 1 02:00:33 openvpn[685]: /sbin/ifconfig tun21 192.168.200.1 pointopoint 192.168.200.2 mtu 1500 Aug 1 02:00:33 openvpn[685]: /sbin/route add -net 192.168.200.0 netmask 255.255.255.0 gw 192.168.200.2 Aug 1 02:00:33 openvpn[694]: UDPv4 link local (bound): [undef] Aug 1 02:00:33 openvpn[694]: UDPv4 link remote: [undef] Aug 1 02:00:33 openvpn[694]: MULTI: multi_init called, r=256 v=256 Aug 1 02:00:33 openvpn[694]: IFCONFIG POOL: base=***Client_IP*** size=62, ipv6=0 Aug 1 02:00:33 openvpn[694]: Initialization Sequence Completed Aug 1 02:00:33 ntp: start NTP update Mar 3 20:47:07 dhcp client: bound ***Server_IP*** via ***Client_IP_GW*** during 1800 seconds. Mar 3 20:58:38 openvpn[694]: ***Client_IP***:44598 TLS: Initial packet from [AF_INET]***Client_IP***:44598, sid=2081504e 3938add9 Mar 3 20:58:46 openvpn[694]: ***Client_IP***:44598 VERIFY OK: depth=1, C=TW, ST=TW, L=Taipei, O=ASUS, CN=RT-AC55U, emailAddress=me@myhost.mydomain Mar 3 20:58:46 openvpn[694]: ***Client_IP***:44598 VERIFY OK: depth=0, C=TW, ST=TW, L=Taipei, O=ASUS, CN=client, emailAddress=me@myhost.mydomain Mar 3 20:58:47 openvpn[694]: ***Client_IP***:44598 PLUGIN_CALL: POST /usr/lib/openvpn-plugin-auth-pam.so/PLUGIN_AUTH_USER_PASS_VERIFY status=0 Mar 3 20:58:47 openvpn[694]: ***Client_IP***:44598 TLS: Username/Password authentication succeeded for username 'CityTowerFD' Mar 3 20:58:47 openvpn[694]: ***Client_IP***:44598 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key Mar 3 20:58:47 openvpn[694]: ***Client_IP***:44598 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication Mar 3 20:58:47 openvpn[694]: ***Client_IP***:44598 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key Mar 3 20:58:47 openvpn[694]: ***Client_IP***:44598 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication Mar 3 20:58:48 openvpn[694]: ***Client_IP***:44598 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA Mar 3 20:58:48 openvpn[694]: ***Client_IP***:44598 [client] Peer Connection Initiated with [AF_INET]***Client_IP***:44598 Mar 3 20:58:48 openvpn[694]: client/***Client_IP***:44598 MULTI_sva: pool returned IPv4=192.168.200.10, IPv6=(Not enabled) Mar 3 20:58:48 openvpn[694]: client/***Client_IP***:44598 MULTI: Learn: 192.168.200.10 -> client/***Client_IP***:44598 Mar 3 20:58:48 openvpn[694]: client/***Client_IP***:44598 MULTI: primary virtual IP for client/***Client_IP***:44598: 192.168.200.10 Mar 3 20:58:50 openvpn[694]: client/***Client_IP***:44598 PUSH: Received control message: 'PUSH_REQUEST' Mar 3 20:58:50 openvpn[694]: client/***Client_IP***:44598 send_push_reply(): safe_cap=940 Mar 3 20:58:50 openvpn[694]: client/***Client_IP***:44598 SENT CONTROL [client]: 'PUSH_REPLY,route 192.168.1.0 255.255.255.0 vpn_gateway 500,route 192.168.200.1,topology net30,ping 15,ping-restart 60,ifconfig 192.168.200.10 192.168.200.9' (status=1) Mar 3 20:59:53 openvpn[694]: client/***Client_IP***:41865 [client] Inactivity timeout (--ping-restart), restarting Mar 3 20:59:53 openvpn[694]: client/***Client_IP***:41865 SIGUSR1[soft,ping-restart] received, client-instance restartingLog na straně klienta:
Mar 3 20:58:38 openvpn[291]: OpenVPN 2.3.2 mipsel-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [eurephia] [MH] [IPv6] built on Aug 16 2016 Mar 3 20:58:38 openvpn[291]: Socket Buffers: R=[116736->131072] S=[116736->131072] Mar 3 20:58:38 openvpn[304]: UDPv4 link local: [undef] Mar 3 20:58:38 openvpn[304]: UDPv4 link remote: [AF_INET]***Server_IP***:1194 Mar 3 20:58:38 openvpn[304]: TLS: Initial packet from [AF_INET]***Server_IP***:1194, sid=58ff269a d018885b Mar 3 20:58:38 openvpn[304]: WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this Mar 3 20:58:39 openvpn[304]: VERIFY OK: depth=1, C=TW, ST=TW, L=Taipei, O=ASUS, CN=RT-AC55U, emailAddress=me@myhost.mydomain Mar 3 20:58:39 openvpn[304]: VERIFY OK: nsCertType=SERVER Mar 3 20:58:39 openvpn[304]: VERIFY OK: depth=0, C=TW, ST=TW, L=Taipei, O=ASUS, CN=RT-AC55U, emailAddress=me@myhost.mydomain Mar 3 20:58:48 openvpn[304]: Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key Mar 3 20:58:48 openvpn[304]: Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication Mar 3 20:58:48 openvpn[304]: Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key Mar 3 20:58:48 openvpn[304]: Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication Mar 3 20:58:48 openvpn[304]: Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA Mar 3 20:58:48 openvpn[304]: [RT-AC55U] Peer Connection Initiated with [AF_INET]***Server_IP***:1194 Mar 3 20:58:50 openvpn[304]: SENT CONTROL [RT-AC55U]: 'PUSH_REQUEST' (status=1) Mar 3 20:58:50 openvpn[304]: PUSH: Received control message: 'PUSH_REPLY,route 192.168.1.0 255.255.255.0 vpn_gateway 500,route 192.168.200.1,topology net30,ping 15,ping-restart 60,ifconfig 192.168.200.10 192.168.200.9' Mar 3 20:58:50 openvpn[304]: OPTIONS IMPORT: timers and/or timeouts modified Mar 3 20:58:50 openvpn[304]: OPTIONS IMPORT: --ifconfig/up options modified Mar 3 20:58:50 openvpn[304]: OPTIONS IMPORT: route options modified Mar 3 20:58:50 openvpn[304]: TUN/TAP device tun15 opened Mar 3 20:58:50 openvpn[304]: TUN/TAP TX queue length set to 100 Mar 3 20:58:50 openvpn[304]: do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0 Mar 3 20:58:50 openvpn[304]: /sbin/ifconfig tun15 192.168.200.10 pointopoint 192.168.200.9 mtu 1500 Mar 3 20:58:50 openvpn[304]: /sbin/route add -net 192.168.1.0 netmask 255.255.255.0 metric 500 gw 192.168.200.9 Mar 3 20:58:50 openvpn[304]: /sbin/route add -net 192.168.200.1 netmask 255.255.255.255 gw 192.168.200.9 Mar 3 20:58:50 openvpn[304]: Initialization Sequence Completed Mar 3 20:59:07 crond[186]: time disparity of 836398 minutes detectedRoutovací tabulka serveru:
Destination Gateway Genmask Flags Metric Ref Use Type Iface default *PublicIPgw*.1 0.0.0.0 UG 0 0 0 WAN0 eth0 *PublicIP*.0 * 255.255.252.0 U 0 0 0 WAN0 eth0 *PublicIPgw*.1 * 255.255.255.255 UH 0 0 0 WAN0 eth0 192.168.1.0 * 255.255.255.0 U 0 0 0 LAN br0 192.168.200.0 192.168.200.2 255.255.255.0 UG 0 0 0 tun21 192.168.200.2 * 255.255.255.255 UH 0 0 0 tun21Routovací tabulka clienta:
Destination Gateway Genmask Flags Metric Ref Use Type Iface 192.168.200.9 * 255.255.255.255 UH 0 0 0 tun15 *PublicIPgw*.1 * 255.255.255.255 UH 0 0 0 WAN0 vlan2 192.168.200.1 192.168.200.9 255.255.255.255 UGH 0 0 0 tun15 *PublicIP*.0 * 255.255.255.248 U 0 0 0 WAN0 vlan2 192.168.100.0 * 255.255.255.0 U 0 0 0 LAN br0 192.168.1.0 192.168.200.9 255.255.255.0 UG 500 0 0 tun15 default *PublicIPgw*.1 0.0.0.0 UG 0 0 0 WAN0 vlan2Myslím, že v routovací tabulce serveru bych měl mít route na subnet 192.168.100.0 ne? Jak mám docílit spojení? Spojení Client-server funguje, ale spojení server-client už ne. Díky moc za pomoc. Martin
route 192.168.100.0 255.255.255.0 ip_pridelena_vpn_klientoviZbytek už bude případně o doladění firewallu.
route 192.168.100.0 255.255.255.0 192.168.200.6což je virtuální adresa přidělená klientovim vyhodí mi to v logu error:
Mar 11 13:28:47 openvpn[21601]: /sbin/route add -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.200.6 Mar 11 13:28:47 openvpn[21601]: ERROR: Linux route add command failed: external program exited with error status: 1Možná protože v době, kdy se zadává route příkaz, není ještě připojený klient? Když zadám:
route 192.168.100.0 255.255.255.0 192.168.200.1nebo
route 192.168.100.0 255.255.255.0 192.168.200.2Tedy pustit to přes ptp sítě, viz:
Mar 10 23:38:12 openvpn[7534]: /sbin/ifconfig tun21 192.168.200.1 pointopoint 192.168.200.2 mtu 1500Route to vytvoří, ale nedopingnu se. Při zadávání route přes SSH mě to prostě za boha nechce pustit přes gw 192.168.200.6 (i když je klient už připojen). Btw mohu nějak v client.ovpn nastavit, jakou bude mít klient IP? Tedy např 192.168.200.10?
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.