Sziasztok!
Adott egy Hetzner VPS, amin Ubuntu fut. Van itthon egy TP-Link router, amin fut egy OpenVPN szerver. A router maga generálja a config fájlt. Windows-on, iOS-en tökéletesen múködik a dolog. Ubuntu valamiért nem akar csatlakozni. Lehet valami teljesen apró beállításon csúszik el a dolog, nagyon kezdő vagyok linux-ok terén.
Mikor csatlakozni szeretnék, ezt a hibát kapom:
root@VPS:~# sudo openvpn --config /root/Desktop/OpenVPN.ovpn
Wed Apr 17 00:01:42 2019 OpenVPN 2.4.4 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Sep 5 2018
Wed Apr 17 00:01:42 2019 library versions: OpenSSL 1.1.0g 2 Nov 2017, LZO 2.08
Wed Apr 17 00:01:42 2019 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
Wed Apr 17 00:01:42 2019 TCP/UDP: Preserving recently used remote address: [AF_INET]84.236.99.26:1194
Wed Apr 17 00:01:42 2019 UDP link local: (not bound)
Wed Apr 17 00:01:42 2019 UDP link remote: [AF_INET]84.236.99.26:1194
Wed Apr 17 00:01:43 2019 [server] Peer Connection Initiated with [AF_INET]84.236.99.26:1194
Wed Apr 17 00:01:44 2019 TUN/TAP device tun0 opened
Wed Apr 17 00:01:44 2019 do_ifconfig, tt->did_ifconfig_ipv6_setup=0
Wed Apr 17 00:01:44 2019 /sbin/ip link set dev tun0 up mtu 1500
Wed Apr 17 00:01:44 2019 /sbin/ip addr add dev tun0 local 10.8.0.10 peer 10.8.0.9
RTNETLINK answers: File exists
Wed Apr 17 00:01:44 2019 ERROR: Linux route add command failed: external program exited with error status: 2
RTNETLINK answers: File exists
Wed Apr 17 00:01:44 2019 ERROR: Linux route add command failed: external program exited with error status: 2
Wed Apr 17 00:01:44 2019 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Wed Apr 17 00:01:44 2019 Initialization Sequence Completed
^CWed Apr 17 00:01:47 2019 event_wait : Interrupted system call (code=4)
Wed Apr 17 00:01:47 2019 /sbin/ip addr del dev tun0 local 10.8.0.10 peer 10.8.0.9
Wed Apr 17 00:01:48 2019 SIGINT[hard,] received, process exiting
A VPN fájl konfigurációja:
client
dev tun
proto udp
float
nobind
cipher AES-128-CBC
comp-lzo adaptive
resolv-retry infinite
persist-key
persist-tun
remote
Hozzászólások
Az "ip a" meg az "ip ro" parancsok a barátaid a probléma megleléséhez ;-)
Nem biztos :D pontosan mit kellene látnom? Bocsánat, tényleg nagyon kezdő vagyok..:(
Mi a tun0 interface statusza? Egy manualis ifup es/vagy egy flush segithet adott esetben, megneznem azt.
Unknown interface tun0
Na, ez a baj. :) Annak léteznie kell, hogy szegény ovpn tudja használni.
Elvileg sikerült hozzáadni mint hálózati kártya. Nincs semmi definiálva (gondolom ezt majd a VPN szervertől megkapja)
tun0: flags=4241 mtu 1500
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
De az ifup még mindig ez:
root@VPS:~# ifup tun0
Unknown interface tun0
Hogy adtad hozza az interface-t?
ip tuntap add mode tun dev tun0
Ez mit mond? openvpn --mktun --dev tun0
Illetve varj, trivialis kerdes - fut egyaltalan az openvpn service? Mert a manualis interface-letrehozas nem feltetlenula legjobb otlet, az az ovpn-nek magatol letre kellene hozni, de ehhez kell, hogy fusson, termeszetesen.
root@VPS:~# openvpn --mktun --dev tun0
Wed Apr 17 14:31:15 2019 TUN/TAP device tun0 opened
Wed Apr 17 14:31:15 2019 Persist state set to: ON
A service fut. De mióta létrehoztam a tun0-t az openvpn a tun1-et akarja használni. Ha létrehozom azt, akkor a 2-t.
root@VPS:~# sudo openvpn --config /root/Desktop/OpenVPN.ovpn
Wed Apr 17 14:31:47 2019 OpenVPN 2.4.4 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Sep 5 2018
Wed Apr 17 14:31:47 2019 library versions: OpenSSL 1.1.0g 2 Nov 2017, LZO 2.08
Wed Apr 17 14:31:47 2019 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
Wed Apr 17 14:31:47 2019 TCP/UDP: Preserving recently used remote address: [AF_INET]84.236.99.26:1194
Wed Apr 17 14:31:47 2019 UDP link local: (not bound)
Wed Apr 17 14:31:47 2019 UDP link remote: [AF_INET]84.236.99.26:1194
Wed Apr 17 14:31:48 2019 [server] Peer Connection Initiated with [AF_INET]84.236.99.26:1194
Wed Apr 17 14:31:49 2019 TUN/TAP device tun1 opened
Wed Apr 17 14:31:49 2019 do_ifconfig, tt->did_ifconfig_ipv6_setup=0
Wed Apr 17 14:31:49 2019 /sbin/ip link set dev tun1 up mtu 1500
Wed Apr 17 14:31:49 2019 /sbin/ip addr add dev tun1 local 10.8.0.6 peer 10.8.0.5
RTNETLINK answers: File exists
Wed Apr 17 14:31:49 2019 ERROR: Linux route add command failed: external program exited with error status: 2
RTNETLINK answers: File exists
Wed Apr 17 14:31:49 2019 ERROR: Linux route add command failed: external program exited with error status: 2
Wed Apr 17 14:31:49 2019 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Wed Apr 17 14:31:49 2019 Initialization Sequence Completed
Persze, hiszen egy új, saját tunX interfészt akar felhúzni, majd a routing-ot beállítani - na ez az, ami nem megy neki. Milyen címeket osztanál ki a vpn-re, mi a lokális gép címe/hálózata, hogy néz ki a routing tábla?
+1, ezert is mondtam, hogy maualisan letrehozni nem a legjobb otlet. Nezd at a routing-ot, illetve az ujonnan letrehozott interface-eket (amiket kezzel csinaltal), inkabb torold.
Szerver:
http://www.kepfeltoltes.eu/images/2019/03/1124.png
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 172.31.1.1 0.0.0.0 UG 0 0 0 eth0
172.31.1.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
eth0: flags=4163 mtu 1500
inet 116.203.43.231 netmask 255.255.255.255 broadcast 116.203.43.231
inet6 2a01:4f8:c2c:2cb4::1 prefixlen 64 scopeid 0x0
inet6 fe80::9400:ff:fe24:26ff prefixlen 64 scopeid 0x20
ether 96:00:00:24:26:ff txqueuelen 1000 (Ethernet)
RX packets 20936 bytes 10226551 (10.2 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 14313 bytes 3374220 (3.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 136 bytes 10858 (10.8 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 136 bytes 10858 (10.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Ha már root vagy, próbáld meg sudo nélkül esetleg.